Swift Package plugin: MintKit compilation errors
blake-matson-irl opened this issue · comments
Blake Matson commented
I'm writing a Swift Package plugin that depends on MintKit, but my project fails to build due to compilation errors from Mint.swift
.
Xcode: Version 13.4.1 (13F100)
Swift tools: 5.6
Package.swift
// swift-tools-version: 5.6
import PackageDescription
let package = Package(
name: "MyAppPackage",
platforms: [
.iOS(.v13),
],
products: [
.library(name: "MyAppPackage", targets: ["MyAppPackage"]),
.plugin(name: "MyPlugin", targets: ["MyPlugin"])
],
dependencies: [
.package(url: "https://github.com/yonaskolb/Mint.git", from: "0.17.1"),
// other dependencies omitted
],
targets: [
.target(
name: "MyAppPackage",
dependencies: [
// omitted
],
plugins: [.plugin(name: "MyPlugin")]
),
.plugin(
name: "MyPlugin",
capability: .buildTool(),
dependencies: [.product(name: "MintKit", package: "Mint")]
),
])
Error logs:
CompileSwift normal arm64 $DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift (in target 'MintKit' from project 'Mint')
cd $DERIVED_DATA/SourcePackages/checkouts/Mint
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c $DERIVED_DATA/Index/DataStore -index-system-modules
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:163:37: error: generic parameter 'Success' could not be inferred
let tagOutput = try Task.capture(bash: "git ls-remote --tags --refs \(package.gitPath)")
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:163:37: error: generic parameter 'Failure' could not be inferred
let tagOutput = try Task.capture(bash: "git ls-remote --tags --refs \(package.gitPath)")
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:163:37: note: explicitly specify the generic arguments to fix this issue
let tagOutput = try Task.capture(bash: "git ls-remote --tags --refs \(package.gitPath)")
^
<<#Success: Sendable#>, <#Failure: Error#>>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:163:42: error: type 'Task<Success, Failure>' has no member 'capture'
let tagOutput = try Task.capture(bash: "git ls-remote --tags --refs \(package.gitPath)")
~~~~ ^~~~~~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:171:67: error: type of expression is ambiguous without more context
if let latestVersion = versions.keys.sorted().last, let tag = versions[latestVersion] {
~~~~~~~~~~~~~~~~~~~~~~~^~~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:171:91: error: type of expression is ambiguous without more context
if let latestVersion = versions.keys.sorted().last, let tag = versions[latestVersion] {
~~~~~~~~^~~~~~~~~~~~~~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:216:17: error: generic parameter 'Success' could not be inferred
try Task.execvp(packagePath.executablePath.string, arguments: arguments, env: env)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:216:17: error: generic parameter 'Failure' could not be inferred
try Task.execvp(packagePath.executablePath.string, arguments: arguments, env: env)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:216:17: note: explicitly specify the generic arguments to fix this issue
try Task.execvp(packagePath.executablePath.string, arguments: arguments, env: env)
^
<<#Success: Sendable#>, <#Failure: Error#>>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:216:22: error: type 'Task<Success, Failure>' has no member 'execvp'
try Task.execvp(packagePath.executablePath.string, arguments: arguments, env: env)
~~~~ ^~~~~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:218:27: error: no exact matches in call to initializer
let runTask = Task(executable: packagePath.executablePath.string, arguments: arguments)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:218:27: note: found candidate with type '(Optional<TaskPriority>, __owned @escaping @Sendable () async -> _) -> Task<_, Never>'
let runTask = Task(executable: packagePath.executablePath.string, arguments: arguments)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:218:27: note: found candidate with type '(Optional<TaskPriority>, __owned @escaping @Sendable () async throws -> _) -> Task<_, Error>'
let runTask = Task(executable: packagePath.executablePath.string, arguments: arguments)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:218:27: error: generic parameter 'Success' could not be inferred
let runTask = Task(executable: packagePath.executablePath.string, arguments: arguments)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:218:27: note: explicitly specify the generic arguments to fix this issue
let runTask = Task(executable: packagePath.executablePath.string, arguments: arguments)
^
<<#Success: Sendable#>, Never>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:363:17: error: generic parameter 'Success' could not be inferred
try Task.run("cp", executablePath.string, destinationPackagePath.executablePath.string)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:363:17: error: generic parameter 'Failure' could not be inferred
try Task.run("cp", executablePath.string, destinationPackagePath.executablePath.string)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:363:17: note: explicitly specify the generic arguments to fix this issue
try Task.run("cp", executablePath.string, destinationPackagePath.executablePath.string)
^
<<#Success: Sendable#>, <#Failure: Error#>>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:363:22: error: type 'Task<Success, Failure>' has no member 'run'
try Task.run("cp", executablePath.string, destinationPackagePath.executablePath.string)
~~~~ ^~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:378:25: error: generic parameter 'Success' could not be inferred
try Task.run(bash: "cp -R \"\(resourcePath)\" \"\(dest)\"")
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:378:25: error: generic parameter 'Failure' could not be inferred
try Task.run(bash: "cp -R \"\(resourcePath)\" \"\(dest)\"")
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:378:25: note: explicitly specify the generic arguments to fix this issue
try Task.run(bash: "cp -R \"\(resourcePath)\" \"\(dest)\"")
^
<<#Success: Sendable#>, <#Failure: Error#>>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:378:30: error: type 'Task<Success, Failure>' has no member 'run'
try Task.run(bash: "cp -R \"\(resourcePath)\" \"\(dest)\"")
~~~~ ^~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:414:21: error: generic parameter 'Success' could not be inferred
try Task.run(bash: command, directory: directory.string)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:414:21: error: generic parameter 'Failure' could not be inferred
try Task.run(bash: command, directory: directory.string)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:414:21: note: explicitly specify the generic arguments to fix this issue
try Task.run(bash: command, directory: directory.string)
^
<<#Success: Sendable#>, <#Failure: Error#>>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:414:26: error: type 'Task<Success, Failure>' has no member 'run'
try Task.run(bash: command, directory: directory.string)
~~~~ ^~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:416:25: error: generic parameter 'Success' could not be inferred
_ = try Task.capture(bash: command, directory: directory.string)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:416:25: error: generic parameter 'Failure' could not be inferred
_ = try Task.capture(bash: command, directory: directory.string)
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:416:25: note: explicitly specify the generic arguments to fix this issue
_ = try Task.capture(bash: command, directory: directory.string)
^
<<#Success: Sendable#>, <#Failure: Error#>>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:416:30: error: type 'Task<Success, Failure>' has no member 'capture'
_ = try Task.capture(bash: command, directory: directory.string)
~~~~ ^~~~~~~
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:459:17: error: generic parameter 'Success' could not be inferred
try Task.run(bash: "ln -s \"\(packagePath.executablePath.string)\" \"\(installPath.string)\"")
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:459:17: error: generic parameter 'Failure' could not be inferred
try Task.run(bash: "ln -s \"\(packagePath.executablePath.string)\" \"\(installPath.string)\"")
^
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:459:17: note: explicitly specify the generic arguments to fix this issue
try Task.run(bash: "ln -s \"\(packagePath.executablePath.string)\" \"\(installPath.string)\"")
^
<<#Success: Sendable#>, <#Failure: Error#>>
$DERIVED_DATA/SourcePackages/checkouts/Mint/Sources/MintKit/Mint.swift:459:22: error: type 'Task<Success, Failure>' has no member 'run'
try Task.run(bash: "ln -s \"\(packagePath.executablePath.string)\" \"\(installPath.string)\"")
~~~~ ^~~
Yonas Kolb commented
It looks like SwiftCLI is a newer version in your package, as Package.resolved isn't used. If you add this it should fix the issue:
.package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.3"),
Yonas Kolb commented
Although there isn't a newer version...