https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

Jakob K

12/24/2020, 12:22 PM
Hey, I want to use the kotlin multiplatform plugin for gradle within a precompiled plugin (inside of the buildSrc folder) - but it does not work. Does this really just not work or is there a problem inside of my gradle script files?
j

Javier

12/24/2020, 12:24 PM
I am using that plugin without problem
j

Jakob K

12/24/2020, 12:24 PM
And this is the whole project (still with the jvm plugin): https://github.com/bluefireoly/SpamgourmetReloaded
j

Javier

12/24/2020, 12:24 PM
have you added the kotlin Gradle plugin to your dependencies block in buildSrc?
j

Jakob K

12/24/2020, 12:24 PM
Yes, is the code snippet I shared only visible for me?
j

Javier

12/24/2020, 12:25 PM
I can see it
I see you are using kotlin("jvm") changing that to Multiplatform doesn't work?
j

Jakob K

12/24/2020, 12:27 PM
Yes, if I change it just everything is not found.
j

Javier

12/24/2020, 12:27 PM
you are using them inside kotlin { source sets { ... } }?
testImplementation doesn't exist in Multiplatform
j

Jakob K

12/24/2020, 12:28 PM
Even this kotlin function is not found, so I cannot use that.
j

Javier

12/24/2020, 12:29 PM
you have to use implementation(yourLib) in the whatever test source set you need it (example, jvmTest)
j

Jakob K

12/24/2020, 12:30 PM
Okay, but the problem is that I can't even configure the multiplatform plugin as nothing is available.
j

Javier

12/24/2020, 12:31 PM
Sorry I am on mobile and I can't crop them quickly
j

Jakob K

12/24/2020, 12:32 PM
That is not possible, as everything regarding this plugin is missing.
j

Javier

12/24/2020, 12:33 PM
if you sync it doesn't become highlighted?
j

Jakob K

12/24/2020, 12:33 PM
Yes
j

Javier

12/24/2020, 12:33 PM
but a sync without failures
j

Jakob K

12/24/2020, 12:34 PM
https://kotlinlang.slack.com/archives/C3PQML5NU/p1608812820434000?thread_ts=1608812542.431800&cid=C3PQML5NU The above errors come up, but these are just a result of the missing plugin.
j

Javier

12/24/2020, 12:34 PM
Above error are normal, testImplementation does not exist
in Multiplatform
j

Jakob K

12/24/2020, 12:35 PM
Yes I know, but the others are not normal.
j

Javier

12/24/2020, 12:36 PM
I don't know really, because some of them are java, maybe that is the problem
try to remove them until you get it working
j

Jakob K

12/24/2020, 12:37 PM
Also, testImplementation missing should not break the whole possibility of configuring the multiplatform plugin.
j

Javier

12/24/2020, 12:38 PM
it breaks the highlighting, but it is normal (at least for me it happens every time)
and it doesn't compile too if you try to use gradlew build
j

Jakob K

12/24/2020, 12:39 PM
I don't know really, because some of them are java, maybe that is the problem
But I don't really want to comment out all of my scripts, that does not feel like the right way to switch to the multiplatform plugin.
j

Javier

12/24/2020, 12:39 PM
but it has sense
j

Jakob K

12/24/2020, 12:39 PM
and it doesn't compile too if you try to use gradlew build
Yeah, I tried that too
j

Javier

12/24/2020, 12:39 PM
you are trying to use a function that doesn't exist, so it explodes
for kotlin compile use tasks.withType<KotlinCompile>() { ... }
java...Compability probably should fail too I think but I didn't use it so
tasks.test can be replaced with withType<Test> I think
j

Jakob K

12/24/2020, 12:46 PM
Okay so I got it working by commenting out all of the possible non existent functionalities. Now I am trying to reimplement them one after another.
you are trying to use a function that doesn't exist, so it explodes
Actually this is a good explanation of what happens, but still weird that the plugin is not configurable because of an error later in the build script.
👌 1
10 Views