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
Transitively Link Static Dependency's Dynamic Dependencies Correctly #484
Conversation
Generated by 🚫 Danger |
The failing test passes locally I think |
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! You can push an empty commit to re-trigger CI
.map { DependencyReference.product(target: $0.target.name) } | ||
var staticLibraries = [DependencyReference]() | ||
|
||
findAll(targetNode: targetNode, test: isStaticLibrary, skip: isFramework).forEach { |
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.
we could keep the static libraries related code local to this scope via some minor tweaks:
e.g.
let staticLibraryTargetNodes = findAll(targetNode: targetNode, test: isStaticLibrary, skip: isFramework)
let staticLibraries = staticLibraryTargetNodes.map {
DependencyReference.product(target: $0.target.name)
}
let staticDependenciesDynamicLibraries = staticLibraryTargetNodes.flatMap {
$0.targetDependencies
.filter(or(isFramework, isDynamicLibrary))
.map { DependencyReference.product(target: $0.target.name) }
}
references = references.union(staticLibraries + staticDependenciesDynamicLibraries)
...
I guess that sorta goes against the sections marked out in comments - though those could change too if that helps
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.
I had something similar before but changed it due to the comments in the code. I'll change the comments and go by your suggestion.
Codecov Report
@@ Coverage Diff @@
## master #484 +/- ##
==========================================
+ Coverage 92.4% 92.45% +0.04%
==========================================
Files 348 348
Lines 17809 17914 +105
==========================================
+ Hits 16457 16562 +105
Misses 1352 1352
Continue to review full report at Codecov.
|
Resolves #455
Short description 📝
This PR fixes the issue where a static dependency's dynamic libraries were linking incorrectly.
Solution 📦
As we already traverse the graph for static dependencies, we can add a step to this process to check each static dependency's
targetDependencies
for dynamic libraries and add them as a reference adjacent to where the original static dependency is referenced.Implementation 👩💻👨💻
linkableDependencies
inGraph.swift
to reference a static dependency's dynamic librariesGraphTests
to check the test case:GraphTests
to check the test case:GraphTests
to check the test case:Test Plan
tuist generate
insidefixtures/ios_app_with_static_frameworks
App
target hasD
insideBuild Phases -> Link Binary With Libraries