Skip to content

Commit

Permalink
Revert "Support macros when cross-compiling (#7118)" (#7352)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxDesiatov committed Feb 20, 2024
1 parent 2c18196 commit adfbd9a
Show file tree
Hide file tree
Showing 46 changed files with 364 additions and 1,138 deletions.
19 changes: 2 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
Note: This is in reverse chronological order, so newer entries are added to the top.

Swift 6.0
Swift Next
-----------

* [#7202]

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

* [#7201]

`// 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.

* [#7118]

Macros cross-compiled by SwiftPM with Swift SDKs are now correctly built, loaded, and evaluated for the host triple.

Swift 5.10
-----------

* [#7010]

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.

* [#7101]
* [7101]

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

Expand Down Expand Up @@ -398,8 +387,4 @@ Swift 3.0
[#6276]: https://github.com/apple/swift-package-manager/pull/6276
[#6540]: https://github.com/apple/swift-package-manager/pull/6540
[#6663]: https://github.com/apple/swift-package-manager/pull/6663
[#7010]: https://github.com/apple/swift-package-manager/pull/7010
[#7101]: https://github.com/apple/swift-package-manager/pull/7101
[#7118]: https://github.com/apple/swift-package-manager/pull/7118
[#7201]: https://github.com/apple/swift-package-manager/pull/7201
[#7202]: https://github.com/apple/swift-package-manager/pull/7202
11 changes: 1 addition & 10 deletions Sources/Basics/Collections/IdentifiableSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,13 @@ public struct IdentifiableSet<Element: Identifiable>: Collection {
}

public subscript(id: Element.ID) -> Element? {
get {
self.storage[id]
}
set {
self.storage[id] = newValue
}
self.storage[id]
}

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

public mutating func insert(_ element: Element) {
self.storage[element.id] = element
}

public func union(_ otherSequence: some Sequence<Element>) -> Self {
var result = self
for element in otherSequence {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import struct SPMBuildCore.BuildParameters
import struct SPMBuildCore.BuildToolPluginInvocationResult
import struct SPMBuildCore.PrebuildCommandResult

@_spi(SwiftPMInternal)
import SPMBuildCore

import enum TSCBasic.ProcessEnv

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

/// Path to the bundle generated for this module (if any).
var bundlePath: AbsolutePath? {
guard !self.resources.isEmpty else {
guard !resources.isEmpty else {
return .none
}

Expand Down Expand Up @@ -130,7 +127,7 @@ public final class ClangTargetBuildDescription {
self.target = target
self.toolsVersion = toolsVersion
self.buildParameters = buildParameters
self.tempsPath = target.tempsPath(buildParameters)
self.tempsPath = buildParameters.buildPath.appending(component: target.c99name + ".build")
self.derivedSources = Sources(paths: [], root: tempsPath.appending("DerivedSources"))

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

args += optimizationArguments
args += activeCompilationConditions
Expand Down
4 changes: 2 additions & 2 deletions Sources/Build/BuildDescription/ProductBuildDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription
// setting is the package-level right now. We might need to figure out a better
// answer for libraries if/when we support specifying deployment target at the
// target-level.
args += try self.buildParameters.tripleArgs(for: self.product.targets[self.product.targets.startIndex])
args += try self.buildParameters.targetTripleArgs(for: self.product.targets[self.product.targets.startIndex])

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

Expand Down

This file was deleted.

0 comments on commit adfbd9a

Please sign in to comment.