I'm trying to upgrade a build script from 1.3.21 o...
# gradle
c
I'm trying to upgrade a build script from 1.3.21 of kotlin-gradle-plugin to use a newer version, but when using 1.3.30 or higher the script fails at runtime with: "Resolving configuration 'jsMainImplementation' directly is not allowed" The code triggering this is:
configurations.getByName("jsMainImplementation").forEach { ... }
My question is, what do I need to change this to for it to work with 1.3.30+?
g
c
No, I'm on the same version of Gradle as before, 5.2.1 (I had tried moving to 5.5.1 but that didn't make any difference). The breaking change seems to be due to 1.3.30+
I can't see anything in the changelog for 1.3.30 that looks like the culprit though
g
Anyway, the reason should be the same, you cannot resolve implementation on runtime, probably implementation of it for JS is changed
Just compileClasspath
c
OK thanks for the pointer, I'll see what I can figure out from here
g
Also, why do you need this?
c
I didn't write the script originally, but from what I can see it's trying to find any .jar files and expand them into a particular directory
plus uses some templates to generate files containing name and version details
g
I'm not sure that it is needed anymore, depends on what this code actually does
c
g
I would just migrate to official tooling and new Kotlin Js plugin
c
Yes I guess so... bit of a tangent from what I'm supposed to be working on but have to deal with this sooner or later 😞
g
Yes, it's pretty nasty code, not surprising that it's broken after update
c
Agreed... OK I'll try migrating to the plugin. Thanks for the help!
Hmm looks like a big change, might have to tackle this some other time 😞
g
If you have a question be free to ask on #javascript channel
c
Will do, thanks
g
Upcoming 1.3.50 has a lot of improvements for new JS Gradle Plugin, probably make sense to migrate to it: https://github.com/JetBrains/kotlin/releases/tag/v1.3.50-eap-54
c
Thanks, I was looking at that. Still need to spend some time figuring out what the plugin does exactly and whether it will fit in to our bigger picture w.r.t directory structures, build and release process, fusebox instead of webpack etc without too much pain.