Skip to content

Commit e1a5652

Browse files
committed
Extracted compilation configs into separate build files
1 parent 905a512 commit e1a5652

File tree

5 files changed

+66
-57
lines changed

5 files changed

+66
-57
lines changed

build.gradle

+2-57
Original file line numberDiff line numberDiff line change
@@ -46,63 +46,8 @@ static def platformLib(base, platform) {
4646

4747
configure(subprojects.findAll { !sourceless.contains(it.name) }) {
4848
def platform = platformOf(it)
49-
apply plugin: "kotlin-platform-$platform"
50-
51-
if (platform == "jvm") {
52-
sourceCompatibility = 1.6
53-
targetCompatibility = 1.6
54-
}
55-
56-
kotlin.experimental.coroutines "enable"
57-
58-
if (platform == "js") {
59-
tasks.withType(compileKotlin2Js.getClass()) {
60-
kotlinOptions {
61-
moduleKind = "umd"
62-
sourceMap = true
63-
metaInfo = true
64-
// drop -js suffix from outputFile
65-
def baseName = project.name - "-js"
66-
outputFile = new File(outputFile.parent, baseName + ".js")
67-
}
68-
}
69-
}
70-
71-
tasks.withType(Test) {
72-
testLogging {
73-
showStandardStreams = true
74-
events "passed", "failed"
75-
}
76-
def stressTest = project.properties['stressTest']
77-
if (stressTest != null) systemProperties['stressTest'] = stressTest
78-
}
79-
80-
repositories {
81-
jcenter()
82-
maven { url "http://kotlin.bintray.com/kotlinx" }
83-
maven { url "https://dl.bintray.com/devexperts/Maven/" }
84-
}
85-
86-
def kotlin_stdlib = platformLib("kotlin-stdlib", platform)
87-
def kotlin_test = platformLib("kotlin-test", platform)
88-
89-
dependencies {
90-
compile "org.jetbrains.kotlin:$kotlin_stdlib:$kotlin_version"
91-
testCompile "org.jetbrains.kotlin:$kotlin_test:$kotlin_version"
92-
}
93-
94-
if (platform == "common") {
95-
dependencies {
96-
testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
97-
}
98-
}
99-
100-
if (platform == "jvm") {
101-
dependencies {
102-
testCompile "junit:junit:$junit_version"
103-
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
104-
}
105-
}
49+
apply from: rootProject.file("gradle/compile-${platform}.gradle")
50+
apply from: rootProject.file("gradle/compile-all.gradle")
10651
}
10752

10853
// --------------- Configure sub-projects that are part of the library ---------------

gradle/compile-all.gradle

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
// Shared configuration to compile all modules
3+
4+
kotlin.experimental.coroutines "enable"
5+
6+
repositories {
7+
jcenter()
8+
maven { url "http://kotlin.bintray.com/kotlinx" }
9+
maven { url "https://dl.bintray.com/devexperts/Maven/" }
10+
}
11+
12+
tasks.withType(Test) {
13+
testLogging {
14+
showStandardStreams = true
15+
events "passed", "failed"
16+
}
17+
def stressTest = project.properties['stressTest']
18+
if (stressTest != null) systemProperties['stressTest'] = stressTest
19+
}

gradle/compile-common.gradle

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
// Platform-specific configuration to compile common modules
3+
4+
apply plugin: 'kotlin-platform-common'
5+
6+
dependencies {
7+
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
8+
testCompile "org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
9+
testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
10+
}
11+

gradle/compile-js.gradle

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
// Platform-specific configuration to compile JS modules
3+
4+
apply plugin: 'kotlin-platform-js'
5+
6+
tasks.withType(compileKotlin2Js.getClass()) {
7+
kotlinOptions {
8+
moduleKind = "umd"
9+
sourceMap = true
10+
metaInfo = true
11+
// drop -js suffix from outputFile
12+
def baseName = project.name - "-js"
13+
outputFile = new File(outputFile.parent, baseName + ".js")
14+
}
15+
}
16+
17+
dependencies {
18+
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
19+
testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
20+
}

gradle/compile-jvm.gradle

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
// Platform-specific configuration to compile JVM modules
3+
4+
apply plugin: 'kotlin-platform-jvm'
5+
6+
sourceCompatibility = 1.6
7+
targetCompatibility = 1.6
8+
9+
dependencies {
10+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
11+
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
12+
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
13+
testCompile "junit:junit:$junit_version"
14+
}

0 commit comments

Comments
 (0)