mrakakuy/kotlin-godot-wrapper

Could not find org.godotengine.kotlin:godot-gradle-plugin:1.0.1.

Opened this issue · 14 comments

Version:
1.0.1

OS/device including version:
Linux Mint

Issue description:
Dependency not found. Build sync fails with: Could not find org.godotengine.kotlin:godot-gradle-plugin:1.0.1.

Steps to reproduce:
Following instructions in https://github.com/MrAkakuy/kotlin-godot-wrapper/blob/master/GETTING_STARTED.md

Attempting to set up the build script, but the dependency identified by the class path https://github.com/MrAkakuy/kotlin-godot-wrapper/blob/master/GETTING_STARTED.md is not found in any of the repositories.

Minimal reproduction project:
Literally the getting started guide.

Yes we currently have an issue with the plugin release. We're working on it.
As of now, you can work around that issue by building the plugin once locally so you have the necessary dependencies in your maven local.
I'll update you on this topic.
Sorry for the inconvenience.

One other thing that currently is not correct in the getting started guide:
the generateGDNS directory is wrong. It should be:
generateGDNS("${project.rootDir.absolutePath}/../project")
It's fixed in a pull request on our fork: https://github.com/utopia-rise/kotlin-godot-wrapper/pull/15 and should be merged soon.

@mdvarga Gradle plugin is now available.
The wrong documentation remains until we submit a PR for that.
You have to add maven("https://dl.bintray.com/utopia-rise/kotlin-godot") to the repositories block.

So the build file after the getting started guide should look like this for you:

buildscript {
    repositories {
        mavenLocal()
        maven("https://dl.bintray.com/utopia-rise/kotlin-godot")
        jcenter()
    }
    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61")
        classpath("org.godotengine.kotlin:godot-gradle-plugin:1.0.1")
    }
}

plugins {
    id("org.jetbrains.kotlin.multiplatform")
}

apply(plugin = "godot-gradle-plugin")

repositories {
    mavenLocal()
    maven("https://dl.bintray.com/utopia-rise/kotlin-godot")
    jcenter()
}

rootProject.name = "projectname"

kotlin {
    sourceSets {
        sourceSets.create("macosMain")
        sourceSets.create("linuxMain")
        sourceSets.create("windowsMain")
        configure(listOf(sourceSets["macosMain"], sourceSets["linuxMain"], sourceSets["windowsMain"])) {
            this.kotlin.srcDir("src/main/kotlin")
        }


        configure<godot.gradle.plugin.ConfigureGodotConvention> {
            this.configureGodot(listOf(sourceSets["macosMain"], sourceSets["linuxMain"], sourceSets["windowsMain"])) {
                sourceSet {
                    kotlin.srcDirs("src/main/kotlin")
                }

                libraryPath("${project.rootDir.absolutePath}/project/projectname.gdnlib")
                generateGDNS("${project.rootDir.absolutePath}/../project")
                
                configs(
                        
                )
            }
        }
    }
    
    val targets = listOf(
            targetFromPreset(presets["godotMingwX64"], "windows"),
            targetFromPreset(presets["godotLinuxX64"], "linux"),
            targetFromPreset(presets["godotMacosX64"], "macos")
    )
    
    targets.forEach { target ->
        target.compilations.getByName("main") {
            if (this is org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation) {
                println("Configuring target ${target.name}")
                this.target.binaries {
                    sharedLib(listOf(org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG))
                }
                target.compilations.all {
                    dependencies {
                        implementation("org.godotengine.kotlin:godot-library:1.0.0")
                    }
                }
            } else {
                System.err.println("Not a native target! TargetName: ${target.name}")
            }
        }
    }
}

fwiw, compiling locally requires XCode 11. I am stuck on High Sierra.

Shouldn't rootProject.name = "projectname" go into settings.gradle together with the enableFeaturePreview("GRADLE_METADATA")?

Shouldn't rootProject.name = "projectname" go into settings.gradle together with the enableFeaturePreview("GRADLE_METADATA")?

IDEA actually complained about redefining the project name in build.gradle. I had to move it to settings.gradle. Not sure if gradlew would complain about it, but the IDE does.

fwiw, compiling locally requires XCode 11. I am stuck on High Sierra.

@lassem Could you please make a new issue for it? so we can track it separately as it has nothing to do with this issue.

Shouldn't rootProject.name = "projectname" go into settings.gradle together with the enableFeaturePreview("GRADLE_METADATA")?

@lassem Yes indeed you are right.
It is already fixed, but not in the linked hotfix. Now the samples are an individual gradle project by themselves and not part of the main project anymore.
I'll update the documentation with the merge of those changes.

Shouldn't rootProject.name = "projectname" go into settings.gradle together with the enableFeaturePreview("GRADLE_METADATA")?

IDEA actually complained about redefining the project name in build.gradle. I had to move it to settings.gradle. Not sure if gradlew would complain about it, but the IDE does.

@mdvarga It complains but you should be able to build just fine. Same with the gradle wrapper.

@chippmann in the example you provided, gradle is complaining about ambiguous overload use:

build.gradle.kts:38:18: Overload resolution ambiguity: 
public final fun configureGodot(sourceSets: Iterable<KotlinSourceSet>, action: GodotSourceSet.() -> Unit): Unit defined in godot.gradle.plugin.ConfigureGodotConvention
public final fun configureGodot(sourceSets: Iterable<KotlinSourceSet>, action: Action<GodotSourceSet>): Unit defined in godot.gradle.plugin.ConfigureGodotConvention

@chippmann in the example you provided, gradle is complaining about ambiguous overload use:

build.gradle.kts:38:18: Overload resolution ambiguity: 
public final fun configureGodot(sourceSets: Iterable<KotlinSourceSet>, action: GodotSourceSet.() -> Unit): Unit defined in godot.gradle.plugin.ConfigureGodotConvention
public final fun configureGodot(sourceSets: Iterable<KotlinSourceSet>, action: Action<GodotSourceSet>): Unit defined in godot.gradle.plugin.ConfigureGodotConvention

What gradle version do you use?

@chippmann I updated to Gradle 6.1.1 and it's working fine with that.

@mdvarga Good to hear.
I should probably add the needed minimum version of gradle to the documentation

@chippmann So, I'm not entirely sure what's going wrong, but I could not get the imports working for godot with the maven repo https://dl.bintray.com/utopia-rise/kotlin-godot. I decided to try building the library locally and seems like that did the trick.

As for the build.gradle, I looked through a recent PR in utopia-rise and I just had to change the configure template class to org.godotengine.kotlin.gradleplugin.ConfigureGodotConvention

@mdvarga Thanks for the input!
I will definitely look into this issue in more detail and rework our samples so we see such issues before hand. Also i make sure we test them without copies in our maven local repo ^^

As for the configure template. It's currently hard for us to keep the docs in this main project inline with what is actually in the repo and to push hotfixes as we're missing rights to properly maintain this project.
If you wan't to be up to date with everything, i suggest you mainly work with our fork: https://github.com/utopia-rise/kotlin-godot-wrapper
We're trying to get in contact with @mrakakuy regarding the maintaining issues. But it's hard to contact him, or maybe he's on vacation...