Carter
11/05/2024, 6:37 PMNodeJsRootExtension.
'download: Boolean' is deprecated. Use download from NodeJsExtension (not NodeJsRootExtension) insteadYou can find this extension after applying NodeJsPlugin. This will be removed in 2.2
What’s the actual Gradle plugin ID for NodeJsPlugin?Anton Mefodichev
11/05/2024, 7:26 PMhfhbd
11/05/2024, 7:28 PMhfhbd
11/05/2024, 7:29 PMCarter
11/05/2024, 8:10 PMhfhbd
11/05/2024, 8:12 PMCarter
11/05/2024, 8:23 PMNodeJsEnvSpec wasn’t easy.tapchicoma
11/06/2024, 9:15 AMCarter
11/06/2024, 12:45 PMrootProject.plugins.withType<NodeJsPlugin> {
kotlinNodeJsEnvSpec.apply {
download = project.property("SIGMA_IS_INSTALL_NODE").toString().toBoolean()
version = libs.versions.node.get()
// The repository is configured in the root settings.gradle.kts, and this disables Kotlin Gradle plugin from adding it
downloadBaseUrl = null
}
}
When the gradle build runs, I see Build was configured to prefer settings repositories over project repositories but repository 'Distributions at <https://nodejs.org/dist>' was added by unknown codeIlya Goncharov [JB]
11/06/2024, 1:11 PMrootProject
The easiest way is to use block allprojects {}Carter
11/06/2024, 1:12 PMallproject {} was generally frowned upon generally for Gradle?
Can I do this with a convention plugin now? I have a js convention that I apply to all submodules that use Kotlin JSIlya Goncharov [JB]
11/06/2024, 1:14 PMproject instead of rootProjectCarter
11/06/2024, 1:14 PMCarter
11/06/2024, 1:24 PMplugins.withType<NodeJsPlugin> {
kotlinNodeJsEnvSpec.apply {
download = project.property("IS_INSTALL_NODE").toString().toBoolean()
version = versionCatalogs
.named("libs")
.findVersion("node")
.get()
.toString()
// The repository is configured in the root settings.gradle.kts, and this disables Kotlin Gradle plugin from adding it
downloadBaseUrl = null
}
}
I also tried
root build.gradle.kts
allprojects {
plugins.withType<NodeJsPlugin> {
kotlinNodeJsEnvSpec.apply {
download = project.property("IS_INSTALL_NODE").toString().toBoolean()
version = libs.versions.node.get()
// The repository is configured in the root settings.gradle.kts, and this disables Kotlin Gradle plugin from adding it
downloadBaseUrl = null
}
}
}
In both cases, I see the build logs emitting Build was configured to prefer settings repositories over project repositories but repository 'Distributions at <https://nodejs.org/dist>' was added by unknown code
So it seems like it isn’t having the intended effect.Ilya Goncharov [JB]
11/06/2024, 1:54 PMconvention for default value of downloadBaseUrl, that’s why null is ignored.hfhbd
11/06/2024, 2:32 PMset(provider { null })Anton Mefodichev
11/06/2024, 3:08 PMCarter
11/06/2024, 4:32 PMset(provider { null }) does not work for mehfhbd
11/06/2024, 10:40 PMplugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin> {
(extensions.getByName(NodeJsEnvSpec.EXTENSION_NAME) as NodeJsEnvSpec).downloadBaseUrl.set(null as String?)
}Carter
11/07/2024, 7:39 PMsuresh
11/30/2024, 6:54 AMYes, you can do this with just convention plugin. You just need to “find” plugin on just@Ilya Goncharov [JB] is this the case for Npm plugin also? I just tried to configureinstead ofprojectrootProject
NpmExtension for overriding the lockFileDirectory and seems like it will only work if i apply on rootProject.Ilya Goncharov [JB]
11/30/2024, 10:29 AM<rootProject>/build/js, so it is still not clear how we can isolate it in one project