node-gradle / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
601 stars 117 forks source link

Add ability do download node only once if needed #227

Closed LAP2 closed 2 years ago

LAP2 commented 2 years ago

Hi. It would be great if we could control Node.js download process and not redownload it on every build. In this PR we add such ability to this plugin, additional property downloadOnce, were added and if it is true and Node.js is already downloaded than it should not download it again.

deepy commented 2 years ago

This is already done by default by the plugin, if node.js has already been downloaded it won't be re-downloaded.

If you look at this test you can even confirm that node is not re-downloaded: https://github.com/node-gradle/gradle-node-plugin/blob/c845c086181b6b7f7e597d0ea04397c72b771138/src/test/groovy/com/github/gradle/node/task/NodeTask_integTest.groovy#L32

The only time when a re-download should occur is if the downloaded Node has been deleted, and in that case you really do need to re-download it. Could you perhaps describe the scenario in which you're seeing Node being re-downloaded?

LAP2 commented 2 years ago

Recheck project configurations. It seems that we are put node into build directory and wipe it out every build. Change this configuration, will check if it will work fine then.

deepy commented 2 years ago

If you want node installed outside of your project you might want to follow issue https://github.com/node-gradle/gradle-node-plugin/issues/228

I'm currently experimenting with Build Services and created that issue to have a general overview of the progress, it's not likely to hit a release soon though as there's plenty of work still to be done and I just have an experimental branch so far