gradle-node-plugin icon indicating copy to clipboard operation
gradle-node-plugin copied to clipboard

Support for making NpmTask cacheable

Open NikolayMetchev opened this issue 7 years ago • 4 comments

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

NikolayMetchev avatar Feb 09 '18 23:02 NikolayMetchev

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")    
}

sergey-morenets avatar Aug 15 '18 22:08 sergey-morenets

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

johannespostler avatar Sep 03 '18 09:09 johannespostler

Hi @johannespostler

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

sergey-morenets avatar Sep 03 '18 12:09 sergey-morenets

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

sergey-morenets avatar Sep 03 '18 12:09 sergey-morenets