[Gradle, JS] Windows environment for not ignoring scripts

This commit is contained in:
Ilya Goncharov
2021-11-26 12:39:02 +03:00
committed by Space
parent d4953cb51a
commit 2e350a10bd
2 changed files with 18 additions and 6 deletions
@@ -56,8 +56,13 @@ interface NpmApi : Serializable {
data class NpmEnvironment(
val rootPackageDir: File,
val nodeExecutable: String
val nodeExecutable: String,
val isWindows: Boolean
) : Serializable
internal val NodeJsRootExtension.asNpmEnvironment
get() = NpmEnvironment(rootPackageDir, requireConfigured().nodeExecutable)
get() = NpmEnvironment(
rootPackageDir,
requireConfigured().nodeExecutable,
requireConfigured().isWindows
)
@@ -44,10 +44,17 @@ abstract class YarnBasics : NpmApi {
).filter { it.isNotEmpty() }
val nodeExecutable = nodeJs.nodeExecutable
exec.environment(
"PATH",
"$nodeExecutable${File.pathSeparator}${System.getenv("PATH")}"
)
if (!yarn.ignoreScripts) {
val nodePath = if (nodeJs.isWindows) {
File(nodeExecutable).parent
} else {
nodeExecutable
}
exec.environment(
"PATH",
"$nodePath${File.pathSeparator}${System.getenv("PATH")}"
)
}
val command = yarn.executable
if (yarn.standalone) {