Modern Apps git

← xtool.git

ci: enable warnings as errors (#248)

Commit
189654c23522c2f293f3b539ffdbaf32a0c6f929
Author
Kabir Oberai <[email protected]>
When
2026-09-09 05:49 UTC (2 months ago)
Parents
8c77ca7

Diff

.github/workflows/build.yml
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 2c6bfb7..5b2c158 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -6,6 +6,8 @@ on: concurrency:   group: ${{ github.workflow }}-${{ github.ref }}   cancel-in-progress: true+env:+  XTL_CI: "1" jobs:   build-linux:     strategy:@@ -22,7 +24,7 @@ jobs:         uses: actions/checkout@v6       - name: Build and test         run: |-          docker compose run --build xtool bash -c \+          docker compose run --build -e XTL_CI=1 xtool bash -c \             "swift build --product xtool && .build/debug/xtool --help && swift test"   build-macos:     runs-on: macos-26
.github/workflows/release.yml
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 0b11ced..a94fc30 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -3,6 +3,9 @@ on:     tags:       - "*" +env:+  XTL_CI: "1"+ jobs:   build-linux:     strategy:@@ -23,6 +26,7 @@ jobs:         run: |           docker compose run --build \             -e XTOOL_VERSION=${{ github.ref_name }} \+            -e XTL_CI=1 \             --rm xtool Linux/build.sh       - name: Upload artifact         uses: actions/upload-artifact@v7@@ -88,6 +92,8 @@ jobs:       id-token: write # for signing attestations and cache entries with GitHub OIDC       packages: write # to push built images to GitHub Container Registry     with:+      build-args: |+        XTL_CI=1       output: image       push: true       platforms: linux/amd64,linux/arm64
Dockerfile
diff --git a/Dockerfile b/Dockerfileindex 6e9c71d..d498da1 100644--- a/Dockerfile+++ b/Dockerfile@@ -100,6 +100,8 @@ CMD [ "/bin/bash" ]  FROM build-xtool-base AS build-xtool +ARG XTL_CI+ ADD Package.swift Package.resolved /xtool/ RUN swift package resolve 
Package.swift
diff --git a/Package.swift b/Package.swiftindex 193a14a..dab231d 100644--- a/Package.swift+++ b/Package.swift@@ -1,4 +1,4 @@-// swift-tools-version:6.0+// swift-tools-version:6.2  import PackageDescription @@ -19,6 +19,14 @@ let cSettings: [CSetting] = [     .define("_GNU_SOURCE", .when(platforms: [.linux])), ] +let swiftSettings: [SwiftSetting] = {+    var settings: [SwiftSetting] = []+    if Context.environment["XTL_CI"] == "1" {+        settings.append(.treatAllWarnings(as: .error))+    }+    return settings+}()+ let package = Package(     name: "xtool",     platforms: [@@ -90,7 +98,8 @@ let package = Package(             dependencies: [                 .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),             ],-            exclude: ["openapi-generator-config.yaml", "patch.js"]+            exclude: ["openapi-generator-config.yaml", "patch.js"],+            swiftSettings: swiftSettings,         ),         // common utilities shared across xtool targets         .target(@@ -102,7 +111,8 @@ let package = Package(                     package: "swift-subprocess",                     condition: .when(platforms: [.linux, .macOS])                 ),-            ]+            ],+            swiftSettings: swiftSettings,         ),         .target(             name: "XKit",@@ -141,14 +151,16 @@ let package = Package(                     condition: .when(platforms: [.linux])                 ),             ],-            cSettings: cSettings+            cSettings: cSettings,+            swiftSettings: swiftSettings,         ),         .testTarget(             name: "XToolTests",             dependencies: [                 "XKit",                 "XToolSupport",-            ]+            ],+            swiftSettings: swiftSettings,         ),         .target(             name: "XToolSupport",@@ -162,7 +174,8 @@ let package = Package(                 .product(name: "Version", package: "Version"),                 .product(name: "libunxip", package: "unxip"),             ],-            cSettings: cSettings+            cSettings: cSettings,+            swiftSettings: swiftSettings,         ),         .target(             name: "PackLib",@@ -170,7 +183,8 @@ let package = Package(                 "XUtils",                 .product(name: "Yams", package: "Yams"),                 .product(name: "XcodeGenKit", package: "XcodeGen", condition: .when(platforms: [.macOS])),-            ]+            ],+            swiftSettings: swiftSettings,         ),         .executableTarget(             name: "xtool",@@ -179,7 +193,8 @@ let package = Package(                 "XKit",                 "XToolSupport",             ],-            cSettings: cSettings+            cSettings: cSettings,+            swiftSettings: swiftSettings,         ),     ] )
Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift
diff --git a/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift b/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swiftindex a8c0dc2..8df98cd 100644--- a/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift+++ b/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift@@ -8,6 +8,8 @@  #if false +// For reference: https://github.com/xtool-org/xtool/issues/196+ import Foundation  /// Creates a socket connected to `ip` on `port`.
Sources/XToolSupport/DSCommands/DSTeamsCommand.swift
diff --git a/Sources/XToolSupport/DSCommands/DSTeamsCommand.swift b/Sources/XToolSupport/DSCommands/DSTeamsCommand.swiftindex 4d2ae15..704d471 100644--- a/Sources/XToolSupport/DSCommands/DSTeamsCommand.swift+++ b/Sources/XToolSupport/DSCommands/DSTeamsCommand.swift@@ -22,7 +22,7 @@ struct DSTeamsListCommand: AsyncParsableCommand {     func run() async throws {         let token = try AuthToken.saved() -        guard case let .xcode(authData) = try token.authData() else {+        guard case let .xcode(authData) = token.authData() else {             throw Console.Error("This command requires password-based authentication")         }         let client = DeveloperServicesClient(authData: authData)
Sources/xtool/XTool.swift
diff --git a/Sources/xtool/XTool.swift b/Sources/xtool/XTool.swiftindex 2968919..6557740 100644--- a/Sources/xtool/XTool.swift+++ b/Sources/xtool/XTool.swift@@ -8,7 +8,7 @@ import Dependencies enum XToolMain {     static func main() async throws {         prepareDependencies { _ in-            #warning("Improve persistence mechanism")+            // TODO: Improve persistence mechanism             // for Windows, we could use dpapi.h or wincred.h.             // for Linux, maybe use libsecret?             // see https://github.com/atom/node-keytar