Hi. I wrote a gradle plugin in Kotlin which inject...
# gradle
n
Hi. I wrote a gradle plugin in Kotlin which injects a library dependency via this line : https://github.com/emign/engineEmi_GradlePlugin/blob/88ffb269e35ff35a178685121db2744d6a521f5d/src/main/kotlin/me/emig/engineEmi/gradle/EngineEmiGradlePlugin.kt#L44 Since gradle 6.0+ in the consuming project (the one applying the gradle plugin I wrote) the library dependency vanishes from the SourceSets. When I switch back to gradle wrapper 5.6.4 it reappears magically. Can anyone help with that? When I list the dependencies, The libraries seem to be correctly linked (no difference between 5.6.4 and 6.6.2) but they are missing in the SourceSets
message has been deleted
t
most probably configuration name was changed
n
Thanks @tapchicoma May I ask you to elaborate a bit ?
t
sorry, maybe I've misread you question. You still have this dependency, but only sources is missing?
n
Yes. Results in a resource not resolved error. But when I downgrade the gradle wrapper back to 5.6.4 everything works again instantly. Snap back to 6.0+ and it breaks
t
most probably you dependency is published with incomplete gradle metadata
n
message has been deleted
But the dependency still is listed with
gradle dependencies
t
under which configuration? Is it has the same name as, for example,
com.soywiz.korlibs.korge
?
n
I really appreciate your help because I really am stuck and already pushed the changes out to some of my students before I became aware so I am in some trouble 🙂
Its the me.emig.engineEmi:055 lib
t
I see your dependency in
commonMainApi
configuration, so project should compile. I would advice you to check how you are publishing your library using this guide: https://docs.gradle.org/current/userguide/publishing_maven.html and https://docs.gradle.org/current/userguide/publishing_setup.html. Also in library setup update Gradle to latest version.
n
I find the behavior totally erratic. It is in dependencies but not in sourceSets
t
your publication possibly missing source publishing
n
Aah you mean on the libraries side ?
t
yes
n
but why does it work on 5.6.4 then ?
t
I think with Gradle 6.0 they enable usage of Gradle metadata by default
n
I will try that. Thanks. I’ll come back to you
Okay. Thanks for your help. I got one step further. I now actively add the sources to the maven repository and voila they appear in the sourceSets. BUT. I still get an
Unresolved reference: me
error !! Wtf!
message has been deleted
t
compilation fails?
or it is just IDEA not showing properly?
n
nono it fails not just a display update glitch:
Copy code
> Configure project :
Kotlin Multiplatform Projects are an experimental feature.

> Task :compileKotlinJvm FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See <https://docs.gradle.org/6.2.2/userguide/command_line_interface.html#sec:command_line_warnings>
1 actionable task: 1 executed
e: /Users/user/dev/engineEmi/engineEmi_Template/src/commonMain/kotlin/Main.kt: (1, 8): Unresolved reference: me
e: /Users/user/dev/engineEmi/engineEmi_Template/src/commonMain/kotlin/Main.kt: (16, 9): Unresolved reference: engine
e: /Users/user/dev/engineEmi/engineEmi_Template/src/commonMain/kotlin/Main.kt: (21, 13): Unresolved reference: init
e: /Users/user/dev/engineEmi/engineEmi_Template/src/commonMain/kotlin/Main.kt: (28, 13): Unresolved reference: viewWillLoad
e: /Users/user/dev/engineEmi/engineEmi_Template/src/commonMain/kotlin/Main.kt: (35, 13): Unresolved reference: viewDidLoad
e: /Users/user/dev/engineEmi/engineEmi_Template/src/commonMain/kotlin/Main.kt: (39, 13): Unresolved reference: start

FAILURE: Build failed with an exception.
t
is you library also uses multiplatform plugin?
n
Yes. its here. And works perfectly in 5.6.4 https://github.com/emign/engineEmi
t
you need to change your publication configuration, check this guide: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#publishing-a-multiplatform-library Should be something like:
Copy code
publishing {
   publications {
      val kotlinMultiplatform by getting {
n
Okay. I reconfigured. What happend: It stopped working on 5.6.4 too 🙂 Dont know if thats good or bad
Ill go investigtate
I fixed it Thanks for your help.
t
how? via library publishing update?
n
It was a combination of 2 things on the library. The
kotlin{}
Block in the Build file does almost all configuration for the maven publishing already. So there is no need to do anything in the
publishing{}
Block besides specifying the repository you publish to. (Most probably I messed the config up in there). Secondly: I used the gradle task
publishAllPublicationsToMavenRepository
which did somehow fuck things up too. I use
publish
now
👍 1
aaah. And you need
systemProp.org.gradle.internal.publish.checksums.insecure=true
as gradle property because if you don’t have it bintray will fuck up your version numbers badly