utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
576 stars 39 forks source link

Can't build the project if there is a test source set #519

Open Frontrider opened 10 months ago

Frontrider commented 10 months ago

The entry generation happens on the test source set as well, not just the main one. The issue is that the test source set also does not have the godot library, so if you try to make tests then you can't compile it anymore.

image image

The easy fix is to add the library to the implementation config so it transitions to the test source set as well.

dependencies {
// https://mvnrepository.com/artifact/com.utopia-rise/godot-library
    implementation("com.utopia-rise:godot-library:0.7.2-4.1.2")
}

It does not really matter that the generator processes that too, only that you can't compile it anymore.

chippmann commented 10 months ago

The main question for me here is; should we generate entry files for the tests or not. IMO the dependency should always be added which would fix this issue short term, but the above base question still remains.

What are your thoughts @CedNaru and @Frontrider ?

CedNaru commented 10 months ago

I don't see the point of an entry for tests. It's not like we are going to use it anyway. Maybe in the future, we can turn Godot into some kind of Junit runner that would just load the test entry so we can directly test Kotlin scripts. But as it is now, I don't see the point. Adding the library in the main.jar also bothers me. Even if there is no conflict, it's still a duplicate of data. Godot library should then be removed from the bootstrap.jar, or we should up the priority of switching to C++ reloading and get rid of bootstrap.jar for good.

Frontrider commented 10 months ago

No need for entry files at all. There is nothing in a test source set that needs it.

I'll have to check if this works or not. (yes I know that it is needed because of the entry generation)

dependencies {
// https://mvnrepository.com/artifact/com.utopia-rise/godot-library
    testImplementation("com.utopia-rise:godot-library:0.7.2-4.1.2")
}
Frontrider commented 9 months ago

But yes, If you make it so that the entry file is not produced unless there is anything to put in there then that is a better solution.

chippmann commented 3 months ago

As mentioned in the closed PR, this issue will automatically be solved once we switch to KSP 2.0