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

Port wifimon swift project to gradle #1091

Open
bric3 opened this issue Oct 4, 2021 · 1 comment
Open

Port wifimon swift project to gradle #1091

bric3 opened this issue Oct 4, 2021 · 1 comment

Comments

@bric3
Copy link

bric3 commented Oct 4, 2021

This more of an open question in regards of the steps necessary to port the build system to gradle for a really simple terminal application written in swift.

The original repository is https://github.com/attheodo/wifimon
Gradle 7.2

I created the two files build.gradle.kts

plugins {
    `swift-application`
    xctest
}

application {
    targetMachines.add(machines.macOS.x86_64)
}

extensions.configure<SwiftApplication> {
    source.from(file("Sources/wifimon"))
}

dependencies {
    implementation("ConsoleKit:ConsoleKit") {
        version {
            branch = "main"
        }
    }
}

And settings.gradle.kts

rootProject.name = "wifimon"

sourceControl {
    gitRepository(java.net.URI.create("https://github.com/vapor/console-kit.git")) {
        producesModule("ConsoleKit:ConsoleKit")

    }
}

However the build fails with the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':installDebug'.
> Could not resolve all task dependencies for configuration ':nativeRuntimeDebug'.
   > Git repository at https://github.com/vapor/console-kit.git did not contain a project publishing the specified dependency.
     Required by:
         project :

I am not quite sure how to declare a source repository, but I think I followed the documentation :

For reference the Package.swift looks like this

https://github.com/attheodo/wifimon/blob/2362dc2256574ea2d1fb22c5c5e126c23623708d/Package.swift

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription

let package = Package(
    name: "wifimon",
    platforms: [
        .macOS(.v10_15)
    ],
    dependencies: [
        .package(url: "https://github.com/vapor/console-kit", .branch("main")),
    ],
    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.
        .executableTarget(
            name: "wifimon",
            dependencies: [.product(name: "ConsoleKit", package: "console-kit")]),
        .testTarget(
            name: "wifimonTests",
            dependencies: ["wifimon"]),
    ]
)

I tried to provide a build scan, but this fails for a reason I'm not able to determine or work around.

This build uses Gradle features that are incompatible with build scans (code: late-load-build-op).
@bric3
Copy link
Author

bric3 commented Oct 6, 2021

Answered on the nokee gradle native plugins : nokeedev/gradle-native#348 (comment)
In particular this commit : lacasseio/wifimon@02cfdf5

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

1 participant