diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d59e11e..592cd78b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: macos-13 steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer - name: Build and Test Framework @@ -28,7 +28,7 @@ jobs: runs-on: macos-13 steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer - name: Build Package Integration @@ -39,17 +39,30 @@ jobs: runs-on: macos-13 steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer - name: Build Project Integration run: pushd Examples/ExampleProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleProjectIntegration; popd + linux: + name: "Build and Test on Linux" + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Setup Swift Environment + uses: swift-actions/setup-swift@v1 + with: + swift-version: 5.9 + - name: Build and Test Framework + run: swift test -c release -Xswiftc -enable-testing + readme-validation: name: Check Markdown links runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Validate Markdown uses: gaurav-nelson/github-action-markdown-link-check@v1 diff --git a/Package.swift b/Package.swift index 51eee3d5..9ccc50d3 100644 --- a/Package.swift +++ b/Package.swift @@ -79,17 +79,13 @@ let package = Package( .product(name: "ArgumentParser", package: "swift-argument-parser"), .product(name: "SwiftSyntax", package: "swift-syntax"), .product(name: "SwiftParser", package: "swift-syntax"), + .byNameItem(name: "ZippyJSON", condition: .when(platforms: [.iOS, .tvOS, .macOS])), "SafeDICore", - "ZippyJSON", ] ), .testTarget( name: "SafeDIToolTests", - dependencies: [ - .product(name: "ArgumentParser", package: "swift-argument-parser"), - "SafeDITool", - "ZippyJSON", - ] + dependencies: ["SafeDITool"] ), // Core diff --git a/Sources/SafeDITool/SafeDITool.swift b/Sources/SafeDITool/SafeDITool.swift index 5a33e846..f2077787 100644 --- a/Sources/SafeDITool/SafeDITool.swift +++ b/Sources/SafeDITool/SafeDITool.swift @@ -22,7 +22,9 @@ import ArgumentParser import Foundation import SafeDICore import SwiftParser +#if canImport(ZippyJSON) import ZippyJSON +#endif @main struct SafeDITool: AsyncParsableCommand { @@ -173,7 +175,11 @@ struct SafeDITool: AsyncParsableCommand { of: ModuleInfo.self, returning: [ModuleInfo].self ) { taskGroup in +#if canImport(ZippyJSON) let decoder = ZippyJSONDecoder() +#else + let decoder = JSONDecoder() +#endif for moduleInfoURL in moduleInfoURLs { taskGroup.addTask { try decoder.decode(