(WIP) allow custom override path when searching for Package.swift manifest file
#3336
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A first attempt at implementing a
--manifest-prefixoption, which specifies an override path when searching forPackage.swift. This is extremely important for build systems using the SPM, as we would like automation tools to be able to generate rootPackage.swiftfiles without clobbering or displacing the user’s originalPackage.swift.An ideal build system workflow would parse the user-defined
Package.swift, and place generatedPackage.swifts in a hidden subdirectory, when could then be used with--manifest-prefix:Modifications:
This patch attempts to separate out
manifestPath: AbsolutePathfrompackagePath : AbsolutePathwhich is currently used everywhere in the codebase as a standin formanifestPath.parentDirectory. The two paths should remain coupled for any package that is not a root package, or if the--manifest-prefixoption is not used.It also attempts to address some of the FIXMEs in
PackageGraph+Loader.swiftwhere we were trying to derivepackagePathfrommanifest.pathinstead of the other way around.Currently, the patch works for
swift package initandswift buildwith no remote dependencies. For some reason, it does not work when there are dependencies present. I think the problem is related toPackageReferenceorLocalPackageContainer.swift, but I am not familiar enough with the code base to figure out why. Help with this would be appreciated