-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
ExecRunner's getWorkingDir should not be cached #40
Comments
Thanks @jfbibeau for this feedback. The current configuration does not take into consideration the contents of the working directory, it only cares about its path. I just come check that by reproducing this use case in an integration test (not committed). We would have the behavior you describe if we used the Note that Gradle prints a warning when building the plugin every time there is a
The documentation seems to tell that it is valid and it is exactly what we need:
Don't know really why Gradle prints this warning. The documentation also tells that by default an Is there something I misunderstood in Gradle's behavior or in your issue report? You seem to think that considering the working directory as a task input is not relevant, I believe I don't agree with that. Do we have to run a task again when its working directory change? I would answer yes because it can completely change the result. What do you think about that? |
Hi @bsautel, thanks for your reply! I've been debating back and forth as to whether the working directory path matters. In my opinion, specifically given that these are Even more importantly, when you consider that Gradle caching artifacts can be re-used between different developers (using Gradle Enterprise), the path should almost never be For instance a developer cloning and building in /Users/userA/clone/gradlew ... and a developer cloning and building in /Users/userB/clone/gradlew... should be able to share cache artifacts. This would definitely need to be set to I've forked the plugin locally doing these changes and am able to confirm that it resolves all caching issues. I'd love to keep using upstream and not a forked version so these would be my suggestions. I'm open to any further thoughts you have! |
Thanks for these explanations! It sounds like Regarding the path sensitivity, I did not know that the When you say that your changes fixed this issue, what exactly did you change? You set the path sensitivity to Note that I tried to set the path sensitivity to relative and execute tests. They all pass but I have yet another warning that I still don't understand:
It sounds like we do what Gradle suggests in the documentation and it displays some warnings. I probably misunderstood something. Maybe you know why? Sorry for all my questions but I would like to ensure I understand correctly the issue to fix it correctly for the different plugin tasks (removing the working directory from the And thanks, your feedback makes me learn some new thinks about Gradle! |
No problem, happy to help! Yes, I really believe that setting the workingDir to
Here I would argue that yes, the only thing differentiating these tasks from the inputs declared in Do remember that any task can add inputs on the fly, so, the proper way to write this would be:
So in conclusion (sorry that was a bit long):
I hope this helps, if not do let me know where I can clarify! |
Ok, thanks for these explanations. I had a look to the Gradle I am ok for integrating these changes. But I wonder what we should do with the other properties of the As far as I understand, the Gradle philosophy (and you seem to agree with that) is to consider that if an environment or a working directory change can change the task behavior, the user is responsible of telling it to Gradle by manually adding the value to the task input properties, right? I'll be on vacations until next monday so I will not be able to do the changes before. Changing the annotations is fast but it requires to change all the integration tests that are going to be broken. |
Thanks @bsautel, I think we are in agreement! I look forward to deleting my fork and syncing back to using upstream! I agree with your assessment and with Gradle's design:
I appreciate your time responding to these issues! |
We're probably still gonna need parts of |
If you'd like to keep |
I just come to fix the issue regarding the working directory. I did not change the input declaration regarding the environment. |
I have a question for you @jfbibeau. It remains one property in the This is a closure that, if set, can configure (and override since it is called at the end of the configuration) the Gradle exec action configuration. It can be used to configure some properties that are supported directly in According to what it does, it may or may not change the task behavior. According to what you said and what Gradle does, I understand that it does not really make sense to consider it as a task input. Do you confirm that? Note that I tried to declare it as a task input and it is not simple. As it is a closure, Gradle executes it when it checks whether it is up-to-date or not (it seems to detect changes on its result). This closure assumes it is called with a parameter (the exec action) and Gradle provides no parameters, so its execution does not work. As far as I understand, to get this work, we should use an Action and not a closure, in this case Gradle is able to detect changes on its behavior instead of on its result. This also makes me think that is way easier to declare it as internal. |
@bsautel agreed! |
…t it is not part of the up-to-date checking. Issue #40.
Ok, that's done. This way we no longer have any warning regarding task input/output declarations when building the plugin. Thanks! |
(Apologies for not submitting a PR, my company doesn't allow me to do open source contribution easily yet)
Looks like this PR https://github.com/node-gradle/gradle-node-plugin/pull/32/files introduced a small bug:
On this line: https://github.com/node-gradle/gradle-node-plugin/blob/master/src/main/groovy/com/moowork/gradle/node/exec/ExecRunner.groovy#L35
The working directory should not be a caching input. Currently the way this is set up, it will take into account the contents of the working directory, and also because the
PathSensitive
annotation is not set, it means the entry will not be cached correctly on different machines/different checkout directories.Therefore I believe
workingDir
should not be taken into account in the cache, and be annotated simply with@Internal
:Thanks for the consideration!
The text was updated successfully, but these errors were encountered: