From 92b7d5813e4efe042b60b04bc20803dab4e10fc0 Mon Sep 17 00:00:00 2001 From: Vitalii Budnik Date: Fri, 27 Jun 2025 20:09:49 +0300 Subject: [PATCH 1/4] fix: ci compilation --- Package.swift | 4 ++++ Sources/BinaryDependencyManager/Models/Dependency.swift | 2 +- Sources/CommandLine/Commands/CleanCommand.swift | 2 +- Sources/CommandLine/Commands/ResolveCommand.swift | 2 +- Sources/CommandLine/main.swift | 4 ++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Package.swift b/Package.swift index 31f2def..e60d2c1 100644 --- a/Package.swift +++ b/Package.swift @@ -60,5 +60,9 @@ let package = Package( .target(name: "Utils"), ] ), + ], + + swiftLanguageVersions: [ + .version("6.1") ] ) diff --git a/Sources/BinaryDependencyManager/Models/Dependency.swift b/Sources/BinaryDependencyManager/Models/Dependency.swift index 9678d4d..fe21c39 100644 --- a/Sources/BinaryDependencyManager/Models/Dependency.swift +++ b/Sources/BinaryDependencyManager/Models/Dependency.swift @@ -48,7 +48,7 @@ extension Dependency: Encodable { // MARK: - Dependency.Asset extension Dependency { - public struct Asset: Equatable { + public struct Asset: Equatable, Sendable { /// SHA-256 checksum of the zip archive. public let checksum: String /// Regex pattern to a specific artifact, if multiple artifacts are added to the the release assets. diff --git a/Sources/CommandLine/Commands/CleanCommand.swift b/Sources/CommandLine/Commands/CleanCommand.swift index 0c79491..9ca7fbf 100644 --- a/Sources/CommandLine/Commands/CleanCommand.swift +++ b/Sources/CommandLine/Commands/CleanCommand.swift @@ -5,7 +5,7 @@ import BinaryDependencyManager struct CleanCommand: ParsableCommand { - static var configuration = CommandConfiguration(commandName: "clean") + static let configuration = CommandConfiguration(commandName: "clean") /// Path to the output directory. /// diff --git a/Sources/CommandLine/Commands/ResolveCommand.swift b/Sources/CommandLine/Commands/ResolveCommand.swift index 7d280ad..b186531 100644 --- a/Sources/CommandLine/Commands/ResolveCommand.swift +++ b/Sources/CommandLine/Commands/ResolveCommand.swift @@ -5,7 +5,7 @@ import Yams import Utils struct ResolveCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "resolve", version: BinaryDependenciesManager.configuration.version ) diff --git a/Sources/CommandLine/main.swift b/Sources/CommandLine/main.swift index 8e0c6aa..7fd4108 100644 --- a/Sources/CommandLine/main.swift +++ b/Sources/CommandLine/main.swift @@ -11,9 +11,9 @@ setbuf(stdout, nil) struct BinaryDependenciesManager: ArgumentParser.ParsableCommand { /// The version of the binary dependencies manager. - static var version: Version = "0.0.4" + static let version: Version = "0.0.4" - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( abstract: "Binary dependencies resolver", version: version.description, subcommands: [ From 9efc654e4de9f9a2bb8fe9be6054a7b6a69703f1 Mon Sep 17 00:00:00 2001 From: Vitalii Budnik Date: Fri, 27 Jun 2025 20:18:00 +0300 Subject: [PATCH 2/4] fix: xcode select for swift --- .github/workflows/test.yml | 5 ++++- Package.swift | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25742a4..ea99ba5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: - os: macos-15 build-system: swift swift-version: '6.1' + xcode-version: '16.4' - os: ubuntu-latest build-system: swift swift-version: '6.1' @@ -39,7 +40,9 @@ jobs: # swift-version: ${{ matrix.swift-version }} - name: Setup Xcode - if: matrix.build-system == 'xcodebuild' + # Select Xcode for swift and xcodebuild. + # We need 6.1 swift and setup-swift@v2 is broken. + if: matrix.xcode-version != '' run: sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode-version }}.app' - name: Cache Swift packages diff --git a/Package.swift b/Package.swift index e60d2c1..cbf80c6 100644 --- a/Package.swift +++ b/Package.swift @@ -22,7 +22,7 @@ let package = Package( ], targets: [ - + .executableTarget( name: "CommandLine", dependencies: [ @@ -31,7 +31,7 @@ let package = Package( "Utils", ] ), - + .target( name: "BinaryDependencyManager", dependencies: [ @@ -63,6 +63,6 @@ let package = Package( ], swiftLanguageVersions: [ - .version("6.1") + .version("6") ] ) From af28a2327a3d45dbeb9e665448c6a9dbcbba9e37 Mon Sep 17 00:00:00 2001 From: Vitalii Budnik Date: Fri, 27 Jun 2025 20:27:42 +0300 Subject: [PATCH 3/4] fix: linux build --- Sources/CommandLine/main.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/CommandLine/main.swift b/Sources/CommandLine/main.swift index 7fd4108..fda33db 100644 --- a/Sources/CommandLine/main.swift +++ b/Sources/CommandLine/main.swift @@ -6,6 +6,8 @@ import Utils #if os(macOS) setbuf(__stdoutp, nil) #elseif os(Linux) +@preconcurrency import Glibc // https://github.com/swiftlang/swift/issues/77866 + setbuf(stdout, nil) #endif From ed1dc479fdcd8f7877852d7189b2a142dc6a1ff1 Mon Sep 17 00:00:00 2001 From: Vitalii Budnik Date: Fri, 27 Jun 2025 20:32:44 +0300 Subject: [PATCH 4/4] fix: Glibc import must be first --- Sources/CommandLine/main.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/CommandLine/main.swift b/Sources/CommandLine/main.swift index fda33db..1c78a63 100644 --- a/Sources/CommandLine/main.swift +++ b/Sources/CommandLine/main.swift @@ -1,3 +1,9 @@ +#if os(Linux) +// Glibc import must be the first import. +// Issue: https://github.com/swiftlang/swift/issues/77866 +@preconcurrency import Glibc +#endif + import ArgumentParser import Foundation import Utils @@ -6,8 +12,6 @@ import Utils #if os(macOS) setbuf(__stdoutp, nil) #elseif os(Linux) -@preconcurrency import Glibc // https://github.com/swiftlang/swift/issues/77866 - setbuf(stdout, nil) #endif