-
Notifications
You must be signed in to change notification settings - Fork 45
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 dependencies comparator #44
Add dependencies comparator #44
Conversation
Codecov Report
@@ Coverage Diff @@
## master #44 +/- ##
==========================================
+ Coverage 96.12% 96.17% +0.05%
==========================================
Files 43 44 +1
Lines 1598 1672 +74
==========================================
+ Hits 1536 1608 +72
- Misses 62 64 +2
Continue to review full report at Codecov.
|
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.
Nice work 👍
We need to revisit how we extract the dependency names to make it cover more cases :)
// MARK: - Private | ||
|
||
private func compare(_ first: PBXTarget, _ second: PBXTarget) throws -> [CompareResult] { | ||
let firstNames = first.dependencies.map { $0.name ?? $0.target!.name }.toSet() |
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.
This will sadly crash in the event a project has a swift package dependency ... in that scenario there is no name, nor target! in fact looking at PBXTargetDependency
there's even another type targetProxy
!
The others are a bit easier:
private func resolveDependencyDescription(from dependency: PBXTargetDependency) -> String? {
let nameCandidates = [
dependency.name,
dependency.target?.name,
dependency.product?.productName
]
return nameCandidates.compactMap { $0 }.first
}
For the target proxy we may have to construct some form or description based on the reference and maybe annotate it's a remote target or something along those lines.
ad2a4ab
to
ee66600
Compare
@marciniwanicki mind a rebase on master? |
Signed-off-by: Marcin Iwanicki <[email protected]>
Signed-off-by: Marcin Iwanicki <[email protected]>
Signed-off-by: Marcin Iwanicki <[email protected]>
Signed-off-by: Marcin Iwanicki <[email protected]>
Signed-off-by: Marcin Iwanicki <[email protected]>
ee66600
to
3bc8d9a
Compare
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.
Nice work @marciniwanicki 👍
Tested it out with local swift packages
A minor suggestion for next time possibly a space around the =
or maybe event have it as :
from:
❌ DEPENDENCIES > "Project" target
⚠️ Only in second (3):
• (product_name=MyLibrary, context=none)
• (target=MismatchingLibrary)
• (target=NewFramework)
to:
❌ DEPENDENCIES > "Project" target
⚠️ Only in second (3):
• (product_name: MyLibrary, context: none)
• (target: MismatchingLibrary)
• (target: NewFramework)
Happy to do it as a follow up myself if you think it looks nicer.
Resolves: #41
Describe your changes
Added new comparator to compare "Dependencies" build phases.
Usage:
Testing performed
Compare the same project to itself
xcdiff -p1 Fixtures/ios_project_1/Project.xcodeproj -p2 Fixtures/ios_project_1/Project.xcodeproj -g dependencies
Compare two different projects
xcdiff -p1 Fixtures/ios_project_1/Project.xcodeproj -p2 Fixtures/ios_project_2/Project.xcodeproj -g dependencies