This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new f1a52167937 Use separate nodeProjectDir for each subproject (#2680)
f1a52167937 is described below

commit f1a521679370cdfcfa550e1e13710a0c2d75278e
Author: Tyler Bertrand <121591679+tylerbertr...@users.noreply.github.com>
AuthorDate: Wed Jan 8 07:28:43 2025 -0600

    Use separate nodeProjectDir for each subproject (#2680)
    
    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
    
    ---------
    
    Co-authored-by: Eric Pugh <ep...@opensourceconnections.com>
    (cherry picked from commit 388101fc84140c0bdc50706637bcc5df11908ca6)
---
 gradle/node.gradle | 7 +++----
 solr/CHANGES.txt   | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gradle/node.gradle b/gradle/node.gradle
index ff8404c2db2..74796cfa354 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
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d9d22fb59c6..a048351789b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -27,7 +27,7 @@ Optimizations
 
 Bug Fixes
 ---------------------
-(No changes)
+* PR#2680: Improve reliablity of NpmTasks finding needed files/commands.  
(Tyler Bertrand via Eric Pugh)
 
 Dependency Upgrades
 ---------------------

Reply via email to