Skip to content

Commit 2f4e1d0

Browse files
committed
Explicit targets and dependencies declarations
1 parent eb370c4 commit 2f4e1d0

28 files changed

+226
-434
lines changed

build-logic/src/main/kotlin/rsocketbuild.multiplatform.gradle.kts

+47-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17+
import org.jetbrains.kotlin.gradle.plugin.*
18+
import org.jetbrains.kotlin.gradle.plugin.mpp.*
19+
import org.jetbrains.kotlin.gradle.targets.js.ir.*
20+
import org.jetbrains.kotlin.gradle.targets.jvm.*
21+
import rsocketbuild.*
22+
1723
plugins {
1824
kotlin("multiplatform")
1925
}
2026

2127
kotlin {
22-
jvmToolchain(8)
23-
2428
targets.configureEach {
2529
compilations.configureEach {
2630
compilerOptions.configure {
@@ -29,6 +33,47 @@ kotlin {
2933
}
3034
}
3135

36+
targets.withType<KotlinJvmTarget>().configureEach {
37+
testRuns.configureEach {
38+
executionTask.configure {
39+
// ActiveProcessorCount is used here, to make sure local setup is similar as on CI
40+
// GitHub Actions linux runners have 2 cores
41+
jvmArgs("-Xmx1g", "-XX:ActiveProcessorCount=2")
42+
}
43+
}
44+
}
45+
46+
// revisit JS block after WASM support
47+
targets.withType<KotlinJsIrTarget>().configureEach {
48+
whenBrowserConfigured {
49+
testTask {
50+
useKarma {
51+
useConfigDirectory(rootDir.resolve("gradle/js/karma.config.d"))
52+
useChromeHeadless()
53+
}
54+
}
55+
}
56+
whenNodejsConfigured {
57+
testTask {
58+
useMocha {
59+
timeout = "600s"
60+
}
61+
}
62+
}
63+
}
64+
65+
targets.withType<KotlinNativeTargetWithTests<*>>().configureEach {
66+
//setup tests running in RELEASE mode
67+
binaries.test(listOf(NativeBuildType.RELEASE))
68+
testRuns.create("releaseTest") {
69+
setExecutionSourceFrom(binaries.getTest(NativeBuildType.RELEASE))
70+
}
71+
//don't even link tests if we can't run them (like, linux on macos, or mingw on linux/macos, etc)
72+
testRuns.configureEach {
73+
executionSource.binary.linkTaskProvider.get().enabled = (this as ExecutionTaskHolder<*>).executionTask.get().enabled
74+
}
75+
}
76+
3277
sourceSets.configureEach {
3378
languageSettings {
3479
progressiveMode = true

build-logic/src/main/kotlin/rsocketbuild.multiplatform.native.gradle.kts

-33
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.all.gradle.kts

-21
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.js.all.gradle.kts

-20
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.js.browser.gradle.kts

-32
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.js.node.gradle.kts

-31
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.jvm.gradle.kts

-42
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.native.all.gradle.kts

-23
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.native.apple.gradle.kts

-38
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.target.native.nix.gradle.kts

-23
This file was deleted.

build-logic/src/main/kotlin/rsocketbuild.template.library.gradle.kts

-8
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,4 @@ plugins {
2121

2222
kotlin {
2323
explicitApi()
24-
25-
sourceSets {
26-
commonTest {
27-
dependencies {
28-
implementation(project(":rsocket-test"))
29-
}
30-
}
31-
}
3224
}

build-logic/src/main/kotlin/rsocketbuild.template.test.gradle.kts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import rsocketbuild.*
18+
1719
plugins {
1820
id("rsocketbuild.multiplatform")
1921
}

build-logic/src/main/kotlin/rsocketbuild.template.transport.gradle.kts

-29
This file was deleted.

0 commit comments

Comments
 (0)