From 4e40886a4f11461845e074ba75b87772da501c22 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Fri, 26 Apr 2024 18:49:36 +0100 Subject: [PATCH 1/3] Remove `experimental` prefix from Swift SDK command --- Package.swift | 2 +- Sources/CMakeLists.txt | 2 +- Sources/CoreCommands/Options.swift | 7 +++++-- Sources/PackageModel/SwiftSDKs/SwiftSDKBundleStore.swift | 2 +- Sources/SwiftSDKCommand/README.md | 4 ++-- Sources/SwiftSDKCommand/SwiftSDKCommand.swift | 2 +- Sources/swift-package-manager/SwiftPM.swift | 2 +- .../{swift-experimental-sdk => swift-sdk}/CMakeLists.txt | 8 ++++---- .../Entrypoint.swift | 0 Utilities/bootstrap | 2 +- 10 files changed, 17 insertions(+), 14 deletions(-) rename Sources/{swift-experimental-sdk => swift-sdk}/CMakeLists.txt (68%) rename Sources/{swift-experimental-sdk => swift-sdk}/Entrypoint.swift (100%) diff --git a/Package.swift b/Package.swift index b48a7debc47..d20e84920e0 100644 --- a/Package.swift +++ b/Package.swift @@ -529,7 +529,7 @@ let package = Package( ), .executableTarget( /** Interacts with Swift SDKs used for cross-compilation */ - name: "swift-experimental-sdk", + name: "swift-sdk", dependencies: ["Commands", "SwiftSDKCommand"], exclude: ["CMakeLists.txt"] ), diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 1f4226f88e6..d32210375e8 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -32,7 +32,7 @@ add_subdirectory(SPMLLBuild) add_subdirectory(SPMSQLite3) add_subdirectory(swift-bootstrap) add_subdirectory(swift-build) -add_subdirectory(swift-experimental-sdk) +add_subdirectory(swift-sdk) add_subdirectory(swift-package) add_subdirectory(swift-run) add_subdirectory(swift-test) diff --git a/Sources/CoreCommands/Options.swift b/Sources/CoreCommands/Options.swift index bcb60853c23..68af82472cd 100644 --- a/Sources/CoreCommands/Options.swift +++ b/Sources/CoreCommands/Options.swift @@ -112,7 +112,7 @@ package struct LocationOptions: ParsableArguments { package var customCompileDestination: AbsolutePath? /// Path to the directory containing installed Swift SDKs. - @Option(name: .customLong("experimental-swift-sdks-path"), help: .hidden, completion: .directory) + @Option(name: .customLong("swift-sdks-path"), completion: .directory) package var swiftSDKsDirectory: AbsolutePath? @Option( @@ -407,7 +407,10 @@ package struct BuildOptions: ParsableArguments { package var architectures: [String] = [] /// Filter for selecting a specific Swift SDK to build with. - @Option(name: .customLong("experimental-swift-sdk"), help: .hidden) + @Option( + name: .customLong("swift-sdk"), + help: "Filter for selecting a specific Swift SDK to build with" + ) package var swiftSDKSelector: String? /// Which compile-time sanitizers should be enabled. diff --git a/Sources/PackageModel/SwiftSDKs/SwiftSDKBundleStore.swift b/Sources/PackageModel/SwiftSDKs/SwiftSDKBundleStore.swift index f5e40bb2083..13d3b55b966 100644 --- a/Sources/PackageModel/SwiftSDKs/SwiftSDKBundleStore.swift +++ b/Sources/PackageModel/SwiftSDKs/SwiftSDKBundleStore.swift @@ -46,7 +46,7 @@ public final class SwiftSDKBundleStore { case let .noMatchingSwiftSDK(selector, hostTriple): return """ No Swift SDK found matching query `\(selector)` and host triple \ - `\(hostTriple.tripleString)`. Use `swift experimental-sdk list` command to see \ + `\(hostTriple.tripleString)`. Use `swift sdk list` command to see \ available Swift SDKs. """ } diff --git a/Sources/SwiftSDKCommand/README.md b/Sources/SwiftSDKCommand/README.md index 15fb0924c16..94180372b7a 100644 --- a/Sources/SwiftSDKCommand/README.md +++ b/Sources/SwiftSDKCommand/README.md @@ -1,4 +1,4 @@ -# Swift SDKs Tool +# Swift SDKs Command -This module implements `swift experimental-sdk` command and its subcommands, which allow managing artifact +This module implements `swift sdk` command and its subcommands, which allow managing artifact bundles used as Swift SDKs, as specified in [SE-0387](https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md). diff --git a/Sources/SwiftSDKCommand/SwiftSDKCommand.swift b/Sources/SwiftSDKCommand/SwiftSDKCommand.swift index dc0cf4fe933..e39740d4796 100644 --- a/Sources/SwiftSDKCommand/SwiftSDKCommand.swift +++ b/Sources/SwiftSDKCommand/SwiftSDKCommand.swift @@ -15,7 +15,7 @@ import Basics package struct SwiftSDKCommand: AsyncParsableCommand { package static let configuration = CommandConfiguration( - commandName: "experimental-sdk", + commandName: "sdk", _superCommandName: "swift", abstract: "Perform operations on Swift SDKs.", version: SwiftVersion.current.completeDisplayString, diff --git a/Sources/swift-package-manager/SwiftPM.swift b/Sources/swift-package-manager/SwiftPM.swift index 84ea0f28baa..9dd43be5f0b 100644 --- a/Sources/swift-package-manager/SwiftPM.swift +++ b/Sources/swift-package-manager/SwiftPM.swift @@ -41,7 +41,7 @@ struct SwiftPM { await SwiftPackageCommand.main() case "swift-build": await SwiftBuildCommand.main() - case "swift-experimental-sdk": + case "swift-sdk": await SwiftSDKCommand.main() case "swift-test": await SwiftTestCommand.main() diff --git a/Sources/swift-experimental-sdk/CMakeLists.txt b/Sources/swift-sdk/CMakeLists.txt similarity index 68% rename from Sources/swift-experimental-sdk/CMakeLists.txt rename to Sources/swift-sdk/CMakeLists.txt index edad12be83b..ee3be128bae 100644 --- a/Sources/swift-experimental-sdk/CMakeLists.txt +++ b/Sources/swift-sdk/CMakeLists.txt @@ -6,13 +6,13 @@ # See http://swift.org/LICENSE.txt for license information # See http://swift.org/CONTRIBUTORS.txt for Swift project authors -add_executable(swift-experimental-sdk +add_executable(swift-sdk Entrypoint.swift) -target_link_libraries(swift-experimental-sdk PRIVATE +target_link_libraries(swift-sdk PRIVATE SwiftSDKCommand) -target_compile_options(swift-experimental-sdk PRIVATE +target_compile_options(swift-sdk PRIVATE -parse-as-library) -install(TARGETS swift-experimental-sdk +install(TARGETS swift-sdk RUNTIME DESTINATION bin) diff --git a/Sources/swift-experimental-sdk/Entrypoint.swift b/Sources/swift-sdk/Entrypoint.swift similarity index 100% rename from Sources/swift-experimental-sdk/Entrypoint.swift rename to Sources/swift-sdk/Entrypoint.swift diff --git a/Utilities/bootstrap b/Utilities/bootstrap index 8af6ec7e6d0..8abe53b8c86 100755 --- a/Utilities/bootstrap +++ b/Utilities/bootstrap @@ -435,7 +435,7 @@ def install_swiftpm(prefix, args): # Install the swift-package-manager tool and create symlinks to it. cli_tool_dest = os.path.join(prefix, "bin") install_binary(args, "swift-package-manager", os.path.join(cli_tool_dest, "swift-package"), destination_is_directory=False) - for tool in ["swift-build", "swift-test", "swift-run", "swift-package-collection", "swift-package-registry", "swift-experimental-sdk"]: + for tool in ["swift-build", "swift-test", "swift-run", "swift-package-collection", "swift-package-registry", "swift-sdk"]: src = "swift-package" dest = os.path.join(cli_tool_dest, tool) note("Creating tool symlink from %s to %s" % (src, dest)) From 0eabefb3f65d8fb483d7e8f798f1370cd8439d55 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Fri, 26 Apr 2024 19:07:47 +0100 Subject: [PATCH 2/3] Add missing `--swift-sdks-path` help --- Sources/CoreCommands/Options.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/CoreCommands/Options.swift b/Sources/CoreCommands/Options.swift index 68af82472cd..7d3f920127e 100644 --- a/Sources/CoreCommands/Options.swift +++ b/Sources/CoreCommands/Options.swift @@ -112,7 +112,10 @@ package struct LocationOptions: ParsableArguments { package var customCompileDestination: AbsolutePath? /// Path to the directory containing installed Swift SDKs. - @Option(name: .customLong("swift-sdks-path"), completion: .directory) + @Option( + name: .customLong("swift-sdks-path"), + help: "Path to the directory containing installed Swift SDKs" + ) package var swiftSDKsDirectory: AbsolutePath? @Option( From 88de689d481f7724157f4980985c5d0488961915 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Fri, 26 Apr 2024 19:09:21 +0100 Subject: [PATCH 3/3] Add missing `completion: .directory` for `--swift-sdks-path` --- Sources/CoreCommands/Options.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/CoreCommands/Options.swift b/Sources/CoreCommands/Options.swift index 7d3f920127e..8a2a38b3ee8 100644 --- a/Sources/CoreCommands/Options.swift +++ b/Sources/CoreCommands/Options.swift @@ -114,7 +114,8 @@ package struct LocationOptions: ParsableArguments { /// Path to the directory containing installed Swift SDKs. @Option( name: .customLong("swift-sdks-path"), - help: "Path to the directory containing installed Swift SDKs" + help: "Path to the directory containing installed Swift SDKs", + completion: .directory ) package var swiftSDKsDirectory: AbsolutePath?