Skip to content

Commit e37a6cd

Browse files
committed
Adopt the static linux sdk
1 parent f5d1bab commit e37a6cd

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

Package.resolved

Lines changed: 1 addition & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
1818
.package(url: "https://github.com/swift-server/async-http-client", from: "1.21.2"),
1919
.package(url: "https://github.com/apple/swift-nio.git", from: "2.64.0"),
20-
.package(url: "https://github.com/apple/swift-tools-support-core.git", from: "0.7.1"),
20+
//.package(url: "https://github.com/apple/swift-tools-support-core.git", from: "0.7.1"),
2121
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
2222
// This dependency provides the correct version of the formatter so that you can run `swift run swiftformat Package.swift Plugins/ Sources/ Tests/`
2323
.package(url: "https://github.com/nicklockwood/SwiftFormat", exact: "0.49.18"),
@@ -30,7 +30,7 @@ let package = Package(
3030
.target(name: "SwiftlyCore"),
3131
.target(name: "LinuxPlatform", condition: .when(platforms: [.linux])),
3232
.target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])),
33-
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
33+
//.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
3434
]
3535
),
3636
.target(

Sources/Swiftly/Install.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import _StringProcessing
22
import ArgumentParser
33
import Foundation
4-
import TSCBasic
5-
import TSCUtility
4+
//import TSCBasic
5+
//import TSCUtility
66

77
import SwiftlyCore
88

@@ -192,10 +192,10 @@ struct Install: SwiftlyCommand {
192192
throw Error(message: "Invalid toolchain URL: \(url)")
193193
}
194194

195-
let animation = PercentProgressAnimation(
195+
/*let animation = PercentProgressAnimation(
196196
stream: stdoutStream,
197197
header: "Downloading \(version)"
198-
)
198+
)*/
199199

200200
var lastUpdate = Date()
201201

@@ -215,20 +215,20 @@ struct Install: SwiftlyCommand {
215215

216216
lastUpdate = Date()
217217

218-
animation.update(
218+
/*animation.update(
219219
step: progress.receivedBytes,
220220
total: progress.totalBytes!,
221221
text: "Downloaded \(String(format: "%.1f", downloadedMiB)) MiB of \(String(format: "%.1f", totalMiB)) MiB"
222-
)
222+
)*/
223223
}
224224
)
225225
} catch let notFound as SwiftlyHTTPClient.DownloadNotFoundError {
226226
throw Error(message: "\(version) does not exist at URL \(notFound.url), exiting")
227227
} catch {
228-
animation.complete(success: false)
228+
//animation.complete(success: false)
229229
throw error
230230
}
231-
animation.complete(success: true)
231+
//animation.complete(success: true)
232232

233233
if verifySignature {
234234
try await Swiftly.currentPlatform.verifySignature(

Sources/Swiftly/SelfUpdate.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ArgumentParser
22
import Foundation
3-
import TSCBasic
4-
import TSCUtility
3+
//import TSCBasic
4+
//import TSCUtility
55

66
import SwiftlyCore
77

@@ -70,10 +70,10 @@ internal struct SelfUpdate: SwiftlyCommand {
7070
try? FileManager.default.removeItem(at: tmpFile)
7171
}
7272

73-
let animation = PercentProgressAnimation(
73+
/*let animation = PercentProgressAnimation(
7474
stream: stdoutStream,
7575
header: "Downloading swiftly \(version)"
76-
)
76+
)*/
7777
do {
7878
try await SwiftlyCore.httpClient.downloadFile(
7979
url: downloadURL,
@@ -82,18 +82,18 @@ internal struct SelfUpdate: SwiftlyCommand {
8282
let downloadedMiB = Double(progress.receivedBytes) / (1024.0 * 1024.0)
8383
let totalMiB = Double(progress.totalBytes!) / (1024.0 * 1024.0)
8484

85-
animation.update(
85+
/*animation.update(
8686
step: progress.receivedBytes,
8787
total: progress.totalBytes!,
8888
text: "Downloaded \(String(format: "%.1f", downloadedMiB)) MiB of \(String(format: "%.1f", totalMiB)) MiB"
89-
)
89+
)*/
9090
}
9191
)
9292
} catch {
93-
animation.complete(success: false)
93+
//animation.complete(success: false)
9494
throw error
9595
}
96-
animation.complete(success: true)
96+
//animation.complete(success: true)
9797

9898
try await Swiftly.currentPlatform.verifySignature(httpClient: SwiftlyCore.httpClient, archiveDownloadURL: downloadURL, archive: tmpFile, verbose: verbose)
9999
try Swiftly.currentPlatform.extractSwiftlyAndInstall(from: tmpFile)

Tools/build-swiftly-release/BuildSwiftlyRelease.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,17 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
371371

372372
FileManager.default.changeCurrentDirectoryPath(cwd)
373373

374-
// Statically link standard libraries for maximum portability of the swiftly binary
375-
try runProgram(swift, "build", "--product=swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib", "--configuration=release")
374+
// Statically link standard libraries and use the static sdk for maximum portability
375+
#if arch(arm64)
376+
let sdkName = "aarch64-swift-linux-musl"
377+
#else
378+
let sdkName = "x86_64-swift-linux-musl"
379+
#endif
380+
381+
// FIXME: Adjust the URL and checksum to match the toolchain that is being used
382+
try runProgram(swift, "sdk", "install" "https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz", "--checksum", "67f765e0030e661a7450f7e4877cfe008db4f57f177d5a08a6e26fd661cdd0bd")
383+
384+
try runProgram(swift, "build", "--swift-sdk", sdkName, "--product=swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib", "--configuration=release")
376385

377386
let releaseDir = cwd + "/.build/release"
378387

0 commit comments

Comments
 (0)