From 760348e8216c1b1f93082d9f48c97e0996a40556 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Tue, 27 Aug 2024 09:09:11 -0500 Subject: [PATCH] Use separate nodeProjectDir per project Using a shared nodeProjectDir caused multiple nodeSetup tasks to step on each others' toes. The com.github.node-gradle.node plugin doesn't fully support reusing nodeProjectDir, and each nodeSetup task will clean up the existing nodeProjectDir before unpacking the node installation into it. This can result in tasks seeing issues when trying to use npm/node while a nodeSetup task from another project is cleaning it up. use nodeProjectDir instead of rootNodeDir --- gradle/node.gradle | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gradle/node.gradle b/gradle/node.gradle index d585ab5f871..fe128ea1f4a 100644 --- a/gradle/node.gradle +++ b/gradle/node.gradle @@ -35,8 +35,7 @@ configure([project(":solr:packaging"), project(":solr:solr-ref-guide"), project( } project.ext { - rootNodeDir = "$rootDir/.gradle/node" - nodeProjectDir = file("$rootNodeDir/$project.name") + nodeProjectDir = layout.projectDirectory.dir(".gradle/node") } node { @@ -49,10 +48,10 @@ configure([project(":solr:packaging"), project(":solr:solr-ref-guide"), project( } // The directory where Node.js is unpacked (when download is true) - workDir = file("${project.ext.rootNodeDir}/nodejs") + workDir = file("${project.ext.nodeProjectDir.getAsFile().path}/nodejs") // The directory where npm is installed (when a specific version is defined) - npmWorkDir = file("${project.ext.rootNodeDir}/npm") + npmWorkDir = file("${project.ext.nodeProjectDir.getAsFile().path}/npm") // The Node.js project directory location // This is where the package.json file and node_modules directory are located