Created
February 23, 2019 01:57
-
-
Save zen0wu/75d3bc34851ad15d562a530c89cba761 to your computer and use it in GitHub Desktop.
Kotlin + Gradle + JVM with JS project setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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