diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml index ed725f82..58a74bc7 100644 --- a/.github/actions/setup-gradle/action.yml +++ b/.github/actions/setup-gradle/action.yml @@ -32,7 +32,7 @@ runs: 8 11 17 - 20 + 21 - name: Setup gradle uses: gradle/gradle-build-action@v2 with: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 01672591..3bec3ec4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -16,7 +16,7 @@ jobs: jvmTest jvm11Test jvm17Test - jvm20Test + jvm21Test --scan --info --continue @@ -120,4 +120,4 @@ jobs: --scan --info --continue - -Pskip.test + -Prsocketbuild.skipTests=true diff --git a/gradle/plugins/kotlin-version-catalog/build.gradle.kts b/build-logic/build.gradle.kts similarity index 81% rename from gradle/plugins/kotlin-version-catalog/build.gradle.kts rename to build-logic/build.gradle.kts index e7918058..524e1e8a 100644 --- a/gradle/plugins/kotlin-version-catalog/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -18,10 +18,6 @@ plugins { `kotlin-dsl` } -kotlin { - jvmToolchain(8) -} - dependencies { - implementation("rsocket.build:build-parameters") + implementation(libs.kotlin.gradle.plugin) } diff --git a/gradle/plugins/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts similarity index 65% rename from gradle/plugins/build-logic/settings.gradle.kts rename to build-logic/settings.gradle.kts index 84f5e7ca..e38595be 100644 --- a/gradle/plugins/build-logic/settings.gradle.kts +++ b/build-logic/settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -15,30 +15,19 @@ */ pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - includeBuild("../kotlin-version-catalog") + includeBuild("../build-settings") } -dependencyResolutionManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } +plugins { + id("rsocketsettings.default") +} +dependencyResolutionManagement { versionCatalogs { create("libs") { - from(files("../../libs.versions.toml")) + from(files("../gradle/libs.versions.toml")) } } } -plugins { - id("kotlin-version-catalog") -} - rootProject.name = "build-logic" - -includeBuild("../build-parameters") diff --git a/build-logic/src/main/kotlin/rsocketbuild.multiplatform-base.gradle.kts b/build-logic/src/main/kotlin/rsocketbuild.multiplatform-base.gradle.kts new file mode 100644 index 00000000..898f147c --- /dev/null +++ b/build-logic/src/main/kotlin/rsocketbuild.multiplatform-base.gradle.kts @@ -0,0 +1,133 @@ +/* + * 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 { + // because of https://youtrack.jetbrains.com/issue/KT-64115/KGP-JVM-JS-WASM-The-same-library-can-be-passed-twice-to-the-compiler + // 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().configureEach { + compilations.configureEach { + compilerOptions.configure { + freeCompilerArgs.add("-Xjvm-default=all") + } + } + } + + // revisit JS block after WASM support + targets.withType().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().configureEach { + binaries.test(listOf(NativeBuildType.RELEASE)) + } + targets.withType>().configureEach { + testRuns.create("releaseTest") { + setExecutionSourceFrom(binaries.getTest(NativeBuildType.RELEASE)) + } + } +} + +// for CI mainly + +registerTestAggregationTask( + name = "jvmAllTest", + taskDependencies = { tasks.withType() }, + targetFilter = { it.platformType == KotlinPlatformType.jvm } +) + +registerTestAggregationTask( + name = "nativeTest", + taskDependencies = { tasks.withType().matching { it.enabled } }, + targetFilter = { it.platformType == KotlinPlatformType.native } +) + +listOf("ios", "watchos", "tvos", "macos").forEach { targetGroup -> + registerTestAggregationTask( + name = "${targetGroup}Test", + taskDependencies = { + tasks.withType().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()) +} + +if (providers.gradleProperty("rsocketbuild.skipTests").map(String::toBoolean).getOrElse(false)) { + tasks.withType().configureEach { onlyIf { false } } +} + +if (providers.gradleProperty("rsocketbuild.skipNativeLink").map(String::toBoolean).getOrElse(false)) { + tasks.withType().configureEach { onlyIf { false } } +} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.nix.gradle.kts b/build-logic/src/main/kotlin/rsocketbuild.multiplatform-library.gradle.kts similarity index 79% rename from gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.nix.gradle.kts rename to build-logic/src/main/kotlin/rsocketbuild.multiplatform-library.gradle.kts index 2ef7180e..9c8d4612 100644 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.nix.gradle.kts +++ b/build-logic/src/main/kotlin/rsocketbuild.multiplatform-library.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -15,9 +15,10 @@ */ plugins { - id("rsocket.target.native.apple") + id("rsocketbuild.multiplatform-base") + id("rsocketbuild.publication") } kotlin { - linuxX64() + explicitApi() } diff --git a/build-logic/src/main/kotlin/rsocketbuild.publication.gradle.kts b/build-logic/src/main/kotlin/rsocketbuild.publication.gradle.kts new file mode 100644 index 00000000..53b380ef --- /dev/null +++ b/build-logic/src/main/kotlin/rsocketbuild.publication.gradle.kts @@ -0,0 +1,109 @@ +/* + * 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. + */ + +plugins { + `maven-publish` + signing +} + +val githubUsername: String? by project +val githubPassword: String? by project + +val sonatypeUsername: String? by project +val sonatypePassword: String? by project + +val signingKey: String? by project +val signingPassword: String? by project + +// TODO: refactor publication a bit, so that version in gradle.properties will not contain SNAPSHOT +val versionSuffix = providers.gradleProperty("rsocketbuild.versionSuffix").orNull +if (versionSuffix != null) { + val versionString = project.version.toString() + require(versionString.endsWith("-SNAPSHOT")) + project.version = versionString.replace("-", "-${versionSuffix}-") + println("Current version: ${project.version}") +} + +// empty javadoc for maven central +val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") } + +// this is somewhat a hack because we have a single javadoc artifact which is used for all publications +tasks.withType().configureEach { mustRunAfter(javadocJar) } +tasks.withType().configureEach { mustRunAfter(tasks.withType()) } + +publishing { + publications.withType { + artifact(javadocJar) + pom { + name.set(project.name) + description.set(provider { + checkNotNull(project.description) { "Project description isn't set for project: ${project.path}" } + }) + url.set("http://rsocket.io") + + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") + } + } + developers { + developer { + id.set("whyoleg") + name.set("Oleg Yukhnevich") + email.set("whyoleg@gmail.com") + } + developer { + id.set("OlegDokuka") + name.set("Oleh Dokuka") + email.set("oleh.dokuka@icloud.com") + } + } + scm { + connection.set("https://github.com/rsocket/rsocket-kotlin.git") + developerConnection.set("https://github.com/rsocket/rsocket-kotlin.git") + url.set("https://github.com/rsocket/rsocket-kotlin") + } + } + } + + repositories { + // TODO: drop github and use sonatype (?) + maven { + name = "github" + url = uri("https://maven.pkg.github.com/rsocket/rsocket-kotlin") + credentials { + username = githubUsername + password = githubPassword + } + } + maven { + name = "sonatype" + url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") + credentials { + username = sonatypeUsername + password = sonatypePassword + } + } + } +} + +signing { + isRequired = sonatypeUsername != null && sonatypePassword != null + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications) +} diff --git a/build-logic/src/main/kotlin/rsocketbuild/OptIns.kt b/build-logic/src/main/kotlin/rsocketbuild/OptIns.kt new file mode 100644 index 00000000..aa9e7229 --- /dev/null +++ b/build-logic/src/main/kotlin/rsocketbuild/OptIns.kt @@ -0,0 +1,29 @@ +/* + * 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. + */ + +package rsocketbuild + +@Suppress("ConstPropertyName") +object OptIns { + const val ExperimentalStdlibApi = "kotlin.ExperimentalStdlibApi" + const val ExperimentalCoroutinesApi = "kotlinx.coroutines.ExperimentalCoroutinesApi" + const val DelicateCoroutinesApi = "kotlinx.coroutines.DelicateCoroutinesApi" + + const val TransportApi = "io.rsocket.kotlin.TransportApi" + const val ExperimentalMetadataApi = "io.rsocket.kotlin.ExperimentalMetadataApi" + const val ExperimentalStreamsApi = "io.rsocket.kotlin.ExperimentalStreamsApi" + const val RSocketLoggingApi = "io.rsocket.kotlin.RSocketLoggingApi" +} diff --git a/build-logic/src/main/kotlin/rsocketbuild/targets.kt b/build-logic/src/main/kotlin/rsocketbuild/targets.kt new file mode 100644 index 00000000..3ef9d40e --- /dev/null +++ b/build-logic/src/main/kotlin/rsocketbuild/targets.kt @@ -0,0 +1,87 @@ +/* + * 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. + */ + +package rsocketbuild + +import org.gradle.jvm.toolchain.* +import org.gradle.kotlin.dsl.* +import org.jetbrains.kotlin.gradle.dsl.* + +fun KotlinMultiplatformExtension.appleTargets() { + macosX64() + macosArm64() + + iosArm64() + iosX64() + iosSimulatorArm64() + + watchosX64() + watchosArm32() + watchosArm64() + watchosSimulatorArm64() + // https://youtrack.jetbrains.com/issue/KTOR-6368, supported by kotlinx-io + // watchosDeviceArm64() + + tvosX64() + tvosArm64() + tvosSimulatorArm64() +} + +fun KotlinMultiplatformExtension.nixTargets() { + appleTargets() + linuxX64() + linuxArm64() +} + +fun KotlinMultiplatformExtension.nativeTargets() { + nixTargets() + mingwX64() + + // not supported by ktor, supported by kotlinx-io + // androidNativeX64() + // androidNativeX86() + // androidNativeArm64() + // androidNativeArm32() +} + +fun KotlinMultiplatformExtension.jsTarget( + supportsNode: Boolean = true, + supportsBrowser: Boolean = true, +) { + js { + if (supportsNode) nodejs() + if (supportsBrowser) browser() + } +} + +fun KotlinMultiplatformExtension.jvmTarget( + jdkVersion: Int = 8, + jdkAdditionalTestVersions: Set = setOf(11, 17, 21), +) { + jvmToolchain(jdkVersion) + jvm { + val javaToolchains = project.extensions.getByName("javaToolchains") + jdkAdditionalTestVersions.forEach { jdkTestVersion -> + testRuns.create("${jdkTestVersion}Test") { + executionTask.configure { + javaLauncher.set(javaToolchains.launcherFor { + languageVersion.set(JavaLanguageVersion.of(jdkTestVersion)) + }) + } + } + } + } +} diff --git a/build-logic/src/main/kotlin/rsocketbuild/tests/TestAggregation.kt b/build-logic/src/main/kotlin/rsocketbuild/tests/TestAggregation.kt new file mode 100644 index 00000000..b7b75200 --- /dev/null +++ b/build-logic/src/main/kotlin/rsocketbuild/tests/TestAggregation.kt @@ -0,0 +1,41 @@ +/* + * 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. + */ + +package rsocketbuild.tests + +import org.gradle.api.* +import org.gradle.api.tasks.* +import org.jetbrains.kotlin.gradle.dsl.* +import org.jetbrains.kotlin.gradle.plugin.* + +fun Project.registerTestAggregationTask( + name: String, + taskDependencies: () -> TaskCollection<*>, + targetFilter: (KotlinTarget) -> Boolean, +) { + extensions.configure("kotlin") { + var called = false + targets.matching(targetFilter).configureEach { + if (called) return@configureEach + called = true + + tasks.register(name) { + group = "verification" + dependsOn(taskDependencies()) + } + } + } +} diff --git a/gradle/plugins/build-logic/build.gradle.kts b/build-settings/build.gradle.kts similarity index 69% rename from gradle/plugins/build-logic/build.gradle.kts rename to build-settings/build.gradle.kts index 93ade50e..91d6be2e 100644 --- a/gradle/plugins/build-logic/build.gradle.kts +++ b/build-settings/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -18,11 +18,8 @@ plugins { `kotlin-dsl` } -kotlin { - jvmToolchain(8) -} - dependencies { - implementation(kotlinLibs.gradle.plugin) - implementation("rsocket.build:build-parameters") + implementation("com.gradle:gradle-enterprise-gradle-plugin:3.16.2") + implementation("com.gradle:common-custom-user-data-gradle-plugin:1.12.1") + implementation("org.gradle.toolchains:foojay-resolver:0.8.0") } diff --git a/gradle/plugins/kotlin-version-catalog/settings.gradle.kts b/build-settings/settings.gradle.kts similarity index 85% rename from gradle/plugins/kotlin-version-catalog/settings.gradle.kts rename to build-settings/settings.gradle.kts index 3761de2a..854373e2 100644 --- a/gradle/plugins/kotlin-version-catalog/settings.gradle.kts +++ b/build-settings/settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -16,18 +16,16 @@ pluginManagement { repositories { - gradlePluginPortal() mavenCentral() + gradlePluginPortal() } } dependencyResolutionManagement { repositories { - gradlePluginPortal() mavenCentral() + gradlePluginPortal() } } -rootProject.name = "kotlin-version-catalog" - -includeBuild("../build-parameters") +rootProject.name = "build-settings" diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.all.gradle.kts b/build-settings/src/main/kotlin/rsocketsettings.default.settings.gradle.kts similarity index 76% rename from gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.all.gradle.kts rename to build-settings/src/main/kotlin/rsocketsettings.default.settings.gradle.kts index 4d011bc0..83ea936f 100644 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.all.gradle.kts +++ b/build-settings/src/main/kotlin/rsocketsettings.default.settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -15,6 +15,7 @@ */ plugins { - id("rsocket.target.js.browser") - id("rsocket.target.js.node") + id("rsocketsettings.kotlin-version-override") + id("rsocketsettings.repositories") + id("rsocketsettings.gradle") } diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.library.gradle.kts b/build-settings/src/main/kotlin/rsocketsettings.gradle.settings.gradle.kts similarity index 62% rename from gradle/plugins/build-logic/src/main/kotlin/rsocket.template.library.gradle.kts rename to build-settings/src/main/kotlin/rsocketsettings.gradle.settings.gradle.kts index a3dd64d8..e26f398f 100644 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.library.gradle.kts +++ b/build-settings/src/main/kotlin/rsocketsettings.gradle.settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -15,18 +15,15 @@ */ plugins { - id("rsocket.multiplatform") - id("rsocket.publication") + id("com.gradle.enterprise") + id("com.gradle.common-custom-user-data-gradle-plugin") + id("org.gradle.toolchains.foojay-resolver-convention") } -kotlin { - explicitApi() - - sourceSets { - commonTest { - dependencies { - implementation(project(":rsocket-test")) - } - } +gradleEnterprise { + buildScan { + publishAlwaysIf(System.getenv("CI").toBoolean()) } } + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") diff --git a/build-settings/src/main/kotlin/rsocketsettings.kotlin-version-override.settings.gradle.kts b/build-settings/src/main/kotlin/rsocketsettings.kotlin-version-override.settings.gradle.kts new file mode 100644 index 00000000..cae276e0 --- /dev/null +++ b/build-settings/src/main/kotlin/rsocketsettings.kotlin-version-override.settings.gradle.kts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +@file:Suppress("UnstableApiUsage") + +val kotlinVersionOverride = providers.gradleProperty("rsocketbuild.kotlinVersionOverride").orNull?.takeIf(String::isNotBlank) + +if (kotlinVersionOverride != null) { + val kotlinDevRepository = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" + val kotlinGroup = "org.jetbrains.kotlin" + + logger.lifecycle("Kotlin version override: $kotlinVersionOverride, repository: $kotlinDevRepository") + + pluginManagement { + repositories { + maven(kotlinDevRepository) { + content { includeGroupAndSubgroups(kotlinGroup) } + } + } + } + + dependencyResolutionManagement { + repositories { + maven(kotlinDevRepository) { + content { includeGroupAndSubgroups(kotlinGroup) } + } + } + + versionCatalogs { + named("libs") { + version("kotlin", kotlinVersionOverride) + } + } + } +} diff --git a/gradle/plugins/build-parameters/settings.gradle.kts b/build-settings/src/main/kotlin/rsocketsettings.repositories.settings.gradle.kts similarity index 79% rename from gradle/plugins/build-parameters/settings.gradle.kts rename to build-settings/src/main/kotlin/rsocketsettings.repositories.settings.gradle.kts index e26ae4df..60646f00 100644 --- a/gradle/plugins/build-parameters/settings.gradle.kts +++ b/build-settings/src/main/kotlin/rsocketsettings.repositories.settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,11 +14,17 @@ * limitations under the License. */ +@file:Suppress("UnstableApiUsage") + pluginManagement { repositories { - gradlePluginPortal() mavenCentral() + gradlePluginPortal() } } -rootProject.name = "build-parameters" +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} diff --git a/build-settings/src/main/kotlin/rsocketsettings/ProjectsScope.kt b/build-settings/src/main/kotlin/rsocketsettings/ProjectsScope.kt new file mode 100644 index 00000000..6d1428f0 --- /dev/null +++ b/build-settings/src/main/kotlin/rsocketsettings/ProjectsScope.kt @@ -0,0 +1,52 @@ +/* + * 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. + */ + +package rsocketsettings + +import org.gradle.api.initialization.* + +fun Settings.projects(rootProjectName: String, block: ProjectsScope.() -> Unit) { + rootProject.name = rootProjectName + ProjectsScope(settings, emptyList(), emptyList()).apply(block) +} + +class ProjectsScope( + private val settings: Settings, + private val pathParts: List, + private val prefixParts: List, +) { + + fun module(name: String) { + val moduleName = (prefixParts + name).joinToString("-") + val modulePath = (pathParts + name).joinToString("/") + + settings.include(moduleName) + settings.project(":$moduleName").projectDir = settings.rootDir.resolve(modulePath) + } + + fun module(name: String, prefix: String? = name, nested: ProjectsScope.() -> Unit = {}) { + module(name) + folder(name, prefix, nested) + } + + fun folder(name: String, prefix: String? = name, block: ProjectsScope.() -> Unit) { + val prefixParts = when (prefix) { + null -> prefixParts + else -> prefixParts + prefix + } + ProjectsScope(settings, pathParts + name, prefixParts).apply(block) + } +} diff --git a/build.gradle.kts b/build.gradle.kts index 18fcdf0b..02e769d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -17,20 +17,15 @@ import org.jetbrains.kotlin.gradle.targets.js.yarn.* buildscript { - repositories { - mavenCentral() - } - dependencies { // kotlinx.atomicfu should be on classpath // it's an implementation detail of kotlinx.atomicfu gradle plugin - classpath(kotlinLibs.gradle.plugin) - classpath(libs.build.kotlinx.atomicfu) + classpath(libs.kotlin.gradle.plugin) + classpath(libs.kotlinx.atomicfu.gradle.plugin) } } plugins { - id("build-parameters") // for now BCV uses `allProjects` internally, so we can't apply it just to specific subprojects alias(libs.plugins.kotlinx.bcv) } diff --git a/gradle.properties b/gradle.properties index ade889c4..f5ceb4f0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,10 +16,12 @@ group=io.rsocket.kotlin version=0.16.0-SNAPSHOT #Kotlin +kotlin.mpp.import.enableKgpDependencyResolution=true +kotlin.native.ignoreDisabledTargets=true kotlin.native.ignoreIncorrectDependencies=true kotlinx.atomicfu.enableJvmIrTransformation=true kotlinx.atomicfu.enableJsIrTransformation=true -kotlinx.atomicfu.enableNativeIrTransformations=true +kotlinx.atomicfu.enableNativeIrTransformation=true #Gradle org.gradle.jvmargs=-Xmx2g org.gradle.parallel=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6955e3d4..c03b110c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,4 +1,6 @@ [versions] +kotlin = "1.9.22" + kotlinx-atomicfu = "0.23.2" kotlinx-coroutines = "1.8.0" kotlinx-benchmark = "0.4.8" @@ -17,7 +19,6 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" } -kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "kotlinx-atomicfu" } kotlinx-benchmark = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" } @@ -41,8 +42,12 @@ turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } rsocket-java-core = { module = 'io.rsocket:rsocket-core', version.ref = "rsocket-java" } rsocket-java-transport-local = { module = 'io.rsocket:rsocket-transport-local', version.ref = "rsocket-java" } -build-kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "kotlinx-atomicfu" } +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlinx-atomicfu-gradle-plugin = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "kotlinx-atomicfu" } [plugins] +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } + + kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } kotlinx-bcv = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinx-bcv" } diff --git a/gradle/plugins/build-logic/src/main/kotlin/TestOptIn.kt b/gradle/plugins/build-logic/src/main/kotlin/TestOptIn.kt deleted file mode 100644 index 704ae4f1..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/TestOptIn.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2015-2023 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.plugin.* - -//TODO may be remove part of annotations -fun LanguageSettingsBuilder.optInForTest() { - optIn("kotlin.time.ExperimentalTime") - optIn("kotlin.ExperimentalStdlibApi") - - optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") - optIn("kotlinx.coroutines.InternalCoroutinesApi") - optIn("kotlinx.coroutines.ObsoleteCoroutinesApi") - optIn("kotlinx.coroutines.FlowPreview") - optIn("kotlinx.coroutines.DelicateCoroutinesApi") - - optIn("io.rsocket.kotlin.TransportApi") - optIn("io.rsocket.kotlin.ExperimentalMetadataApi") - optIn("io.rsocket.kotlin.ExperimentalStreamsApi") - optIn("io.rsocket.kotlin.RSocketLoggingApi") -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.multiplatform.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.multiplatform.gradle.kts deleted file mode 100644 index ed170ca3..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.multiplatform.gradle.kts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ - -plugins { - kotlin("multiplatform") - id("build-parameters") -} - -kotlin { - jvmToolchain(8) - - targets.configureEach { - compilations.configureEach { - compilerOptions.configure { - freeCompilerArgs.add("-Xrender-internal-diagnostic-names") - } - } - } - - sourceSets.configureEach { - languageSettings { - progressiveMode = true - if (name.contains("test", ignoreCase = true)) optInForTest() - } - } -} - -val buildParameters = the() -if (buildParameters.skip.test) tasks.matching { it.name.endsWith("test", ignoreCase = true) }.configureEach { onlyIf { false } } -if (buildParameters.skip.link) tasks.matching { it.name.startsWith("link", ignoreCase = true) }.configureEach { onlyIf { false } } diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.multiplatform.native.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.multiplatform.native.gradle.kts deleted file mode 100644 index e7a014d8..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.multiplatform.native.gradle.kts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2015-2023 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.plugin.mpp.* - -plugins { - id("rsocket.multiplatform") -} - -kotlin { - targets.configureEach { - //add another test task with release binary - if (this is KotlinNativeTargetWithTests<*>) { - binaries.test(listOf(NativeBuildType.RELEASE)) - testRuns.create("releaseTest") { - setExecutionSourceFrom(binaries.getTest(NativeBuildType.RELEASE)) - } - } - } -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.publication.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.publication.gradle.kts deleted file mode 100644 index 744c0d90..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.publication.gradle.kts +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - `maven-publish` - signing - id("build-parameters") -} - -val buildParameters = the() - -val versionSuffix = buildParameters.versionSuffix.orNull -if (versionSuffix != null) { - val versionString = project.version.toString() - require(versionString.endsWith("-SNAPSHOT")) - project.version = versionString.replace("-", "-${versionSuffix}-") - println("Current version: ${project.version}") -} - -//empty javadoc for maven central -val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") } - -// this is somewhat a hack because we have a single javadoc artifact which is used for all publications -val signTasks = tasks.withType() -signTasks.configureEach { dependsOn(javadocJar) } -tasks.withType().configureEach { dependsOn(signTasks) } - -publishing { - publications.withType { - artifact(javadocJar.get()) - - afterEvaluate { - pom { - name.set(project.name) - description.set(project.description) - url.set("http://rsocket.io") - - licenses { - license { - name.set("The Apache Software License, Version 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") - distribution.set("repo") - } - } - developers { - developer { - id.set("whyoleg") - name.set("Oleg Yukhnevich") - email.set("whyoleg@gmail.com") - } - developer { - id.set("OlegDokuka") - name.set("Oleh Dokuka") - email.set("oleh.dokuka@icloud.com") - } - } - scm { - connection.set("https://github.com/rsocket/rsocket-kotlin.git") - developerConnection.set("https://github.com/rsocket/rsocket-kotlin.git") - url.set("https://github.com/rsocket/rsocket-kotlin") - } - } - } - } - - //TODO: move to build parameters - val githubUsername: String? by project - val githubPassword: String? by project - - val sonatypeUsername: String? by project - val sonatypePassword: String? by project - - val signingKey: String? by project - val signingPassword: String? by project - - repositories { - //TODO: drop github and use sonatype (?) - maven { - name = "github" - url = uri("https://maven.pkg.github.com/rsocket/rsocket-kotlin") - credentials { - username = githubUsername - password = githubPassword - } - } - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") - credentials { - username = sonatypeUsername - password = sonatypePassword - } - } - } - - signing { - isRequired = sonatypeUsername != null && sonatypePassword != null && - signingKey != null && signingPassword != null - - useInMemoryPgpKeys(signingKey, signingPassword) - sign(publications) - } -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.all.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.all.gradle.kts deleted file mode 100644 index ce156dfa..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.all.gradle.kts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.target.js.all") - id("rsocket.target.jvm") - id("rsocket.target.native.all") -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.browser.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.browser.gradle.kts deleted file mode 100644 index 80af963d..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.browser.gradle.kts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.multiplatform") -} - -kotlin { - js { - browser { - testTask { - useKarma { - useConfigDirectory(rootDir.resolve("gradle/js/karma.config.d")) - useChromeHeadless() - } - } - } - } -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.node.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.node.gradle.kts deleted file mode 100644 index a1a8c155..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.node.gradle.kts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.multiplatform") -} - -kotlin { - js { - nodejs { - testTask { - useMocha { - timeout = "600s" - } - } - } - } -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.jvm.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.jvm.gradle.kts deleted file mode 100644 index 59a4842f..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.jvm.gradle.kts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.multiplatform") -} - -kotlin { - jvm { - listOf(11, 17, 20).forEach { jdkVersion -> - testRuns.create("${jdkVersion}Test") { - executionTask.configure { - javaLauncher.set( - javaToolchains.launcherFor { - languageVersion.set(JavaLanguageVersion.of(jdkVersion)) - } - ) - } - } - } - testRuns.configureEach { - executionTask.configure { - // ActiveProcessorCount is used here, to make sure local setup is similar as on CI - // GitHub Actions linux runners have 2 cores - jvmArgs("-Xmx1g", "-XX:ActiveProcessorCount=2") - } - } - } -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.all.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.all.gradle.kts deleted file mode 100644 index bb744e9c..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.all.gradle.kts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.target.native.nix") -} - -kotlin { - mingwX64() -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.apple.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.apple.gradle.kts deleted file mode 100644 index 9e85d2e4..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.target.native.apple.gradle.kts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.multiplatform.native") -} - -kotlin { - macosX64() - macosArm64() - - iosArm64() - iosX64() - iosSimulatorArm64() - - tvosArm64() - tvosX64() - tvosSimulatorArm64() - - //TODO: after coroutines 1.7.0 add watchosDeviceArm64() - watchosArm32() - watchosArm64() - watchosX64() - watchosSimulatorArm64() -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.test.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.test.gradle.kts deleted file mode 100644 index 0eaf4eba..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.test.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.multiplatform") -} - -kotlin { - sourceSets.configureEach { - languageSettings.optInForTest() - } -} diff --git a/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.transport.gradle.kts b/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.transport.gradle.kts deleted file mode 100644 index ff096347..00000000 --- a/gradle/plugins/build-logic/src/main/kotlin/rsocket.template.transport.gradle.kts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("rsocket.template.library") -} - -kotlin { - sourceSets { - commonTest { - dependencies { - implementation(project(":rsocket-transport-tests")) - } - } - } -} diff --git a/gradle/plugins/build-parameters/build.gradle.kts b/gradle/plugins/build-parameters/build.gradle.kts deleted file mode 100644 index dfe9a25d..00000000 --- a/gradle/plugins/build-parameters/build.gradle.kts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2015-2023 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. - */ - -plugins { - id("org.gradlex.build-parameters") version "1.4.3" -} - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) - } -} - -group = "rsocket.build" - -buildParameters { - enableValidation.set(false) - string("version") - string("versionSuffix") - string("useKotlin") - - string("githubUsername") - string("githubPassword") - - group("skip") { - bool("test") { - description.set("Skip running tests") - defaultValue.set(false) - } - bool("link") { - description.set("Skip linking native binaries") - defaultValue.set(false) - } - } -} diff --git a/gradle/plugins/kotlin-version-catalog/src/main/kotlin/kotlin-version-catalog.settings.gradle.kts b/gradle/plugins/kotlin-version-catalog/src/main/kotlin/kotlin-version-catalog.settings.gradle.kts deleted file mode 100644 index f116b18e..00000000 --- a/gradle/plugins/kotlin-version-catalog/src/main/kotlin/kotlin-version-catalog.settings.gradle.kts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - -plugins { - id("build-parameters") -} - -val kotlinVersion = "1.9.22" -val kotlinVersionOverride = the().useKotlin.orNull?.takeIf(String::isNotBlank) - -if (kotlinVersionOverride != null) logger.lifecycle("Kotlin version override: $kotlinVersionOverride") - -pluginManagement { - if (kotlinVersionOverride != null) repositories { - maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") - } -} - -dependencyResolutionManagement { - if (kotlinVersionOverride != null) repositories { - maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") - } - versionCatalogs { - create("kotlinLibs") { - val kotlin = version("kotlin", kotlinVersionOverride ?: kotlinVersion) - - library("gradle-plugin", "org.jetbrains.kotlin", "kotlin-gradle-plugin").versionRef(kotlin) - - plugin("multiplatform", "org.jetbrains.kotlin.multiplatform").versionRef(kotlin) - plugin("jvm", "org.jetbrains.kotlin.jvm").versionRef(kotlin) - plugin("plugin.serialization", "org.jetbrains.kotlin.plugin.serialization").versionRef(kotlin) - plugin("plugin.allopen", "org.jetbrains.kotlin.plugin.allopen").versionRef(kotlin) - } - } -} diff --git a/rsocket-core/api/rsocket-core.api b/rsocket-core/api/rsocket-core.api index 95c6e159..d1a9ac27 100644 --- a/rsocket-core/api/rsocket-core.api +++ b/rsocket-core/api/rsocket-core.api @@ -3,7 +3,6 @@ public final class io/rsocket/kotlin/ChannelStrategy : io/rsocket/kotlin/Request public fun firstRequest (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun fold (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public fun get (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element; - public fun getKey ()Lkotlin/coroutines/CoroutineContext$Key; public fun minusKey (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext; public fun nextRequest (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun plus (Lkotlin/coroutines/CoroutineContext;)Lkotlin/coroutines/CoroutineContext; @@ -40,26 +39,20 @@ public final class io/rsocket/kotlin/PrefetchStrategy : io/rsocket/kotlin/Reques public fun (II)V public fun fold (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public fun get (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element; - public fun getKey ()Lkotlin/coroutines/CoroutineContext$Key; public fun minusKey (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext; public fun plus (Lkotlin/coroutines/CoroutineContext;)Lkotlin/coroutines/CoroutineContext; public fun provide ()Lio/rsocket/kotlin/RequestStrategy$Element; } public abstract interface class io/rsocket/kotlin/RSocket : kotlinx/coroutines/CoroutineScope { - public abstract fun fireAndForget (Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun metadataPush (Lio/ktor/utils/io/core/ByteReadPacket;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun requestChannel (Lio/rsocket/kotlin/payload/Payload;Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow; - public abstract fun requestResponse (Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun requestStream (Lio/rsocket/kotlin/payload/Payload;)Lkotlinx/coroutines/flow/Flow; -} - -public final class io/rsocket/kotlin/RSocket$DefaultImpls { - public static fun fireAndForget (Lio/rsocket/kotlin/RSocket;Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun metadataPush (Lio/rsocket/kotlin/RSocket;Lio/ktor/utils/io/core/ByteReadPacket;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun requestChannel (Lio/rsocket/kotlin/RSocket;Lio/rsocket/kotlin/payload/Payload;Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow; - public static fun requestResponse (Lio/rsocket/kotlin/RSocket;Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun requestStream (Lio/rsocket/kotlin/RSocket;Lio/rsocket/kotlin/payload/Payload;)Lkotlinx/coroutines/flow/Flow; + public fun fireAndForget (Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun fireAndForget$suspendImpl (Lio/rsocket/kotlin/RSocket;Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun metadataPush (Lio/ktor/utils/io/core/ByteReadPacket;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun metadataPush$suspendImpl (Lio/rsocket/kotlin/RSocket;Lio/ktor/utils/io/core/ByteReadPacket;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun requestChannel (Lio/rsocket/kotlin/payload/Payload;Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow; + public fun requestResponse (Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun requestResponse$suspendImpl (Lio/rsocket/kotlin/RSocket;Lio/rsocket/kotlin/payload/Payload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun requestStream (Lio/rsocket/kotlin/payload/Payload;)Lkotlinx/coroutines/flow/Flow; } public abstract class io/rsocket/kotlin/RSocketError : java/lang/Throwable { @@ -144,14 +137,13 @@ public final class io/rsocket/kotlin/RSocketRequestHandlerKt { public abstract interface class io/rsocket/kotlin/RequestStrategy : kotlin/coroutines/CoroutineContext$Element { public static final field Key Lio/rsocket/kotlin/RequestStrategy$Key; - public abstract fun getKey ()Lkotlin/coroutines/CoroutineContext$Key; + public fun getKey ()Lkotlin/coroutines/CoroutineContext$Key; public abstract fun provide ()Lio/rsocket/kotlin/RequestStrategy$Element; } public final class io/rsocket/kotlin/RequestStrategy$DefaultImpls { public static fun fold (Lio/rsocket/kotlin/RequestStrategy;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public static fun get (Lio/rsocket/kotlin/RequestStrategy;Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element; - public static fun getKey (Lio/rsocket/kotlin/RequestStrategy;)Lkotlin/coroutines/CoroutineContext$Key; public static fun minusKey (Lio/rsocket/kotlin/RequestStrategy;Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext; public static fun plus (Lio/rsocket/kotlin/RequestStrategy;Lkotlin/coroutines/CoroutineContext;)Lkotlin/coroutines/CoroutineContext; } @@ -413,16 +405,10 @@ public final class io/rsocket/kotlin/logging/PrintLogger$Companion : io/rsocket/ public abstract interface class io/rsocket/kotlin/metadata/CompositeMetadata : io/rsocket/kotlin/metadata/Metadata { public static final field Reader Lio/rsocket/kotlin/metadata/CompositeMetadata$Reader; - public abstract fun close ()V + public fun close ()V public abstract fun getEntries ()Ljava/util/List; - public abstract fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; - public abstract fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V -} - -public final class io/rsocket/kotlin/metadata/CompositeMetadata$DefaultImpls { - public static fun close (Lio/rsocket/kotlin/metadata/CompositeMetadata;)V - public static fun getMimeType (Lio/rsocket/kotlin/metadata/CompositeMetadata;)Lio/rsocket/kotlin/core/MimeType; - public static fun writeSelf (Lio/rsocket/kotlin/metadata/CompositeMetadata;Lio/ktor/utils/io/core/BytePacketBuilder;)V + public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; + public fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V } public final class io/rsocket/kotlin/metadata/CompositeMetadata$Entry { @@ -468,10 +454,7 @@ public final class io/rsocket/kotlin/metadata/CompositeMetadataFromBuilder : io/ public fun ()V public fun add (Lio/rsocket/kotlin/core/MimeType;Lio/ktor/utils/io/core/ByteReadPacket;)V public fun add (Lio/rsocket/kotlin/metadata/Metadata;)V - public fun close ()V public fun getEntries ()Ljava/util/List; - public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; - public fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V } public final class io/rsocket/kotlin/metadata/CompositeMetadataKt { @@ -603,28 +586,19 @@ public final class io/rsocket/kotlin/metadata/ZipkinTracingMetadataKt { } public abstract interface class io/rsocket/kotlin/metadata/security/AuthMetadata : io/rsocket/kotlin/metadata/Metadata { - public abstract fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; + public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; public abstract fun getType ()Lio/rsocket/kotlin/metadata/security/AuthType; public abstract fun writeContent (Lio/ktor/utils/io/core/BytePacketBuilder;)V - public abstract fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V -} - -public final class io/rsocket/kotlin/metadata/security/AuthMetadata$DefaultImpls { - public static fun getMimeType (Lio/rsocket/kotlin/metadata/security/AuthMetadata;)Lio/rsocket/kotlin/core/MimeType; - public static fun writeSelf (Lio/rsocket/kotlin/metadata/security/AuthMetadata;Lio/ktor/utils/io/core/BytePacketBuilder;)V + public fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V } public abstract interface class io/rsocket/kotlin/metadata/security/AuthMetadataReader : io/rsocket/kotlin/metadata/MetadataReader { - public abstract fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; - public abstract fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; + public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; + public synthetic fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/Metadata; + public fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; public abstract fun readContent-FTxoUho (Lio/ktor/utils/io/core/ByteReadPacket;Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; } -public final class io/rsocket/kotlin/metadata/security/AuthMetadataReader$DefaultImpls { - public static fun getMimeType (Lio/rsocket/kotlin/metadata/security/AuthMetadataReader;)Lio/rsocket/kotlin/core/MimeType; - public static fun read-sXCisgc (Lio/rsocket/kotlin/metadata/security/AuthMetadataReader;Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; -} - public abstract interface class io/rsocket/kotlin/metadata/security/AuthType { } @@ -640,18 +614,12 @@ public final class io/rsocket/kotlin/metadata/security/BearerAuthMetadata : io/r public static final field Reader Lio/rsocket/kotlin/metadata/security/BearerAuthMetadata$Reader; public fun (Ljava/lang/String;)V public fun close ()V - public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; public final fun getToken ()Ljava/lang/String; public fun getType ()Lio/rsocket/kotlin/metadata/security/AuthType; public fun writeContent (Lio/ktor/utils/io/core/BytePacketBuilder;)V - public fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V } public final class io/rsocket/kotlin/metadata/security/BearerAuthMetadata$Reader : io/rsocket/kotlin/metadata/security/AuthMetadataReader { - public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; - public synthetic fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/Metadata; - public synthetic fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; - public fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/BearerAuthMetadata; public synthetic fun readContent-FTxoUho (Lio/ktor/utils/io/core/ByteReadPacket;Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; public fun readContent-FTxoUho (Lio/ktor/utils/io/core/ByteReadPacket;Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/BearerAuthMetadata; } @@ -672,17 +640,11 @@ public final class io/rsocket/kotlin/metadata/security/RawAuthMetadata : io/rsoc public fun (Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/core/ByteReadPacket;)V public fun close ()V public final fun getContent ()Lio/ktor/utils/io/core/ByteReadPacket; - public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; public fun getType ()Lio/rsocket/kotlin/metadata/security/AuthType; public fun writeContent (Lio/ktor/utils/io/core/BytePacketBuilder;)V - public fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V } public final class io/rsocket/kotlin/metadata/security/RawAuthMetadata$Reader : io/rsocket/kotlin/metadata/security/AuthMetadataReader { - public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; - public synthetic fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/Metadata; - public synthetic fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; - public fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/RawAuthMetadata; public synthetic fun readContent-FTxoUho (Lio/ktor/utils/io/core/ByteReadPacket;Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; public fun readContent-FTxoUho (Lio/ktor/utils/io/core/ByteReadPacket;Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/RawAuthMetadata; } @@ -710,19 +672,13 @@ public final class io/rsocket/kotlin/metadata/security/SimpleAuthMetadata : io/r public static final field Reader Lio/rsocket/kotlin/metadata/security/SimpleAuthMetadata$Reader; public fun (Ljava/lang/String;Ljava/lang/String;)V public fun close ()V - public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; public final fun getPassword ()Ljava/lang/String; public fun getType ()Lio/rsocket/kotlin/metadata/security/AuthType; public final fun getUsername ()Ljava/lang/String; public fun writeContent (Lio/ktor/utils/io/core/BytePacketBuilder;)V - public fun writeSelf (Lio/ktor/utils/io/core/BytePacketBuilder;)V } public final class io/rsocket/kotlin/metadata/security/SimpleAuthMetadata$Reader : io/rsocket/kotlin/metadata/security/AuthMetadataReader { - public fun getMimeType ()Lio/rsocket/kotlin/core/MimeType; - public synthetic fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/Metadata; - public synthetic fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; - public fun read-sXCisgc (Lio/ktor/utils/io/core/ByteReadPacket;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/SimpleAuthMetadata; public synthetic fun readContent-FTxoUho (Lio/ktor/utils/io/core/ByteReadPacket;Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/AuthMetadata; public fun readContent-FTxoUho (Lio/ktor/utils/io/core/ByteReadPacket;Lio/rsocket/kotlin/metadata/security/AuthType;Lio/ktor/utils/io/pool/ObjectPool;)Lio/rsocket/kotlin/metadata/security/SimpleAuthMetadata; } @@ -746,8 +702,8 @@ public final class io/rsocket/kotlin/metadata/security/WellKnowAuthType$Companio public abstract interface class io/rsocket/kotlin/payload/Payload : java/io/Closeable { public static final field Companion Lio/rsocket/kotlin/payload/Payload$Companion; - public abstract fun close ()V - public abstract fun copy ()Lio/rsocket/kotlin/payload/Payload; + public fun close ()V + public fun copy ()Lio/rsocket/kotlin/payload/Payload; public abstract fun getData ()Lio/ktor/utils/io/core/ByteReadPacket; public abstract fun getMetadata ()Lio/ktor/utils/io/core/ByteReadPacket; } @@ -756,11 +712,6 @@ public final class io/rsocket/kotlin/payload/Payload$Companion { public final fun getEmpty ()Lio/rsocket/kotlin/payload/Payload; } -public final class io/rsocket/kotlin/payload/Payload$DefaultImpls { - public static fun close (Lio/rsocket/kotlin/payload/Payload;)V - public static fun copy (Lio/rsocket/kotlin/payload/Payload;)Lio/rsocket/kotlin/payload/Payload; -} - public abstract interface class io/rsocket/kotlin/payload/PayloadBuilder : java/io/Closeable { public abstract fun data (Lio/ktor/utils/io/core/ByteReadPacket;)V public abstract fun metadata (Lio/ktor/utils/io/core/ByteReadPacket;)V @@ -779,8 +730,6 @@ public final class io/rsocket/kotlin/payload/PayloadBuilderKt { public final class io/rsocket/kotlin/payload/PayloadFromBuilder : io/rsocket/kotlin/payload/Payload, io/rsocket/kotlin/payload/PayloadBuilder { public fun ()V public final fun build ()Lio/rsocket/kotlin/payload/Payload; - public fun close ()V - public fun copy ()Lio/rsocket/kotlin/payload/Payload; public fun data (Lio/ktor/utils/io/core/ByteReadPacket;)V public fun getData ()Lio/ktor/utils/io/core/ByteReadPacket; public fun getMetadata ()Lio/ktor/utils/io/core/ByteReadPacket; @@ -804,11 +753,7 @@ public final class io/rsocket/kotlin/payload/PayloadMimeTypeKt { public abstract interface class io/rsocket/kotlin/transport/ClientTransport : kotlinx/coroutines/CoroutineScope { public abstract fun connect (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun getCoroutineContext ()Lkotlin/coroutines/CoroutineContext; -} - -public final class io/rsocket/kotlin/transport/ClientTransport$DefaultImpls { - public static fun getCoroutineContext (Lio/rsocket/kotlin/transport/ClientTransport;)Lkotlin/coroutines/CoroutineContext; + public fun getCoroutineContext ()Lkotlin/coroutines/CoroutineContext; } public final class io/rsocket/kotlin/transport/ClientTransportKt { diff --git a/rsocket-core/build.gradle.kts b/rsocket-core/build.gradle.kts index f7bfabfb..c7b99d29 100644 --- a/rsocket-core/build.gradle.kts +++ b/rsocket-core/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,28 +14,30 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.library") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") id("kotlinx-atomicfu") } +description = "rsocket-kotlin core functionality" + kotlin { + jvmTarget() + jsTarget() + nativeTargets() + sourceSets { - commonMain { - dependencies { - implementation(projects.rsocketInternalIo) + commonMain.dependencies { + implementation(projects.rsocketInternalIo) - api(libs.kotlinx.coroutines.core) - api(libs.ktor.io) - } + api(libs.kotlinx.coroutines.core) + api(libs.ktor.io) } - commonTest { - dependencies { - implementation(projects.rsocketTransportLocal) - } + commonTest.dependencies { + implementation(projects.rsocketTest) + implementation(projects.rsocketTransportLocal) } } } - -description = "RSocket core functionality" diff --git a/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/ConnectionEstablishmentTest.kt b/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/ConnectionEstablishmentTest.kt index db037c66..69eee240 100644 --- a/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/ConnectionEstablishmentTest.kt +++ b/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/ConnectionEstablishmentTest.kt @@ -70,6 +70,7 @@ class ConnectionEstablishmentTest : SuspendTest, TestWithLeakCheck { assertEquals(errorMessage, error.message) } connection.coroutineContext.job.join() + @OptIn(InternalCoroutinesApi::class) val error = connection.coroutineContext.job.getCancellationException().cause assertTrue(error is RSocketError.Setup.Rejected) assertEquals(errorMessage, error.message) diff --git a/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/internal/RSocketRequesterTest.kt b/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/internal/RSocketRequesterTest.kt index e51c2d55..bd2b7499 100644 --- a/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/internal/RSocketRequesterTest.kt +++ b/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/internal/RSocketRequesterTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -254,6 +254,7 @@ class RSocketRequesterTest : TestWithConnection(), TestWithLeakCheck { connection.sendToReceiver(ErrorFrame(0, RSocketError.Setup.Rejected(errorMessage))) delay(100) assertFalse(requester.isActive) + @OptIn(InternalCoroutinesApi::class) val error = requester.coroutineContext.job.getCancellationException().cause assertTrue(error is RSocketError.Setup.Rejected) assertEquals(errorMessage, error.message) diff --git a/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/keepalive/KeepAliveTest.kt b/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/keepalive/KeepAliveTest.kt index e60d1631..312541d3 100644 --- a/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/keepalive/KeepAliveTest.kt +++ b/rsocket-core/src/commonTest/kotlin/io/rsocket/kotlin/keepalive/KeepAliveTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -102,6 +102,7 @@ class KeepAliveTest : TestWithConnection(), TestWithLeakCheck { connection.test { while (rSocket.isActive) kotlin.runCatching { awaitItem() } } + @OptIn(InternalCoroutinesApi::class) assertTrue(rSocket.coroutineContext.job.getCancellationException().cause is RSocketError.ConnectionError) } diff --git a/rsocket-internal-io/build.gradle.kts b/rsocket-internal-io/build.gradle.kts index d636b4d7..a978c9b7 100644 --- a/rsocket-internal-io/build.gradle.kts +++ b/rsocket-internal-io/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,20 +14,23 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.library") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin internal IO support" + kotlin { + jvmTarget() + jsTarget() + nativeTargets() + sourceSets { - commonMain { - dependencies { - api(libs.kotlinx.coroutines.core) - api(libs.ktor.io) - } + commonMain.dependencies { + api(libs.kotlinx.coroutines.core) + api(libs.ktor.io) } } } - -description = "rsocket-kotlin internal IO support" diff --git a/rsocket-ktor/build.gradle.kts b/rsocket-ktor/build.gradle.kts index c88b0594..c05a438d 100644 --- a/rsocket-ktor/build.gradle.kts +++ b/rsocket-ktor/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,21 +14,24 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.library") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor integration" + kotlin { + jvmTarget() + jsTarget() + nativeTargets() + sourceSets { - commonMain { - dependencies { - api(projects.rsocketCore) - api(projects.rsocketTransportKtor.rsocketTransportKtorWebsocket) - //TODO ContentNegotiation will be here later - } + commonMain.dependencies { + api(projects.rsocketCore) + api(projects.rsocketTransportKtorWebsocket) + //TODO ContentNegotiation will be here later } } } - -description = "RSocket ktor integration" diff --git a/rsocket-ktor/rsocket-ktor-client/build.gradle.kts b/rsocket-ktor/rsocket-ktor-client/build.gradle.kts index 910df58e..df4db279 100644 --- a/rsocket-ktor/rsocket-ktor-client/build.gradle.kts +++ b/rsocket-ktor/rsocket-ktor-client/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,20 +14,23 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.library") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor client plugin" + kotlin { + jvmTarget() + jsTarget() + nativeTargets() + sourceSets { - commonMain { - dependencies { - api(projects.rsocketKtor) - api(libs.ktor.client.websockets) - } + commonMain.dependencies { + api(projects.rsocketKtor) + api(libs.ktor.client.websockets) } } } - -description = "RSocket ktor client plugin" diff --git a/rsocket-ktor/rsocket-ktor-server/build.gradle.kts b/rsocket-ktor/rsocket-ktor-server/build.gradle.kts index 8f3ad93c..32a1f6a8 100644 --- a/rsocket-ktor/rsocket-ktor-server/build.gradle.kts +++ b/rsocket-ktor/rsocket-ktor-server/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,29 +14,28 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.library") - id("rsocket.target.jvm") - id("rsocket.target.native.nix") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor server plugin" + kotlin { + jvmTarget() + nixTargets() + sourceSets { - commonMain { - dependencies { - api(projects.rsocketKtor) - api(libs.ktor.server.websockets) - } + commonMain.dependencies { + api(projects.rsocketKtor) + api(libs.ktor.server.websockets) } - commonTest { - dependencies { - implementation(projects.rsocketKtor.rsocketKtorClient) - implementation(projects.rsocketTransportTests) //port provider - implementation(libs.ktor.client.cio) - implementation(libs.ktor.server.cio) - } + commonTest.dependencies { + implementation(projects.rsocketKtorClient) + implementation(projects.rsocketTransportTests) //port provider + implementation(libs.ktor.client.cio) + implementation(libs.ktor.server.cio) } } } - -description = "RSocket ktor server plugin" diff --git a/rsocket-test/build.gradle.kts b/rsocket-test/build.gradle.kts index 8aa48c22..1357cedb 100644 --- a/rsocket-test/build.gradle.kts +++ b/rsocket-test/build.gradle.kts @@ -15,39 +15,48 @@ */ import org.jetbrains.kotlin.gradle.* +import rsocketbuild.* plugins { - id("rsocket.template.test") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-base") id("kotlinx-atomicfu") } @OptIn(ExperimentalKotlinGradlePluginApi::class) kotlin { + jvmTarget() + jsTarget() + nativeTargets() + compilerOptions { freeCompilerArgs.add("-Xexpect-actual-classes") + optIn.addAll( + OptIns.ExperimentalStdlibApi, + OptIns.ExperimentalCoroutinesApi, + OptIns.DelicateCoroutinesApi, + + OptIns.RSocketLoggingApi, + ) } sourceSets { - commonMain { - dependencies { - api(kotlin("test")) - api(projects.rsocketCore) - implementation(projects.rsocketInternalIo) - - api(libs.kotlinx.coroutines.test) - api(libs.turbine) - } + commonMain.dependencies { + implementation(projects.rsocketInternalIo) + api(projects.rsocketCore) + + api(libs.kotlinx.coroutines.test) + api(libs.turbine) + } + + // expose kotlin-test + commonMain.dependencies { + api(kotlin("test")) } - jvmMain { - dependencies { - api(kotlin("test-junit")) - } + jvmMain.dependencies { + api(kotlin("test-junit")) } - jsMain { - dependencies { - api(kotlin("test-js")) - } + jsMain.dependencies { + api(kotlin("test-js")) } } } diff --git a/rsocket-transport-ktor/build.gradle.kts b/rsocket-transport-ktor/build.gradle.kts index c8da75fc..0fd2e007 100644 --- a/rsocket-transport-ktor/build.gradle.kts +++ b/rsocket-transport-ktor/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,19 +14,22 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.transport") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor transport utilities" + kotlin { + jvmTarget() + jsTarget() + nativeTargets() + sourceSets { - commonMain { - dependencies { - api(projects.rsocketCore) - } + commonMain.dependencies { + api(projects.rsocketCore) } } } - -description = "RSocket ktor transport utilities" diff --git a/rsocket-transport-ktor/rsocket-transport-ktor-tcp/build.gradle.kts b/rsocket-transport-ktor/rsocket-transport-ktor-tcp/build.gradle.kts index 4ed03fb4..8b6077b6 100644 --- a/rsocket-transport-ktor/rsocket-transport-ktor-tcp/build.gradle.kts +++ b/rsocket-transport-ktor/rsocket-transport-ktor-tcp/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,23 +14,27 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.transport") - id("rsocket.target.jvm") - id("rsocket.target.native.nix") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor TCP client/server transport implementation" + kotlin { + jvmTarget() + nixTargets() + sourceSets { - commonMain { - dependencies { - implementation(projects.rsocketInternalIo) + commonMain.dependencies { + implementation(projects.rsocketInternalIo) - api(projects.rsocketTransportKtor) - api(libs.ktor.network) - } + api(projects.rsocketTransportKtor) + api(libs.ktor.network) + } + commonTest.dependencies { + implementation(projects.rsocketTransportTests) } } } - -description = "RSocket ktor TCP client/server transport implementation" diff --git a/rsocket-transport-ktor/rsocket-transport-ktor-websocket-client/build.gradle.kts b/rsocket-transport-ktor/rsocket-transport-ktor-websocket-client/build.gradle.kts index fd581fb3..32d5cc81 100644 --- a/rsocket-transport-ktor/rsocket-transport-ktor-websocket-client/build.gradle.kts +++ b/rsocket-transport-ktor/rsocket-transport-ktor-websocket-client/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,21 +14,24 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.transport") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor WebSocket client transport implementation" + kotlin { + jvmTarget() + jsTarget() + nativeTargets() + sourceSets { - commonMain { - dependencies { - api(projects.rsocketTransportKtor.rsocketTransportKtorWebsocket) - api(libs.ktor.client.core) - api(libs.ktor.client.websockets) - } + commonMain.dependencies { + api(projects.rsocketTransportKtorWebsocket) + api(libs.ktor.client.core) + api(libs.ktor.client.websockets) } } } - -description = "RSocket ktor WebSocket client transport implementation" diff --git a/rsocket-transport-ktor/rsocket-transport-ktor-websocket-server/build.gradle.kts b/rsocket-transport-ktor/rsocket-transport-ktor-websocket-server/build.gradle.kts index f28d6934..ae3360cc 100644 --- a/rsocket-transport-ktor/rsocket-transport-ktor-websocket-server/build.gradle.kts +++ b/rsocket-transport-ktor/rsocket-transport-ktor-websocket-server/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,38 +14,35 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.transport") - id("rsocket.target.jvm") - id("rsocket.target.native.nix") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor WebSocket server transport implementation" + kotlin { + jvmTarget() + nixTargets() + sourceSets { - commonMain { - dependencies { - api(projects.rsocketTransportKtor.rsocketTransportKtorWebsocket) - api(libs.ktor.server.host.common) - api(libs.ktor.server.websockets) - } + commonMain.dependencies { + api(projects.rsocketTransportKtorWebsocket) + api(libs.ktor.server.host.common) + api(libs.ktor.server.websockets) } - commonTest { - dependencies { - implementation(projects.rsocketTransportKtor.rsocketTransportKtorWebsocketClient) - implementation(libs.ktor.client.cio) - implementation(libs.ktor.server.cio) - } + commonTest.dependencies { + implementation(projects.rsocketTransportTests) + implementation(projects.rsocketTransportKtorWebsocketClient) + implementation(libs.ktor.client.cio) + implementation(libs.ktor.server.cio) } + jvmTest.dependencies { + implementation(libs.ktor.client.okhttp) - jvmTest { - dependencies { - implementation(libs.ktor.client.okhttp) - - implementation(libs.ktor.server.netty) - implementation(libs.ktor.server.jetty) - } + implementation(libs.ktor.server.netty) + implementation(libs.ktor.server.jetty) } } } - -description = "RSocket ktor WebSocket server transport implementation" diff --git a/rsocket-transport-ktor/rsocket-transport-ktor-websocket/build.gradle.kts b/rsocket-transport-ktor/rsocket-transport-ktor-websocket/build.gradle.kts index c2e14b29..2094900d 100644 --- a/rsocket-transport-ktor/rsocket-transport-ktor-websocket/build.gradle.kts +++ b/rsocket-transport-ktor/rsocket-transport-ktor-websocket/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,20 +14,23 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.transport") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin ktor WebSocket transport utilities" + kotlin { + jvmTarget() + jsTarget() + nativeTargets() + sourceSets { - commonMain { - dependencies { - api(projects.rsocketTransportKtor) - api(libs.ktor.websockets) - } + commonMain.dependencies { + api(projects.rsocketTransportKtor) + api(libs.ktor.websockets) } } } - -description = "RSocket ktor WebSocket transport utilities" diff --git a/rsocket-transport-local/build.gradle.kts b/rsocket-transport-local/build.gradle.kts index caa16c4d..edb2dc3d 100644 --- a/rsocket-transport-local/build.gradle.kts +++ b/rsocket-transport-local/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,21 +14,26 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.transport") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin Local transport implementation" + kotlin { - sourceSets { - commonMain { - dependencies { - implementation(projects.rsocketInternalIo) + jvmTarget() + jsTarget() + nativeTargets() - api(projects.rsocketCore) - } + sourceSets { + commonMain.dependencies { + implementation(projects.rsocketInternalIo) + api(projects.rsocketCore) + } + commonTest.dependencies { + implementation(projects.rsocketTransportTests) } } } - -description = "RSocket Local transport implementation" diff --git a/rsocket-transport-nodejs-tcp/build.gradle.kts b/rsocket-transport-nodejs-tcp/build.gradle.kts index 3a0137ec..c048c5d6 100644 --- a/rsocket-transport-nodejs-tcp/build.gradle.kts +++ b/rsocket-transport-nodejs-tcp/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,21 +14,24 @@ * limitations under the License. */ +import rsocketbuild.* + plugins { - id("rsocket.template.transport") - id("rsocket.target.js.node") + id("rsocketbuild.multiplatform-library") } +description = "rsocket-kotlin NodeJS TCP client/server transport implementation" + kotlin { - sourceSets { - jsMain { - dependencies { - implementation(projects.rsocketInternalIo) + jsTarget(supportsBrowser = false) - api(projects.rsocketCore) - } + sourceSets { + jsMain.dependencies { + implementation(projects.rsocketInternalIo) + api(projects.rsocketCore) + } + jsTest.dependencies { + implementation(projects.rsocketTransportTests) } } } - -description = "RSocket NodeJS TCP client/server transport implementation" diff --git a/rsocket-transport-tests/build.gradle.kts b/rsocket-transport-tests/build.gradle.kts index f04d462a..592e51ee 100644 --- a/rsocket-transport-tests/build.gradle.kts +++ b/rsocket-transport-tests/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,78 +14,29 @@ * limitations under the License. */ +import org.jetbrains.kotlin.gradle.* +import rsocketbuild.* + plugins { - id("rsocket.template.test") - id("rsocket.target.all") + id("rsocketbuild.multiplatform-base") id("kotlinx-atomicfu") } +@OptIn(ExperimentalKotlinGradlePluginApi::class) kotlin { + jvmTarget() + jsTarget() + nativeTargets() + + compilerOptions { + optIn.addAll( + OptIns.ExperimentalStreamsApi, + ) + } + sourceSets { - commonMain { - dependencies { - api(projects.rsocketTest) - } - } - jvmTest { - dependencies { - implementation(projects.rsocketTransportKtor.rsocketTransportKtorTcp) - implementation(projects.rsocketTransportKtor.rsocketTransportKtorWebsocketServer) - implementation(libs.ktor.server.cio) - } + commonMain.dependencies { + api(projects.rsocketTest) } } } - -//open class StartTransportTestServer : DefaultTask() { -// @Internal -// var server: Closeable? = null -// private set -// -// @Internal -// lateinit var classpath: FileCollection -// -// @TaskAction -// fun exec() { -// try { -// println("[TransportTestServer] start") -// server = URLClassLoader( -// classpath.map { it.toURI().toURL() }.toTypedArray(), -// ClassLoader.getSystemClassLoader() -// ) -// .loadClass("io.rsocket.kotlin.transport.tests.server.AppKt") -// .getMethod("start") -// .invoke(null) as Closeable -// println("[TransportTestServer] started") -// } catch (cause: Throwable) { -// println("[TransportTestServer] failed to start: ${cause.message}") -// cause.printStackTrace() -// } -// } -//} -// -//val startTransportTestServer by tasks.registering(StartTransportTestServer::class) { -// dependsOn(tasks["jvmTest"]) //TODO? -// classpath = (kotlin.targets["jvm"].compilations["test"] as KotlinJvmCompilation).runtimeDependencyFiles -//} -// -//rootProject.allprojects { -// if (name == "rsocket-transport-ktor-websocket-client") { -// val names = setOf( -// "jsLegacyNodeTest", -// "jsIrNodeTest", -// "jsLegacyBrowserTest", -// "jsIrBrowserTest", -// ) -// tasks.all { -// if (name in names) dependsOn(startTransportTestServer) -// } -// } -//} -// -//gradle.buildFinished { -// startTransportTestServer.get().server?.run { -// close() -// println("[TransportTestServer] stopped") -// } -//} diff --git a/rsocket-transport-tests/src/jvmTest/kotlin/io/rsocket/kotlin/transport/tests/server/App.kt b/rsocket-transport-tests/src/jvmTest/kotlin/io/rsocket/kotlin/transport/tests/server/App.kt deleted file mode 100644 index f45f7edf..00000000 --- a/rsocket-transport-tests/src/jvmTest/kotlin/io/rsocket/kotlin/transport/tests/server/App.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2015-2022 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. - */ - -package io.rsocket.kotlin.transport.tests.server - -import io.ktor.server.cio.* -import io.rsocket.kotlin.transport.ktor.tcp.* -import io.rsocket.kotlin.transport.ktor.websocket.server.* -import io.rsocket.kotlin.transport.tests.* -import kotlinx.coroutines.* -import java.io.* - -fun start(): Closeable { - val job = Job() - val scope = CoroutineScope(job) - - runBlocking { - TransportTest.SERVER.bindIn( - scope, - TcpServerTransport(port = PortProvider.testServerTcp), - TransportTest.ACCEPTOR - ).serverSocket.await() //await server start - } - - TransportTest.SERVER.bindIn( - scope, - WebSocketServerTransport(CIO, port = PortProvider.testServerWebSocket), - TransportTest.ACCEPTOR - ) - - Thread.sleep(1000) //await start - - return Closeable { - runBlocking { - job.cancelAndJoin() - } - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 8dc48565..99ff2d2a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * 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. @@ -14,64 +14,37 @@ * limitations under the License. */ -enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") +import rsocketsettings.* pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } - - includeBuild("gradle/plugins/build-parameters") - includeBuild("gradle/plugins/build-logic") - includeBuild("gradle/plugins/kotlin-version-catalog") -} - -dependencyResolutionManagement { - repositories { - mavenCentral() - } + includeBuild("build-logic") + includeBuild("build-settings") } plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" - id("com.gradle.enterprise") version "3.13.2" - id("kotlin-version-catalog") + id("rsocketsettings.default") } -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" +projects("rsocket-kotlin") { + module("rsocket-internal-io") + module("rsocket-core") + module("rsocket-test") + + module("rsocket-transport-tests") + module("rsocket-transport-local") + module("rsocket-transport-nodejs-tcp") + + //ktor transport modules + module("rsocket-transport-ktor", prefix = null) { + module("rsocket-transport-ktor-tcp") + module("rsocket-transport-ktor-websocket") + module("rsocket-transport-ktor-websocket-client") + module("rsocket-transport-ktor-websocket-server") } -} - -rootProject.name = "rsocket-kotlin" - -//include("benchmarks") -include("rsocket-internal-io") - -include("rsocket-core") -include("rsocket-test") - -include("rsocket-transport-tests") -include("rsocket-transport-local") - -//ktor transport modules -include( - "rsocket-transport-ktor", - "rsocket-transport-ktor:rsocket-transport-ktor-tcp", - "rsocket-transport-ktor:rsocket-transport-ktor-websocket", - "rsocket-transport-ktor:rsocket-transport-ktor-websocket-client", - "rsocket-transport-ktor:rsocket-transport-ktor-websocket-server", -) - -include("rsocket-transport-nodejs-tcp") - -//deep ktor integration module -include( - "rsocket-ktor", - "rsocket-ktor:rsocket-ktor-client", - "rsocket-ktor:rsocket-ktor-server", -) + //deep ktor integration module + module("rsocket-ktor", prefix = null) { + module("rsocket-ktor-client") + module("rsocket-ktor-server") + } +}