-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* drop target-specific convention plugins, as KGP now generates accessors * use targets helpers in projects * drop template convention plugins, leave only library - inline usages * create test aggregate tasks * reduce usages of OptIns * use jvm-default=all (easier compatibility in future) * drop test server completely for now from `rsocket-transport-tests`
- Loading branch information
Showing
35 changed files
with
492 additions
and
733 deletions.
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
build-logic/src/main/kotlin/rsocketbuild.multiplatform-base.gradle.kts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* Copyright 2015-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import org.jetbrains.kotlin.gradle.* | ||
import org.jetbrains.kotlin.gradle.plugin.* | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.* | ||
import org.jetbrains.kotlin.gradle.targets.js.ir.* | ||
import org.jetbrains.kotlin.gradle.targets.jvm.* | ||
import org.jetbrains.kotlin.gradle.targets.jvm.tasks.* | ||
import org.jetbrains.kotlin.gradle.targets.native.tasks.* | ||
import org.jetbrains.kotlin.gradle.tasks.* | ||
import rsocketbuild.* | ||
import rsocketbuild.tests.* | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
} | ||
|
||
@OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
kotlin { | ||
compilerOptions { | ||
// allWarningsAsErrors.set(true) | ||
progressiveMode.set(true) | ||
freeCompilerArgs.add("-Xrender-internal-diagnostic-names") | ||
} | ||
|
||
sourceSets.configureEach { | ||
languageSettings { | ||
if (name.contains("test", ignoreCase = true)) { | ||
optIn(OptIns.ExperimentalStdlibApi) | ||
optIn(OptIns.DelicateCoroutinesApi) | ||
|
||
// rsocket related | ||
optIn(OptIns.TransportApi) | ||
optIn(OptIns.ExperimentalMetadataApi) | ||
optIn(OptIns.ExperimentalStreamsApi) | ||
optIn(OptIns.RSocketLoggingApi) | ||
} | ||
} | ||
} | ||
|
||
targets.withType<KotlinJvmTarget>().configureEach { | ||
compilations.configureEach { | ||
compilerOptions.configure { | ||
freeCompilerArgs.add("-Xjvm-default=all") | ||
} | ||
} | ||
} | ||
|
||
// revisit JS block after WASM support | ||
targets.withType<KotlinJsIrTarget>().configureEach { | ||
whenBrowserConfigured { | ||
testTask { | ||
useKarma { | ||
useConfigDirectory(rootDir.resolve("gradle/js/karma.config.d")) | ||
useChromeHeadless() | ||
} | ||
} | ||
} | ||
whenNodejsConfigured { | ||
testTask { | ||
useMocha { | ||
timeout = "600s" | ||
} | ||
} | ||
} | ||
} | ||
|
||
//setup tests running in RELEASE mode | ||
targets.withType<KotlinNativeTarget>().configureEach { | ||
binaries.test(listOf(NativeBuildType.RELEASE)) | ||
} | ||
targets.withType<KotlinNativeTargetWithTests<*>>().configureEach { | ||
testRuns.create("releaseTest") { | ||
setExecutionSourceFrom(binaries.getTest(NativeBuildType.RELEASE)) | ||
} | ||
} | ||
} | ||
|
||
// for CI mainly | ||
|
||
registerTestAggregationTask( | ||
name = "jvmAllTest", | ||
taskDependencies = { tasks.withType<KotlinJvmTest>() }, | ||
targetFilter = { it.platformType == KotlinPlatformType.jvm } | ||
) | ||
|
||
registerTestAggregationTask( | ||
name = "nativeTest", | ||
taskDependencies = { tasks.withType<KotlinNativeTest>().matching { it.enabled } }, | ||
targetFilter = { it.platformType == KotlinPlatformType.native } | ||
) | ||
|
||
listOf("ios", "watchos", "tvos", "macos").forEach { targetGroup -> | ||
registerTestAggregationTask( | ||
name = "${targetGroup}Test", | ||
taskDependencies = { | ||
tasks.withType<KotlinNativeTest>().matching { | ||
it.enabled && it.name.startsWith(targetGroup, ignoreCase = true) | ||
} | ||
}, | ||
targetFilter = { | ||
it.platformType == KotlinPlatformType.native && it.name.startsWith(targetGroup, ignoreCase = true) | ||
} | ||
) | ||
} | ||
|
||
// on build, link even those binaries, which it's not possible to run | ||
tasks.build { | ||
dependsOn(tasks.withType<KotlinNativeLink>()) | ||
} | ||
|
||
if (providers.gradleProperty("rsocketbuild.skipTests").map(String::toBoolean).getOrElse(false)) { | ||
tasks.withType<AbstractTestTask>().configureEach { onlyIf { false } } | ||
} | ||
|
||
if (providers.gradleProperty("rsocketbuild.skipNativeLink").map(String::toBoolean).getOrElse(false)) { | ||
tasks.withType<KotlinNativeLink>().configureEach { onlyIf { false } } | ||
} |
This file contains 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
49 changes: 0 additions & 49 deletions
49
build-logic/src/main/kotlin/rsocketbuild.multiplatform.gradle.kts
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
build-logic/src/main/kotlin/rsocketbuild.multiplatform.native.gradle.kts
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
build-logic/src/main/kotlin/rsocketbuild.target.all.gradle.kts
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
build-logic/src/main/kotlin/rsocketbuild.target.js.all.gradle.kts
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
build-logic/src/main/kotlin/rsocketbuild.target.js.browser.gradle.kts
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
build-logic/src/main/kotlin/rsocketbuild.target.js.node.gradle.kts
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
build-logic/src/main/kotlin/rsocketbuild.target.jvm.gradle.kts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.