diff --git a/build.gradle.kts b/build.gradle.kts index 06b787d887507..b476f58c5252a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -49,6 +49,7 @@ plugins { } `jvm-toolchains` alias(libs.plugins.gradle.node) apply false + id("nodejs-cache-redirector-configuration") } val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild @@ -1147,16 +1148,6 @@ if (disableVerificationTasks) { gradle.taskGraph.whenReady(checkYarnAndNPMSuppressed) -allprojects { - plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin::class) { - extensions.configure(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsEnvSpec::class.java) { - if (kotlinBuildProperties.isCacheRedirectorEnabled) { - downloadBaseUrl = "https://cache-redirector.jetbrains.com/nodejs.org/dist" - } - } - } -} - plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class) { extensions.configure(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension::class.java) { npmInstallTaskProvider.configure { diff --git a/libraries/kotlin.test/build.gradle.kts b/libraries/kotlin.test/build.gradle.kts index 6467405714e30..3e6662cf7903f 100644 --- a/libraries/kotlin.test/build.gradle.kts +++ b/libraries/kotlin.test/build.gradle.kts @@ -16,6 +16,7 @@ plugins { kotlin("multiplatform") `maven-publish` signing + id("nodejs-cache-redirector-configuration") } description = "Kotlin Test Library" diff --git a/libraries/kotlin.test/js/it/build.gradle.kts b/libraries/kotlin.test/js/it/build.gradle.kts index 2ea759b10c15a..92b57a5c75a3e 100644 --- a/libraries/kotlin.test/js/it/build.gradle.kts +++ b/libraries/kotlin.test/js/it/build.gradle.kts @@ -6,6 +6,7 @@ plugins { kotlin("multiplatform") alias(libs.plugins.gradle.node) idea + id("nodejs-cache-redirector-configuration") } description = "Kotlin-test integration tests for JS" diff --git a/libraries/stdlib/build.gradle.kts b/libraries/stdlib/build.gradle.kts index 4dbdda80515f5..1a2f75ee091b9 100644 --- a/libraries/stdlib/build.gradle.kts +++ b/libraries/stdlib/build.gradle.kts @@ -26,6 +26,7 @@ plugins { kotlin("multiplatform") `maven-publish` signing + id("nodejs-cache-redirector-configuration") } description = "Kotlin Standard Library" diff --git a/libraries/stdlib/js-ir-minimal-for-test/build.gradle.kts b/libraries/stdlib/js-ir-minimal-for-test/build.gradle.kts index 04ed2abaeb7d0..f9eb7397b9850 100644 --- a/libraries/stdlib/js-ir-minimal-for-test/build.gradle.kts +++ b/libraries/stdlib/js-ir-minimal-for-test/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.dsl.* plugins { kotlin("multiplatform") + id("nodejs-cache-redirector-configuration") } kotlin { diff --git a/plugins/atomicfu/atomicfu-runtime/build.gradle.kts b/plugins/atomicfu/atomicfu-runtime/build.gradle.kts index ebf49b43c1a5e..6c47ad7aec9a9 100644 --- a/plugins/atomicfu/atomicfu-runtime/build.gradle.kts +++ b/plugins/atomicfu/atomicfu-runtime/build.gradle.kts @@ -6,6 +6,7 @@ description = "Runtime library for the Atomicfu compiler plugin" plugins { kotlin("js") `maven-publish` + id("nodejs-cache-redirector-configuration") } group = "org.jetbrains.kotlin" diff --git a/plugins/js-plain-objects/runtime/build.gradle.kts b/plugins/js-plain-objects/runtime/build.gradle.kts index c43b3d178c55f..9890ff3679c75 100644 --- a/plugins/js-plain-objects/runtime/build.gradle.kts +++ b/plugins/js-plain-objects/runtime/build.gradle.kts @@ -6,6 +6,7 @@ description = "Runtime library for the JS Plain Objects compiler plugin" plugins { kotlin("js") `maven-publish` + id("nodejs-cache-redirector-configuration") } group = "org.jetbrains.kotlin" diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/nodejs-cache-redirector-configuration.gradle.kts b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/nodejs-cache-redirector-configuration.gradle.kts new file mode 100644 index 0000000000000..830cd5b7daeee --- /dev/null +++ b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/nodejs-cache-redirector-configuration.gradle.kts @@ -0,0 +1,11 @@ +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsEnvSpec +import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin + +plugins.withType(NodeJsPlugin::class) { + extensions.configure(NodeJsEnvSpec::class.java) { + if (kotlinBuildProperties.isCacheRedirectorEnabled) { + downloadBaseUrl = "https://cache-redirector.jetbrains.com/nodejs.org/dist" + } + } +} \ No newline at end of file