Node Js Toolchain Management Dsl
DSL for selecting and configuring the NodeJsToolchainService used by the whole build, exposed as toolchainManagement { nodeJs { ... } } in settings.gradle.kts by the org.jetbrains.kotlin.ecosystem plugin.
At most one of toolchainService or disable may be called - the NodeJsToolchainService is registered as a shared org.gradle.api.services.BuildService right away, under the same name every Kotlin Gradle Plugin project looks up when it registers the toolchain service for itself, so calling this more than once would silently keep only the first registration.
kotlin {
toolchainManagement {
nodeJs {
toolchainService(MyNodeJsToolchainService::class) { //specify a service class is optional, DefaultNodeJsToolchainService will be used by default
}
toolchainService(DefaultNodeJsToolchainService::class) {
downloadBaseUrl("custom-url") //official node js website will be used by default
installationDir("custom location") //default <user.home>/.kotlin/toolchains/nodejs location will be used by default
}
toolchainService(PreInstalledNodeJsToolchainService::class) {
nodeJsExecutable("path_to_node_js_executable") //"node" will be used by default
}
}
}
}Note: This interface is not intended for implementation by build script or plugin authors.
Functions
Configures the built-in, download-based DefaultNodeJsToolchainService.
Selects serviceClass as the NodeJsToolchainService used by the whole build, and configures its parameters.
Action based version of toolchainService above.