Coder Social home page Coder Social logo

Comments (11)

srs avatar srs commented on September 23, 2024

Thanks for the bug report. Will try to fix this in the comming week.

----- Original Message -----

From: "John Engelman" [email protected]
To: "srs/gradle-node-plugin" [email protected]
Sent: Friday, February 21, 2014 10:26:41 PM
Subject: [gradle-node-plugin] nodeSetup conflicts in multi-project build (#7)

In a multi-project Gradle build where 2 conditions are met:

  1. Multiple projects apply the 'node' plugins &
  2. Gradle parallel build mode is activated

The nodeSetup task can error because multiple instances of it could run at the same time. The tasks collide because they both try to extract to the same destination directory.

I've fixed this in my build by applying the plugin to the root project and then configuring all my tasks to depend on nodeSetup in the rootProject and then disabling the nodeSetup in each child project.

This ensures that in any given build there is only 1 nodeSetup that tries to run.


Reply to this email directly or view it on GitHub .

from gradle-node-plugin.

johnrengelman avatar johnrengelman commented on September 23, 2024

There's also an issue where concurrent builds could both be executing the nodeSetup task and they collide.
I would suggest maybe looking into using Gradle's dependency resolution engine to resolve the Node tar file - you'd benefit from their cache control and locking then.
Also, maybe exploding the tar into the local build directory instead of in the file cache.
Finally, configuring some @Input properties on the SetupTask will allow it to only execute when necessary instead of all the time (the output directory is configured, but without at least one task input, the task will always run).

from gradle-node-plugin.

srs avatar srs commented on September 23, 2024

Hi. Can you try with the latest code (snapshot) and see if it works better? I have not been able to replicate this behaviour with both the old and the new code.

What version of gradle are you using? Tested both with 1.10 and 1.11.

Also, it is maybe better to unpack node into local build directory instead of the user .gradle directory. Will probably change this, but you could override it with the following code:

 node {
    workDir = file("${project.buildDir}/nodejs")
 }

from gradle-node-plugin.

johnrengelman avatar johnrengelman commented on September 23, 2024

I was running it with Gradle 1.9. It was happening on every run of our build. In it we have 4 projects that were applying the plugin and we are running with --parallel.

I'll see if I can get to testing the snapshot this weekend.

from gradle-node-plugin.

srs avatar srs commented on September 23, 2024

Hi.

I did a release of this plugin today since I will need some fixes for the gradle-grunt-plugin so you can test 0.4 release instead. Will cut a 0.5 relase with --parallel support if I can figure out the best way to solve it.

from gradle-node-plugin.

johnrengelman avatar johnrengelman commented on September 23, 2024

Ok.
I think your best bet for fixing it would just be to add the npmSetup task to the rootProject instead of the the current project that is applying the plugin (make sure to only add it if it doesn't exist). Then the dependency would just be to the single task instance on the rootProject and everything should work.

That's what I'm doing in my build.

from gradle-node-plugin.

srs avatar srs commented on September 23, 2024

Oh, right. That's a good fix. Will try it out.

from gradle-node-plugin.

srs avatar srs commented on September 23, 2024

If you want different configuration of the node plugin in different modules you cannot do that with your solution. Think the better one for now is to use local build directory for unpacking nodejs instead of the global one.

from gradle-node-plugin.

johnrengelman avatar johnrengelman commented on September 23, 2024

ah yeah...I forgot about that scenario.

from gradle-node-plugin.

srs avatar srs commented on September 23, 2024

Have not managed to replicate the error, but think it will be safe to use project.buildDir for unpacking of node instead of using the /.gradle directory.

from gradle-node-plugin.

srs avatar srs commented on September 23, 2024

I have not seen this problem in any of my production builds. Closing this since it's reather old.

from gradle-node-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.