-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conditional target dependencies proposal implementation #2428
Conditional target dependencies proposal implementation #2428
Conversation
6446f27
to
f919bb7
Compare
@swift-ci please smoke test |
f919bb7
to
3c76cd8
Compare
@swift-ci please smoke test |
For linkage you can use EXCLUDED_SOURCE_FILE_NAMES tricks, but for target dependencies, there's no way to conditionalize them. |
da66345
to
42495f2
Compare
@jakepetroules Thanks for the answer! As it won't be able to officially support conditional target dependencies, @aciidb0mb3r suggested outputting a warning in those situations, which I have done. The implementation is now complete from my side. |
42495f2
to
6ab5ef1
Compare
40aefdc
to
f76c789
Compare
f76c789
to
6cd80ed
Compare
@@ -15,26 +15,56 @@ public final class ResolvedTarget: CustomStringConvertible, ObjectIdentifierProt | |||
|
|||
/// Represents dependency of a resolved target. | |||
public enum Dependency: Hashable { | |||
public static func == (lhs: ResolvedTarget.Dependency, rhs: ResolvedTarget.Dependency) -> Bool { |
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.
Is it not possible to let compiler auto synthesize this?
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.
No, because we don't want to have equality on conditions.
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 have minor nitpicky comments but it looks great! Thanks for working on it!
6cd80ed
to
85a38c1
Compare
@swift-ci please smoke test |
…endencies-impl Conditional target dependencies proposal implementation
So it sounds like |
Same question.How can i using |
This is the implementation of the target dependency proposal that I plan to write a proposal for. I implemented it so that it only affects the build plan, but not the dependency resolver. This allows the
Package.resolved
file to stay platform and configuration independent:TargetDescription.Dependency
,Target.Dependency
,ResolvedTarget.Dependency
to store the conditions configured in the manifest for each case.Target.dependencies
andTarget.targetDeps
into oneTarget.dependencies
property containing all dependencies, and adapted code using those properties in consequence.ResolvedTarget.recursiveDependencies
to get all dependencies (target + product) and added arecursiveTargetDependencies
function to do what the previous function did. I also added abuildDependencies
function to filter dependencies that satisfy an certain build environment. Similarly, I definedrecursiveBuildDependencies
andrecursiveBuildTargetDependencies
that do the same thing but recursively.reachableBuildTargets
andreachableBuildProducts
functions onPackageGraph
that mirror thereachableTargets
andreachableProducts
properties but filter dependencies that don't satisfy the input environment.LLBuildManifestBuilder
andBuildPlan
to only take into account dependencies that satisfy the build environment.But I'm facing one issue: how to generate an Xcode project with targets that have conditional dependencies on configuration? I don't want to add target dependencies universally. I'm not even sure if this is supported by Xcode. Any ideas?