-
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
SwiftTool: introduce --experimental-destination-selector
option
#5922
Conversation
Also adds `experimental-destination list` subcommand, which prints a list of available destinations. `ArtifactsArchiveMetadata` schema version validation is implemented to accept new 1.1 schema version with the new destinations bundle type.
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
I think |
@@ -103,7 +103,7 @@ public struct Destination: Encodable, Equatable { | |||
} | |||
|
|||
/// Additional flags to be passed to the build tools. | |||
public let extraFlags: BuildFlags | |||
public var extraFlags: BuildFlags |
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.
does it need to be mutated?
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.
Yes, it happens on https://github.com/apple/swift-package-manager/pull/5922/files#diff-ba866b666cdc2795c59e6713e0817015f0076f5447541e8c477db717cbb6baf3R114
Since it's a struct, I think making this var
is safe, as any mutations are local and don't have side effects?
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.
👍
Sources/PackageModel/Manifest.swift
Outdated
@@ -180,14 +180,14 @@ public final class Manifest { | |||
} | |||
|
|||
var requiredDependencies: Set<PackageIdentity> = [] | |||
for targetTriple in self.targetsRequired(for: products) { | |||
for targetDependency in targetTriple.dependencies { | |||
for linuxGNUTargetTriple in self.targetsRequired(for: products) { |
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.
?
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.
automated Xcode renaming is bad at this, sorry...
@@ -48,7 +48,7 @@ public struct TestingObservability { | |||
self.collector.hasWarnings | |||
} | |||
|
|||
struct Collector: ObservabilityHandlerProvider, DiagnosticsHandler, CustomStringConvertible { | |||
final class Collector: ObservabilityHandlerProvider, DiagnosticsHandler, CustomStringConvertible { |
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.
As I'm using ObservabilityScope
in this PR, I'm taking an opportunity to make this a class
, because diagnostics: ThreadSafeArrayStore
is a class instance, so there's no actual value semantics here even with a struct
.
Sources/Workspace/Workspace.swift
Outdated
try location.validate( | ||
keyPath: \.sharedCrossCompilationDestinationsDirectory, | ||
fileSystem: fileSystem, | ||
getOrCreateHandler: { |
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.
use the function pointer?
13ec06e
to
23e8991
Compare
…xd/build-with-destinations # Conflicts: # Sources/SPMBuildCore/DestinationsBundle.swift
@swift-ci please smoke test |
@swift-ci please smoke test |
@swift-ci smoke test |
Depends on #5911.
Motivation:
With support for listing cross-compilation destinations with new
swift experimental-destinations list
command, we also need a way to actually use those. New--experimental-destination-selector
option is added, through which users can either select a destination via an ID or a target triple.Modifications:
Added new
crossCompilationDestinationSelector
toBuildOptions
. ModifiedSwiftTool
to select a destination from this selector string. Implemented destination selection based on a selector inDestinationsBundle.swift
. RefactoredWorkspace.Location
to create shared locations in a unified way. Added a simple test for destination selection.Result:
Cross-compilation destinations can be selected when building a package.