-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for dependencies #61
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. It does need some unit tests to ensure
- The analyzer is finding the right dependencies, and
- The
BOMBuilder
is generating the right output with the dependencies.
The existing SimplePod and TestingPod fixtures both have a single dependency in them that can help with the tests. It might be good to create one more fixture with maybe a couple of dependencies to ensure it's iterating over everything correctly.
|
||
def initialize(component: nil, pods:) | ||
@component, @pods = component, pods | ||
def initialize(component: nil, dependencies: nil, pods:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy is asking you to put pods:
as the first parameter because pods
is the only parameter that does not specify a default value. Calls to this function can then look like one of the following (note that pods
is always first because it has to be specified):
BOMBuilder.new(pods: pods)
BOMBuilder.new(pods: pods, component: myComponent)
BOMBuilder.new(pods: pods, dependencies: deps)
BOMBuilder.new(pods: pods, component: myComponent, dependencies: deps)
Sorry for the delay, I added tests for pod analyzer I will do the same with bom builder later, but for the restrictedPod the code is breaking on the sources, any idea why? |
The RestrictedPod is a fixture because it has a nice edge case where the Podfile is for iOS, and the In the bom.xml output tests for the RestrictedPod, I would not expect to see any references to It might be better to restructure the new code by adding new capability to the def append_all_pod_dependencies(pods_used, pods_cache)
result = pods_used
dependencies_hash = [] # new
original_number = 0
# Loop adding pod dependencies until we are not adding any more dependencies to the result
# This brings in all the transitive dependencies of every top level pod.
# Note this also handles two edge cases:
# 1. Having a Podfile with no pods used.
# 2. Having a pod that has a platform-specific dependency that is unused for this Podfile.
while result.length != original_number
original_number = result.length
pods_used.each { |pod_name|
if pods_cache.key?(pod_name) && !pods_cache[pod_name].empty? # new
result.push(*pods_cache[pod_name]) # changed
dependencies_hash[pod_name] = *pods_cache[pod_name] # new
# maybe additional dependency processing needed here???
end
}
result = result.uniq
# maybe additional dependency processing needed here???
pods_used = result
end
result # change this to return result and dependencies_hash or make dependencies_hash a class property
end |
I will change it to reflect that |
Fixed the issue with Reserved Podfile... @macblazer I think the only thing missing is adding tests to the bom builder. Are you able to help with this part? |
cleaned up a little bit the code, following your advice, also added bom_builder tests following the already existing tests. |
Signed-off-by: Marlon Pina Tojal <[email protected]>
Everything should be ok now |
Signed-off-by: Marlon Pina Tojal <[email protected]>
@macblazer can you have another look? |
Signed-off-by: Marlon Pina Tojal <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution and working through all the updates.
Fixes #58
Still need to add tests for this