Skip to content

Commit 6781232

Browse files
committed
build: deduplicate kotlin multiplatform config
1 parent ef941c4 commit 6781232

File tree

18 files changed

+66
-275
lines changed

18 files changed

+66
-275
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
kotlin("multiplatform")
19+
}
20+
21+
java {
22+
toolchain {
23+
languageVersion.set(JavaLanguageVersion.of(11))
24+
}
25+
}
26+
27+
kotlin {
28+
jvmToolchain(11)
29+
js(IR) {
30+
browser {
31+
testTask {
32+
useMocha {
33+
timeout = "60s"
34+
}
35+
}
36+
}
37+
nodejs {
38+
testTask {
39+
useMocha {
40+
timeout = "60s"
41+
}
42+
}
43+
}
44+
useCommonJs()
45+
}
46+
jvm {
47+
testRuns["test"].executionTask.configure {
48+
useJUnitPlatform()
49+
}
50+
}
51+
}

bulk-model-sync-lib/build.gradle.kts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
plugins {
2-
kotlin("multiplatform")
2+
`modelix-kotlin-multiplatform`
33
}
44

55
kotlin {
6-
jvmToolchain(11)
7-
js(IR) {
8-
browser {
9-
testTask {
10-
useMocha {
11-
timeout = "60s"
12-
}
13-
}
14-
}
15-
}
16-
jvm {
17-
testRuns["test"].executionTask.configure {
18-
useJUnitPlatform()
19-
}
20-
}
216
sourceSets {
227
val commonMain by getting {
238
dependencies {

kotlin-utils/build.gradle.kts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
11
plugins {
22
`maven-publish`
3-
kotlin("multiplatform")
3+
`modelix-kotlin-multiplatform`
44
}
55

66
kotlin {
7-
jvm()
8-
js(IR) {
9-
browser {
10-
testTask {
11-
useMocha {
12-
timeout = "30s"
13-
}
14-
}
15-
}
16-
nodejs {
17-
testTask {
18-
useMocha {
19-
timeout = "30s"
20-
}
21-
}
22-
}
23-
useCommonJs()
24-
}
257
sourceSets {
268
val commonMain by getting {
279
dependencies {

light-model-client/build.gradle.kts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
11
plugins {
2-
kotlin("multiplatform")
2+
`modelix-kotlin-multiplatform`
33
`maven-publish`
44
}
55

66
kotlin {
7-
jvm()
8-
js(IR) {
9-
browser {
10-
testTask {
11-
useMocha {
12-
timeout = "10s"
13-
}
14-
}
15-
}
16-
nodejs {
17-
testTask {
18-
useMocha {
19-
timeout = "10s"
20-
}
21-
}
22-
}
23-
useCommonJs()
24-
}
25-
267
sourceSets {
278
val commonMain by getting {
289
dependencies {

model-api-gen-runtime/build.gradle.kts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
plugins {
2-
kotlin("multiplatform")
2+
`modelix-kotlin-multiplatform`
33
kotlin("plugin.serialization")
44
}
55

66
val mpsExtensionsVersion: String by rootProject
77

88
kotlin {
9-
jvm()
10-
js(IR) {
11-
browser {
12-
testTask {
13-
useMocha {
14-
timeout = "10s"
15-
}
16-
}
17-
}
18-
nodejs {
19-
testTask {
20-
useMocha {
21-
timeout = "10s"
22-
}
23-
}
24-
}
25-
useCommonJs()
26-
}
27-
289
sourceSets {
2910
all {
3011
languageSettings.optIn("kotlin.js.ExperimentalJsExport")

model-api/build.gradle.kts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
plugins {
22
`maven-publish`
3-
kotlin("multiplatform")
3+
`modelix-kotlin-multiplatform`
44
kotlin("plugin.serialization")
55
}
66

77
description = "API to access models stored in Modelix"
88

99
kotlin {
10-
jvm()
11-
js(IR) {
12-
nodejs {
13-
testTask {
14-
useMocha {
15-
timeout = "10s"
16-
}
17-
}
18-
}
19-
useCommonJs()
20-
}
2110
sourceSets {
2211
val commonMain by getting {
2312
dependencies {

model-client/build.gradle.kts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,22 @@ import dev.petuska.npm.publish.task.NpmPackTask
22

33
plugins {
44
`maven-publish`
5-
kotlin("multiplatform")
5+
`modelix-kotlin-multiplatform`
66
alias(libs.plugins.spotless)
77
alias(libs.plugins.npm.publish)
88
`java-library`
99
jacoco
1010
}
1111

12-
java {
13-
toolchain {
14-
languageVersion.set(JavaLanguageVersion.of(11))
15-
}
16-
}
17-
1812
val kotlinCoroutinesVersion: String by rootProject
1913
val kotlinLoggingVersion: String by rootProject
2014
val ktorVersion: String by rootProject
2115
val kotlinxSerializationVersion: String by rootProject
2216

2317
kotlin {
24-
jvmToolchain(11)
25-
jvm()
2618
js(IR) {
27-
browser {
28-
testTask {
29-
useMocha {
30-
timeout = "30s"
31-
}
32-
}
33-
}
34-
nodejs {
35-
testTask {
36-
useMocha {
37-
timeout = "30s"
38-
}
39-
}
40-
}
4119
binaries.library()
4220
generateTypeScriptDefinitions()
43-
useCommonJs()
4421
}
4522
sourceSets {
4623
val commonMain by getting {

model-client/integration-tests/build.gradle.kts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,11 @@
1515
// The solution with Docker Compose works for now
1616
// because the number of tests is small and only one container configuration is enough.
1717
plugins {
18-
kotlin("multiplatform")
18+
`modelix-kotlin-multiplatform`
1919
alias(libs.plugins.docker.compose)
2020
}
2121

2222
kotlin {
23-
jvm()
24-
js(IR) {
25-
browser {
26-
testTask {
27-
useMocha {
28-
timeout = "30s"
29-
}
30-
}
31-
}
32-
nodejs {
33-
testTask {
34-
useMocha {
35-
timeout = "30s"
36-
}
37-
}
38-
}
39-
useCommonJs()
40-
}
4123
sourceSets {
4224
val commonTest by getting {
4325
dependencies {

model-datastructure/build.gradle.kts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
11
plugins {
22
`maven-publish`
3-
kotlin("multiplatform")
3+
`modelix-kotlin-multiplatform`
44
}
55

66
kotlin {
7-
jvm()
8-
js(IR) {
9-
browser {
10-
testTask {
11-
useMocha {
12-
timeout = "30s"
13-
}
14-
}
15-
}
16-
nodejs {
17-
testTask {
18-
useMocha {
19-
timeout = "30s"
20-
}
21-
}
22-
}
23-
useCommonJs()
24-
}
257
sourceSets {
268
val commonMain by getting {
279
dependencies {

model-datastructure/src/jvmTest/kotlin/org/modelix/model/InMemoryModelTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.modelix.model
1818

19-
import org.junit.Test
2019
import org.modelix.model.api.BuiltinLanguages
2120
import org.modelix.model.api.TreePointer
2221
import org.modelix.model.api.getRootNode
@@ -26,6 +25,7 @@ import org.modelix.model.lazy.ObjectStoreCache
2625
import org.modelix.model.lazy.RepositoryId
2726
import org.modelix.model.persistent.CPTree
2827
import org.modelix.model.persistent.MapBasedStore
28+
import kotlin.test.Test
2929
import kotlin.test.assertEquals
3030

3131
class InMemoryModelTest {

0 commit comments

Comments
 (0)