-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npmInstall up-to-date check broken with fastNpmInstall #310
Comments
Weirdly enough I see the opposite behaviour: gradle-node-plugin/src/test/groovy/com/github/gradle/node/npm/task/NpmInstall_integTest.groovy Lines 84 to 85 in 06c0d5d
What npm version are you using? |
I use npm 10.5.2, installed from the Arch Linux repo. The opposite behavior is also easy to explain:
This scenario is not that severe, it just executes the task when it was not necessary. My scenario in the issue opening post however is rather annoying since it is not easy to convince Gradle to execute the task again when it thinks it is still up to date and it leads to a failing build. The proposed fix (to not check for file existence at configuration time) should solve both scenarios. |
The test itself turns out to be broken, which is a little easier to confirm outside a plane 😅 |
Do the tasks that use packages provided by I can only reproduce this with tasks that don't have the dependency and I can't really fix the output properly without dropping support for |
Thank you so much for looking into it and composing an integration test. In my actual project I also have The reason for your test to pass is that with the default
Again, the if-exists semantics is kind of weird here. At configuration time for the first execution the file does not exist, so "null" is tracked as output after task execution even though the file has just been created by that task. At configuration time for the second execution the file exists, so it is part of the outputs, and when the second run reaches the up-to-date check it sees that this output property has somehow changed from "null" to the existing file, so the task is not up-to-date. With Another way to make your test fail even with --- a/src/test/groovy/com/github/gradle/node/npm/task/NpmInstall_integTest.groovy
+++ b/src/test/groovy/com/github/gradle/node/npm/task/NpmInstall_integTest.groovy
@@ -148,6 +148,19 @@ class NpmInstall_integTest extends AbstractIntegTest {
then:
result.task(':deleteNodeModules').outcome == TaskOutcome.SUCCESS
+ when:
+ result = build('npmInstall')
+
+ then:
+ result.task(":npmInstall").outcome == TaskOutcome.SUCCESS
+
+ when:
+ // when the node_modules is removed
+ result = build('deleteNodeModules')
+
+ then:
+ result.task(':deleteNodeModules').outcome == TaskOutcome.SUCCESS
+
when:
result = build('taskWithDependency') |
I'm having some difficulties modeling this in a way that both |
I stumbled on a weird issue with the following steps:
node_modules
directory presentnpmInstall
with thefastNpmInstall
option enablednode_modules
directorynpmInstall
again, it reports as up-to-datenode_modules
is missingThe problem is that in step 2 the file
node_modules/.package-lock.json
was not recorded as output because it did not yet exist at configuration time, only after task execution. So the task has no configured outputs and won't become out of date by removing thenode_modules
directory.Proposed fix: When using
fastNpmInstall
, do not check for existance of the file at configuration time here, instead always return the file.The text was updated successfully, but these errors were encountered: