Skip to content

Commit

Permalink
Add Swift 5.10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Mar 12, 2024
1 parent d88252d commit f4ef68d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 15 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/swift-test.yml
Expand Up @@ -12,7 +12,7 @@ permissions:
jobs:
variables:
outputs:
max-supported-swift-version: '5.9'
max-supported-swift-version: '5.10'
xcode-scheme: licensed-components-Package
xcode-platform-version: latest
fail-if-codecov-fails: true
Expand All @@ -27,7 +27,7 @@ jobs:
os:
- macOS
# - ubuntu
swift-version-offset: [ 0 ]
swift-version-offset: [ 0, 1 ]
uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-spm.yml@main
with:
os: ${{ matrix.os }}
Expand All @@ -47,7 +47,8 @@ jobs:
- iPadOS
- tvOS
- watchOS
swift-version-offset: [ 0 ]
- visionOS
swift-version-offset: [ 0, 1 ]
uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-xcode.yml@main
with:
xcode-scheme: ${{ needs.variables.outputs.xcode-scheme }}
Expand Down
7 changes: 5 additions & 2 deletions Package.swift
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -8,9 +8,12 @@ let swiftSettings: Array<SwiftSetting> = [
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("BareSlashRegexLiterals"),
.enableUpcomingFeature("DisableOutwardActorInference"),
.enableUpcomingFeature("IsolatedDefaultValues"),
.enableUpcomingFeature("DeprecateApplicationMain"),
.enableExperimentalFeature("StrictConcurrency"),
.enableExperimentalFeature("GlobalConcurrency"),
// .enableExperimentalFeature("AccessLevelOnImport"),
// .enableExperimentalFeature("VariadicGenerics"),
// .unsafeFlags(["-warn-concurrency"], .when(configuration: .debug)),
]

let package = Package(
Expand Down
54 changes: 54 additions & 0 deletions Package@swift-5.9.swift
@@ -0,0 +1,54 @@
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let swiftSettings: Array<SwiftSetting> = [
.enableUpcomingFeature("ConciseMagicFile"),
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("BareSlashRegexLiterals"),
.enableUpcomingFeature("DisableOutwardActorInference"),
.enableExperimentalFeature("StrictConcurrency"),
// .enableExperimentalFeature("AccessLevelOnImport"),
// .enableExperimentalFeature("VariadicGenerics"),
]

let package = Package(
name: "licensed-components",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "LicensedComponents",
targets: ["LicensedComponents"]),
.library(
name: "LicensedComponentsUI",
targets: ["LicensedComponentsUI"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "LicensedComponents",
resources: [
.copy("Resources/BundledLicenseTexts"),
],
swiftSettings: swiftSettings),
.target(
name: "LicensedComponentsUI",
dependencies: ["LicensedComponents"],
swiftSettings: swiftSettings),
.testTarget(
name: "LicensedComponentsTests",
dependencies: ["LicensedComponents"],
swiftSettings: swiftSettings),
]
)
20 changes: 10 additions & 10 deletions Sources/LicensedComponents/LicensedComponent.swift
Expand Up @@ -204,11 +204,11 @@ extension LicensedComponent {
/// The title of the license.
public var title: String {
switch self {
case .mit: return "MIT"
case .apache(.v2): return "Apache v2"
case .bsd(.threeClause): return "BSD 3-Clause"
case .gpl(.v3): return "GPL v3"
case .custom(let title, _): return title
case .mit: "MIT"
case .apache(.v2): "Apache v2"
case .bsd(.threeClause): "BSD 3-Clause"
case .gpl(.v3): "GPL v3"
case .custom(let title, _): title
}
}
}
Expand Down Expand Up @@ -237,11 +237,11 @@ extension LicensedComponent.LicenseTexts {
extension LicensedComponent.License {
var _baseTexts: LicensedComponent.LicenseTexts {
switch self {
case .mit: return .bundled(inDirectory: "MIT", hasFull: false)
case .apache(.v2): return .bundled(inDirectory: "Apache/v2")
case .bsd(.threeClause): return .bundled(inDirectory: "BSD/3Clause", hasFull: false)
case .gpl(.v3): return .bundled(inDirectory: "GPL/v3")
case .custom(_, let texts): return texts
case .mit: .bundled(inDirectory: "MIT", hasFull: false)
case .apache(.v2): .bundled(inDirectory: "Apache/v2")
case .bsd(.threeClause): .bundled(inDirectory: "BSD/3Clause", hasFull: false)
case .gpl(.v3): .bundled(inDirectory: "GPL/v3")
case .custom(_, let texts): texts
}
}
}

0 comments on commit f4ef68d

Please sign in to comment.