kotlin-graphics / imgui

Bloat-free Immediate Mode Graphical User interface for JVM with minimal dependencies (rewrite of dear imgui)
MIT License
594 stars 37 forks source link

Confused about dependencies glm and uno-core #143

Closed exuvo closed 3 years ago

exuvo commented 3 years ago

I am trying to port my project over to IntelliJ and modern gradle 6.4.1 but i cant seem to get the dependency resolution correct. I have been using:

["gl", "glfw", "core"].each {
  implementation ("com.github.kotlin-graphics.imgui:imgui-$it:-SNAPSHOT") {
    exclude group: 'org.lwjgl' // manually versioned elsewhere and i have also tried without the excludes
    exclude group: 'org.jetbrains.kotlin'
    exclude(group: 'com.github.kotlin-graphics.uno-sdk', module: "uno-awt")
    exclude(group: 'com.github.kotlin-graphics.uno-sdk', module: "uno-vk")
    }
}

which worked fine in eclipse and the older 4.10.3 gradle but in intellij the transitive dependencies end up as scope:runtime. But for things like setNextWindowSize i need the type glm_vec2.Vec2 which requires scope compile.

I can manually fix it by changing scope to compile in the UI but that only lasts until the next grade refresh or by replacing -SNAPSHOT with v1.76 and explicitly compiling against glm and uno-core

compileOnly "com.github.kotlin-graphics:glm:1b4ac18dd1a3c23440d3f33596688aac60bc0141"
compileOnly "com.github.kotlin-graphics.uno-sdk:uno-core:402f5f495429b7f2178a1d200c32bb5ed2f7e6fa"

but that must be the wrong way to use it.

From reading the gradle documentation i am led to believe that implementation in imgui-core should be api for glm and uno-core, but then i wonder how it has worked for everyone else so far without that?

What am i missing in either gradle or intellij to make this work sensibly?

elect86 commented 3 years ago

From reading the gradle documentation i am led to believe that implementation in imgui-core should be api for glm and uno-core

Yep, I think so

The initial reason to use implementation was to avoid polluting the import space with entries which may not be relevant for the dev, however it turned out that they should be indeed api nonetheless

I'll change that whenever I'll get to work again on it, or you can quickly do it and try

exuvo commented 3 years ago

Finally got the gradle includeBuild to work with imgui. Took me a while to figure out that the maven export is kotlin-graphics.imgui but in gradle it is kotlin_graphics. Had to use a dependencySubstitution for gradle to find it.

It works with api as mentioned above.

Now i have to figure out why IntelliJ thinks some of the imports in imgui are wrong due to "Symbol is declared in module 'com.github.kotlin_graphics.glm' which current module does not depend on" even though the import right above is for the same package and it thinks it is fine. Is not related to the api thing, i get it for random imports all throughout the code but it builds fine in gradle and runs fine in my game.

Also tried building with kotlin 1.4.0 to avoid having multiple kotlin compiler processes (as i am on 1.4.0) but seems like i also need to compile glm and the rest with 1.4 then as it was not finding auto named methods.

elect86 commented 3 years ago

It'd be useful if you could add something written in the wiki or the readme about your gained knowledge

I really would like to solve this kind of problems once and for all

I'll be update to 1.4.0 asap

exuvo commented 3 years ago

I added a section Gradle composite builds to https://github.com/kotlin-graphics/imgui/wiki/Install .

elect86 commented 3 years ago

this should be addressed