How Do I Convert My build.gradle.kts To Use The Multiplatform Module Instead Of The JVM One?

How Do I Convert My build.gradle.kts To Use The Multiplatform Module Instead Of The JVM One?

plugins { java val kotlinVersion: String by System.getProperties() kotlin("jvm").version(kotlinVersion) id("com.github.johnrengelman.shadow").version("6.0.0") } group = "com.smushytaco" version = "1.0.0" repositories { mavenCentral() maven("https://papermc.io/repo/repository/maven-public/") } dependencies { val kotlinVersion: String by System.getProperties() implementation(kotlin("stdlib", kotlinVersion)) implementation("org.rocksdb", "rocksdbjni", "6.11.4") //https://papermc.io/javadocs/paper/1.16/overview-summary.html compileOnly("com.destroystokyo.paper", "paper-api", "1.16.1-R0.1-SNAPSHOT") } tasks { shadowJar { archiveClassifier.set("") project.configurations.implementation.get().isCanBeResolved = true configurations = listOf(project.configurations.implementation.get()) relocate("kotlin", "com.smushytaco.src.main.kotlin") minimize() } build { dependsOn(shadowJar) } }

That’s the build.gradle.kts that uses the plain old jvm plugin module and I’m trying to convert it to use the multiplatform one in preparation of Kotlin 1.4 and this was my attempt at it:

plugins { java val kotlinVersion: String by System.getProperties() kotlin("multiplatform").version(kotlinVersion) id("com.github.johnrengelman.shadow").version("6.0.0") } kotlin { jvm() sourceSets { val jvmMain by getting { dependencies { val kotlinVersion: String by System.getProperties() implementation(kotlin("stdlib", kotlinVersion)) implementation("org.rocksdb:rocksdbjni:6.11.4") //https://papermc.io/javadocs/paper/1.16/overview-summary.html compileOnly("com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT") } } } } group = "com.smushytaco" version = "1.0.0" repositories { mavenCentral() maven("https://papermc.io/repo/repository/maven-public/") } tasks { shadowJar { archiveClassifier.set("") project.configurations.implementation.get().isCanBeResolved = true configurations = listOf(project.configurations.implementation.get()) relocate("kotlin", "com.smushytaco.src.main.kotlin") minimize() } build { dependsOn(shadowJar) } }

This is very broken and doesn’t work. For starters it’s like the dependencies get ignored. With my MPP attempted build.gradle.kts whenever I go to my code there are errors everywhere because the dependencies aren’t properly build handled. Another issue I’m facing is the fact nothing is being shaded in the jars (Because dependencies are being ignored). The last issue I’m dealing with is that this MPP build.gradle.kts creates 3 jars instead of 1, before it just created Ride-1.0.0.jar but now it creates Ride-1.0.0.jar, Ride-jvm-1.0.0.jar, and Ride-metadata-1.0.0.jar. How do I fix all these issues?

submitted by /u/SmushyTaco
[link] [comments]