Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Package plugin: MintKit compilation errors #246

Open
blake-matson-irl opened this issue Aug 19, 2022 · 2 comments
Open

Swift Package plugin: MintKit compilation errors #246

blake-matson-irl opened this issue Aug 19, 2022 · 2 comments

Comments

@blake-matson-irl
Copy link

blake-matson-irl commented Aug 19, 2022

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)\"")
                ~~~~ ^~~
@yonaskolb
Copy link
Owner

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"),

@yonaskolb
Copy link
Owner

Although there isn't a newer version...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants