Skip to content

Commit adfbd9a

Browse files
authored
Revert "Support macros when cross-compiling (#7118)" (#7352)
1 parent 2c18196 commit adfbd9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+364
-1138
lines changed

CHANGELOG.md

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
Note: This is in reverse chronological order, so newer entries are added to the top.
22

3-
Swift 6.0
3+
Swift Next
44
-----------
55

66
* [#7202]
77

88
Package manifests can now access information about the Git repository the given package is in via the context object's
99
`gitInformation` property. This allows to determine the current tag (if any), the current commit and whether or not there are uncommited changes.
1010

11-
* [#7201]
12-
13-
`// swift-tools-version:` can now be specified on subsequent lines of `Package.swift`, for example when first few lines are required to contain a licensing comment header.
14-
15-
* [#7118]
16-
17-
Macros cross-compiled by SwiftPM with Swift SDKs are now correctly built, loaded, and evaluated for the host triple.
18-
19-
Swift 5.10
20-
-----------
21-
2211
* [#7010]
2312

2413
On macOS, `swift build` and `swift run` now produce binaries that allow backtraces in debug builds. Pass `SWIFT_BACKTRACE=enable=yes` environment variable to enable backtraces on such binaries when running them.
2514

26-
* [#7101]
15+
* [7101]
2716

2817
Binary artifacts are now cached along side repository checkouts so they do not need to be re-downloaded across projects.
2918

@@ -398,8 +387,4 @@ Swift 3.0
398387
[#6276]: https://github.com/apple/swift-package-manager/pull/6276
399388
[#6540]: https://github.com/apple/swift-package-manager/pull/6540
400389
[#6663]: https://github.com/apple/swift-package-manager/pull/6663
401-
[#7010]: https://github.com/apple/swift-package-manager/pull/7010
402390
[#7101]: https://github.com/apple/swift-package-manager/pull/7101
403-
[#7118]: https://github.com/apple/swift-package-manager/pull/7118
404-
[#7201]: https://github.com/apple/swift-package-manager/pull/7201
405-
[#7202]: https://github.com/apple/swift-package-manager/pull/7202

Sources/Basics/Collections/IdentifiableSet.swift

+1-10
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,13 @@ public struct IdentifiableSet<Element: Identifiable>: Collection {
4545
}
4646

4747
public subscript(id: Element.ID) -> Element? {
48-
get {
49-
self.storage[id]
50-
}
51-
set {
52-
self.storage[id] = newValue
53-
}
48+
self.storage[id]
5449
}
5550

5651
public func index(after i: Index) -> Index {
5752
Index(storageIndex: self.storage.index(after: i.storageIndex))
5853
}
5954

60-
public mutating func insert(_ element: Element) {
61-
self.storage[element.id] = element
62-
}
63-
6455
public func union(_ otherSequence: some Sequence<Element>) -> Self {
6556
var result = self
6657
for element in otherSequence {

Sources/Build/BuildDescription/ClangTargetBuildDescription.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ import struct SPMBuildCore.BuildParameters
1919
import struct SPMBuildCore.BuildToolPluginInvocationResult
2020
import struct SPMBuildCore.PrebuildCommandResult
2121

22-
@_spi(SwiftPMInternal)
23-
import SPMBuildCore
24-
2522
import enum TSCBasic.ProcessEnv
2623

2724
/// Target description for a Clang target i.e. C language family target.
@@ -52,7 +49,7 @@ public final class ClangTargetBuildDescription {
5249

5350
/// Path to the bundle generated for this module (if any).
5451
var bundlePath: AbsolutePath? {
55-
guard !self.resources.isEmpty else {
52+
guard !resources.isEmpty else {
5653
return .none
5754
}
5855

@@ -130,7 +127,7 @@ public final class ClangTargetBuildDescription {
130127
self.target = target
131128
self.toolsVersion = toolsVersion
132129
self.buildParameters = buildParameters
133-
self.tempsPath = target.tempsPath(buildParameters)
130+
self.tempsPath = buildParameters.buildPath.appending(component: target.c99name + ".build")
134131
self.derivedSources = Sources(paths: [], root: tempsPath.appending("DerivedSources"))
135132

136133
// We did not use to apply package plugins to C-family targets in prior tools-versions, this preserves the behavior.
@@ -222,7 +219,7 @@ public final class ClangTargetBuildDescription {
222219
if self.buildParameters.triple.isDarwin() {
223220
args += ["-fobjc-arc"]
224221
}
225-
args += try self.buildParameters.tripleArgs(for: target)
222+
args += try buildParameters.targetTripleArgs(for: target)
226223

227224
args += optimizationArguments
228225
args += activeCompilationConditions

Sources/Build/BuildDescription/ProductBuildDescription.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription
311311
// setting is the package-level right now. We might need to figure out a better
312312
// answer for libraries if/when we support specifying deployment target at the
313313
// target-level.
314-
args += try self.buildParameters.tripleArgs(for: self.product.targets[self.product.targets.startIndex])
314+
args += try self.buildParameters.targetTripleArgs(for: self.product.targets[self.product.targets.startIndex])
315315

316316
// Add arguments from declared build settings.
317317
args += self.buildSettingsFlags
@@ -346,7 +346,7 @@ public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription
346346
// Library search path for the toolchain's copy of SwiftSyntax.
347347
#if BUILD_MACROS_AS_DYLIBS
348348
if product.type == .macro {
349-
args += try ["-L", defaultBuildParameters.toolchain.hostLibDir.pathString]
349+
args += try ["-L", buildParameters.toolchain.hostLibDir.pathString]
350350
}
351351
#endif
352352

Sources/Build/BuildDescription/ResolvedTarget+BuildDescription.swift

-23
This file was deleted.

0 commit comments

Comments
 (0)