Skip to content

Commit 0e926e7

Browse files
qwwdfsadturansky
andauthored
Kotlin DSL - Kotlin conventions (JVM & JS)
Kotlin DSL - Kotlin conventions (JVM & JS) This is an adapter version of PR sent by Victor Turansky Co-authored-by: Victor Turansky <[email protected]>
1 parent 5a6f890 commit 0e926e7

File tree

6 files changed

+94
-78
lines changed

6 files changed

+94
-78
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
import org.jetbrains.kotlin.konan.target.HostManager
55
import org.gradle.util.VersionNumber
@@ -183,7 +183,7 @@ allprojects {
183183
configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != coreModule }) {
184184
evaluationDependsOn(":$coreModule")
185185
def platform = PlatformKt.platformOf(it)
186-
apply from: rootProject.file("gradle/compile-${platform}.gradle")
186+
apply plugin: "kotlin-${platform}-conventions"
187187
dependencies {
188188
// See comment below for rationale, it will be replaced with "project" dependency
189189
compile project(":$coreModule")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
// Platform-specific configuration to compile JS modules
6+
7+
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
8+
9+
plugins {
10+
kotlin("js")
11+
}
12+
13+
dependencies {
14+
testImplementation(kotlin("test-js"))
15+
}
16+
17+
kotlin {
18+
js(LEGACY) {
19+
moduleName = project.name.removeSuffix("-js")
20+
}
21+
22+
sourceSets {
23+
main {
24+
kotlin.srcDirs("src")
25+
resources.srcDirs("resources")
26+
}
27+
test {
28+
kotlin.srcDirs("test")
29+
resources.srcDirs("test-resources")
30+
}
31+
}
32+
}
33+
34+
tasks.withType<KotlinJsCompile> {
35+
kotlinOptions {
36+
moduleKind = "umd"
37+
sourceMap = true
38+
metaInfo = true
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
// Platform-specific configuration to compile JVM modules
6+
7+
import org.gradle.api.*
8+
9+
plugins {
10+
kotlin("jvm")
11+
}
12+
13+
java {
14+
sourceCompatibility = JavaVersion.VERSION_1_6
15+
targetCompatibility = JavaVersion.VERSION_1_6
16+
}
17+
18+
if (rootProject.extra.get("jvm_ir_enabled") as Boolean) {
19+
kotlin.target.compilations.configureEach {
20+
kotlinOptions.useIR = true
21+
}
22+
}
23+
24+
dependencies {
25+
testCompile(kotlin("test"))
26+
// Workaround to make addSuppressed work in tests
27+
testCompile(kotlin("reflect"))
28+
testCompile(kotlin("stdlib-jdk7"))
29+
testCompile(kotlin("test-junit"))
30+
testCompile("junit:junit:${version("junit")}")
31+
}
32+
33+
tasks.compileKotlin {
34+
kotlinOptions {
35+
freeCompilerArgs += listOf("-Xexplicit-api=strict")
36+
}
37+
}
38+
39+
tasks.withType<Test> {
40+
testLogging {
41+
showStandardStreams = true
42+
events("passed", "failed")
43+
}
44+
val stressTest = project.properties["stressTest"]
45+
if (stressTest != null) systemProperties["stressTest"] = stressTest
46+
}

gradle/compile-js.gradle

-32
This file was deleted.

gradle/compile-jvm.gradle

-40
This file was deleted.

integration-testing/build.gradle

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
2-
31
/*
4-
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
53
*/
64

7-
apply from: rootProject.file("gradle/compile-jvm.gradle")
5+
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
6+
7+
plugins {
8+
id("kotlin-jvm-conventions")
9+
}
810

911
repositories {
1012
mavenLocal()

0 commit comments

Comments
 (0)