srs / gradle-node-plugin

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

Support for making NpmTask cacheable #287

Open NikolayMetchev opened 6 years ago

NikolayMetchev commented 6 years ago

It would be great if the plugin took full advantage of the Gradle build cache for NpmTasks. This would greatly speed up build times. Many thanks

sergey-morenets commented 6 years ago

Hi @NikolayMetchev

I created my own class for Angular project that is cacheable and may be useful for you:

@CacheableTask
public class CacheableYarnTask extends YarnTask {
    @InputFiles
    FileCollection sourceFiles = project.files('client/src', 'client/package.json', 'client/.angular-cli.json')

    @OutputDirectory
    File outputDir = project.file("client/dist")    
}
johannespostler commented 6 years ago

@sergey-morenets Where did you place this new CacheableYarnTask? Is this a patch for the gradle plugin? Thanks!

sergey-morenets commented 6 years ago

Hi @johannespostler

This is not a patch for the Gradle plugin, I put this class into my build.gradle and reuse it.

sergey-morenets commented 6 years ago

This class is for Angular 5. If you have Angular 6 project then you should replace .angular-cli.json with angular.json