Skip to content

Instantly share code, notes, and snippets.

@zen0wu
Created February 23, 2019 01:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zen0wu/75d3bc34851ad15d562a530c89cba761 to your computer and use it in GitHub Desktop.
Save zen0wu/75d3bc34851ad15d562a530c89cba761 to your computer and use it in GitHub Desktop.
Kotlin + Gradle + JVM with JS project setup
plugins {
`java-library`
id("kotlin-multiplatform") version "1.3.21"
}
allprojects {
group = "xxx"
version = "1.0.0-SNAPSHOT"
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceSets {
main {
java.srcDir("src/jvmMain/kotlin")
}
}
}
kotlin {
jvm()
js()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
rootProject.name = "xxx"
pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.id == "kotlin-multiplatform") {
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment