godot-kotlin-jvm icon indicating copy to clipboard operation
godot-kotlin-jvm copied to clipboard

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

Open Frontrider opened this issue 2 years ago • 9 comments

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.

Frontrider avatar Oct 18 '23 06:10 Frontrider

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 ?

chippmann avatar Nov 01 '23 16:11 chippmann

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.

CedNaru avatar Nov 01 '23 18:11 CedNaru

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 avatar Nov 02 '23 11:11 Frontrider

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.

Frontrider avatar Nov 03 '23 05:11 Frontrider

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

chippmann avatar May 15 '24 04:05 chippmann