gradle-node-plugin
gradle-node-plugin copied to clipboard
Last yarn task overrides all older yarn tasks
task ("CommonUiYarn", type:YarnTask) { ... }
task ("NavYarn", type:YarnTask) { ... }
task ("OmYarn", type:YarnTask) { ... }
It seems that "OmYarn" here is overriding "CommonUiYarn" as well as "NavYarn", such that if I run "CommonUiYarn" or "NavYarn", then instead they always runs as if they were running "OmYarn". (The name that is being printed during the build is the name of the task being run, i.e. CommonUiYarn will output :CommonUiYarn
in the terminal during the build, but the behaviour is that of OmYarn.
However, if I define OmYarn at the beginning of the file, such that the new order is:
task ("OmYarn", type:YarnTask) { ... }
task ("CommonUiYarn", type:YarnTask) { ... }
task ("NavYarn", type:YarnTask) { ... }
Then no matter what task I choose, it always runs as if I was running the NavYarn task.
=======================
Original code:
task ("CommonUiYarn", type:YarnTask) {
node {
inputs.files(fileTree(CommonUi['src']))
nodeModulesDir = file(CommonUi['src'])
}
args = ['install']
}
task ("NavYarn", type:YarnTask) {
node {
inputs.files(fileTree(Nav['src']))
nodeModulesDir = file(Nav['src'])
}
args = ['install']
}
task ("OmYarn", type:YarnTask) {
node {
inputs.files(fileTree(Om['src']))
nodeModulesDir = file(Om['src'])
}
args = ['install']
}
I have checked the path definitions, they are all different.
Thanks for reporting this. The node-extension namespace is just evaluated once so you cannot change it in that way. I will need to make some modifications to allow this.
Marking this as a bug, but it's not a trivial task right now. But will see how I could do it without too much code.
Thanks. I had to use the vanilla Exec task as a workaround. Would love to use this plugin again in a future project, if this issue is solved.
What do you need to override? Is it just nodeModulesDir
?
I'm hitting this roadblock just now. are there any news or workarounds for this? Thanks
#315 is a good issue to read, but you can do this in the fork with execOverrides