Skip to content

Commit

Permalink
Use separate nodeProjectDir for each subproject (#2680)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tylerbertrand and epugh authored Jan 8, 2025
1 parent 9bfae53 commit 388101f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions gradle/node.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Optimizations

Bug Fixes
---------------------
(No changes)
* PR#2680: Improve reliablity of NpmTasks finding needed files/commands. (Tyler Bertrand via Eric Pugh)

Dependency Upgrades
---------------------
Expand Down

0 comments on commit 388101f

Please sign in to comment.