-
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
Fix incorrect paths for library products with explicit linkage #7519
Conversation
Library products declared with `.static` or `.dynamic` didn't have a `-tools` suffix in their file names when built as dependencies of macros. This change resolves the inconsistency and adds corresponding build plan tests. rdar://127170225
@swift-ci test |
@@ -243,7 +243,7 @@ public struct BuildParameters: Encodable { | |||
|
|||
/// Returns the path to the dynamic library of a product for the current build parameters. | |||
func potentialDynamicLibraryPath(for product: ResolvedProduct) throws -> RelativePath { | |||
try RelativePath(validating: "\(self.triple.dynamicLibraryPrefix)\(product.name)\(self.triple.dynamicLibraryExtension)") | |||
try RelativePath(validating: "\(self.triple.dynamicLibraryPrefix)\(product.name)\(self.suffix(triple: product.buildTriple))\(self.triple.dynamicLibraryExtension)") |
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.
How likely is it that we're missing other suffix's 😅? Is there any decent way to look for all of them?
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.
Given that we're constructing these paths in many places in an ad-hoc way, it is still somewhat likely. I'll do an audit of this code and also generalize path handling to avoid ad-hocness in a follow-up PR not to stall this one.
…lang#7519) Library products declared with `.static` or `.dynamic` linkage didn't have a `-tools` suffix in their file names when built as dependencies of macros. This change resolves the inconsistency and adds corresponding build plan tests. The regression in question broke the compatibility test suite, which had [an old version of `swift-power-assert`](https://github.com/kishikawakatsumi/swift-power-assert/blob/a60cb50/Package.swift) depending on an old version of `swift-syntax` with explicit `.static` linkage for its products. rdar://127170225
…lang#7519) Library products declared with `.static` or `.dynamic` linkage didn't have a `-tools` suffix in their file names when built as dependencies of macros. This change resolves the inconsistency and adds corresponding build plan tests. The regression in question broke the compatibility test suite, which had [an old version of `swift-power-assert`](https://github.com/kishikawakatsumi/swift-power-assert/blob/a60cb50/Package.swift) depending on an old version of `swift-syntax` with explicit `.static` linkage for its products. rdar://127170225
Library products declared with `.static` or `.dynamic` linkage didn't have a `-tools` suffix in their file names when built as dependencies of macros. This change resolves the inconsistency and adds corresponding build plan tests. The regression in question broke the compatibility test suite, which had [an old version of `swift-power-assert`](https://github.com/kishikawakatsumi/swift-power-assert/blob/a60cb50/Package.swift) depending on an old version of `swift-syntax` with explicit `.static` linkage for its products. rdar://127170225 (cherry picked from commit 8db2401) # Conflicts: # Tests/BuildTests/CrossCompilationBuildPlanTests.swift
**Explanation**: Macros cross-compiled by SwiftPM with Swift SDKs should be correctly built, loaded, and evaluated for the host triple. **Scope**: isolated to modules dependency resolution and llbuild, does not impact code related to XCBuild. **Risk**: medium, known issues were addressed on `main` and are cherry-picked here, with no new issues reported for a few weeks now. **Testing**: added unit tests, manual end-to-end testing done with existing Swift SDKs. **Issue**: rdar://105991372 **Reviewers**: @bnbarham @xedin @neonichu (cherry picked from commit cb3b085, #7353) ``` # Conflicts: # CHANGELOG.md # Sources/Build/BuildDescription/SwiftTargetBuildDescription.swift # Sources/Build/BuildManifest/LLBuildManifestBuilder.swift # Sources/Build/BuildPlan/BuildPlan.swift # Sources/Commands/SwiftTestCommand.swift # Sources/Commands/Utilities/PluginDelegate.swift # Sources/Commands/Utilities/TestingSupport.swift # Sources/PackageGraph/ModulesGraph+Loading.swift # Sources/PackageGraph/ModulesGraph.swift # Sources/SPMTestSupport/MockBuildTestHelper.swift # Sources/SPMTestSupport/MockPackageGraphs.swift # Sources/SPMTestSupport/PackageGraphTester.swift # Sources/SPMTestSupport/ResolvedTarget+Mock.swift # Tests/BuildTests/ClangTargetBuildDescriptionTests.swift # Tests/BuildTests/CrossCompilationBuildPlanTests.swift # Tests/SourceKitLSPAPITests/SourceKitLSPAPITests.swift ``` (cherry picked from commit b9eb3c1, #7493) ``` # Conflicts: # Sources/PackageGraph/ModulesGraph+Loading.swift # Sources/PackageGraph/Resolution/ResolvedPackage.swift ``` (cherry picked from commit 5a4c024, #7508) ``` # Conflicts: # Sources/Commands/SwiftBuildCommand.swift # Sources/Commands/SwiftTestCommand.swift # Sources/Commands/Utilities/TestingSupport.swift ``` (cherry picked from commit 8db2401, #7519) ``` # Conflicts: # Tests/BuildTests/CrossCompilationBuildPlanTests.swift ``` --------- Co-authored-by: Jonathan Grynspan <jgrynspan@apple.com> Co-authored-by: Ben Barham <ben_barham@apple.com> Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com> Co-authored-by: Pavel Yaskevich <xedin@apache.org>
Library products declared with
.static
or.dynamic
linkage didn't have a-tools
suffix in their file names when built as dependencies of macros. This change resolves the inconsistency and adds corresponding build plan tests.The regression in question broke the compatibility test suite, which had an old version of
swift-power-assert
depending on an old version ofswift-syntax
with explicit.static
linkage for its products.rdar://127170225