Skip to content

Commit f8fda5c

Browse files
authored
Merge pull request #11 from cybozu/xcode-16
Migrate to Xcode 16
2 parents 1cd308e + 61db9c0 commit f8fda5c

File tree

6 files changed

+42
-41
lines changed

6 files changed

+42
-41
lines changed

.github/workflows/release-artifact-bundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: macos-14
1212
timeout-minutes: 20
1313
env:
14-
DEVELOPER_DIR: "/Applications/Xcode_15.4.app/Contents/Developer"
14+
DEVELOPER_DIR: "/Applications/Xcode_16.0.app/Contents/Developer"
1515
ARTIFACT_BUNDLE: "license-checker.artifactbundle"
1616

1717
steps:

.github/workflows/test.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: macos-14
1010
timeout-minutes: 20
1111
env:
12-
DEVELOPER_DIR: "/Applications/Xcode_15.4.app/Contents/Developer"
12+
DEVELOPER_DIR: "/Applications/Xcode_16.0.app/Contents/Developer"
1313

1414
steps:
1515
- name: Checkout
@@ -25,9 +25,3 @@ jobs:
2525
-destination "platform=macOS" \
2626
-resultBundlePath TestsResult | \
2727
xcpretty -c && exit ${PIPESTATUS[0]}
28-
29-
- name: Archive unit test results
30-
if: success() || failure()
31-
uses: kishikawakatsumi/xcresulttool@v1
32-
with:
33-
path: TestsResult.xcresult

Package.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
// swift-tools-version: 5.10
1+
// swift-tools-version: 6.0
22

33
import PackageDescription
44

5+
let swiftSettings: [SwiftSetting] = [
6+
.enableUpcomingFeature("ExistentialAny"),
7+
]
8+
59
let package = Package(
610
name: "LicenseChecker",
711
platforms: [
@@ -27,11 +31,13 @@ let package = Package(
2731
dependencies: [
2832
.target(name: "LicenseCheckerModule"),
2933
.product(name: "ArgumentParser", package: "swift-argument-parser")
30-
]
34+
],
35+
swiftSettings: swiftSettings
3136
),
3237
.target(
3338
name: "TestResources",
34-
resources: [.copy("Resources/")]
39+
resources: [.copy("Resources/")],
40+
swiftSettings: swiftSettings
3541
),
3642
.testTarget(
3743
name: "LicenseCheckerModuleTests",
@@ -41,14 +47,16 @@ let package = Package(
4147
],
4248
resources: [
4349
.process("Resources")
44-
]
50+
],
51+
swiftSettings: swiftSettings
4552
),
4653
.testTarget(
4754
name: "LicenseCheckerTests",
4855
dependencies: [
4956
.target(name: "license-checker"),
5057
.target(name: "TestResources")
51-
]
58+
],
59+
swiftSettings: swiftSettings
5260
),
5361
.plugin(
5462
name: "LicenseCheckerPlugin",

Plugins/LicenseCheckerPlugin/main.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,40 @@ struct LicenseCheckerPlugin: BuildToolPlugin {
77
let description: String = "SourcePackages not found"
88
}
99

10-
func sourcePackages(_ pluginWorkDirectory: Path) throws -> Path {
11-
var tmpPath = pluginWorkDirectory
12-
guard pluginWorkDirectory.string.contains("SourcePackages") else {
10+
func sourcePackages(_ pluginWorkDirectory: URL) throws -> URL {
11+
var tmpURL = pluginWorkDirectory
12+
guard pluginWorkDirectory.absoluteURL.path().contains("SourcePackages") else {
1313
throw SourcePackagesNotFoundError()
1414
}
15-
while tmpPath.lastComponent != "SourcePackages" {
16-
tmpPath = tmpPath.removingLastComponent()
15+
while tmpURL.lastPathComponent != "SourcePackages" {
16+
tmpURL = tmpURL.deletingLastPathComponent()
1717
}
18-
return tmpPath
18+
return tmpURL
1919
}
2020

21-
func makeBuildCommand(executablePath: Path, sourcePackagesPath: Path, whiteListPath: Path, outputPath: Path) -> Command {
22-
return .buildCommand(
21+
func makeBuildCommand(executableURL: URL, sourcePackagesURL: URL, whiteListURL: URL, outputURL: URL) -> Command {
22+
.buildCommand(
2323
displayName: "Check License",
24-
executable: executablePath,
24+
executable: executableURL,
2525
arguments: [
2626
"--source-packages-path",
27-
sourcePackagesPath.string,
27+
sourcePackagesURL.absoluteURL.path(),
2828
"--white-list-path",
29-
whiteListPath.string
29+
whiteListURL.absoluteURL.path()
3030
],
3131
outputFiles: [
32-
outputPath
32+
outputURL
3333
]
3434
)
3535
}
3636

3737
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
38-
return [
38+
[
3939
makeBuildCommand(
40-
executablePath: try context.tool(named: "license-checker").path,
41-
sourcePackagesPath: try sourcePackages(context.pluginWorkDirectory),
42-
whiteListPath: context.package.directory.appending(subpath: "white-list.json"),
43-
outputPath: context.pluginWorkDirectory
40+
executableURL: try context.tool(named: "license-checker").url,
41+
sourcePackagesURL: try sourcePackages(context.pluginWorkDirectoryURL),
42+
whiteListURL: context.package.directoryURL.appending(path: "white-list.json"),
43+
outputURL: context.pluginWorkDirectoryURL
4444
)
4545
]
4646
}
@@ -53,12 +53,12 @@ import XcodeProjectPlugin
5353
/// This command works with `Run Build Tool Plug-ins` in Xcode `Build Phase`.
5454
extension LicenseCheckerPlugin: XcodeBuildToolPlugin {
5555
func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command] {
56-
return [
56+
[
5757
makeBuildCommand(
58-
executablePath: try context.tool(named: "license-checker").path,
59-
sourcePackagesPath: try sourcePackages(context.pluginWorkDirectory),
60-
whiteListPath: context.xcodeProject.directory.appending(subpath: "white-list.json"),
61-
outputPath: context.pluginWorkDirectory
58+
executableURL: try context.tool(named: "license-checker").url,
59+
sourcePackagesURL: try sourcePackages(context.pluginWorkDirectoryURL),
60+
whiteListURL: context.xcodeProject.directoryURL.appending(path: "white-list.json"),
61+
outputURL: context.pluginWorkDirectoryURL
6262
)
6363
]
6464
}

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ $
4141

4242
## Requirements
4343

44-
- Written in Swift 5.10
44+
- Written in Swift 6.0
4545
- Compatible with macOS 14.0+
46-
- Development with Xcode 15.4+
46+
- Development with Xcode 16.0+
4747

4848
## How to Use
4949

@@ -147,10 +147,9 @@ If your project directory structure is special and you want to specify the path
147147
@main
148148
struct LicenseCheckerCommand: CommandPlugin {
149149
func performCommand(context: PluginContext, arguments: [String]) async throws {
150-
let licenseCheckerPath = try context.tool(named: "license-checker").path
151-
let commandURL = URL(fileURLWithPath: licenseCheckerPath.string, isDirectory: false)
150+
let tool = try context.tool(named: "license-checker")
152151

153-
let process = try Process.run(commandURL, arguments: arguments)
152+
let process = try Process.run(tool.url, arguments: arguments)
154153
process.waitUntilExit()
155154

156155
guard process.terminationReason == .exit else {

Sources/license-checker/LicenseChecker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct LicenseChecker: ParsableCommand {
66
static let configuration = CommandConfiguration(
77
commandName: "license-checker",
88
abstract: "A tool to check license of swift package libraries.",
9-
version: "1.0.0"
9+
version: "2.0.0"
1010
)
1111

1212
@Option(

0 commit comments

Comments
 (0)