Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support execOverrides on NpmSetupTask #196

Closed
nkoterba opened this issue Feb 6, 2017 · 4 comments
Closed

Support execOverrides on NpmSetupTask #196

nkoterba opened this issue Feb 6, 2017 · 4 comments
Labels
Milestone

Comments

@nkoterba
Copy link

nkoterba commented Feb 6, 2017

We have recently upgraded from the old mooworks gulp and node plugins to the latest single "repo" version.

In our old setup, we liked to squelch NPM, Node, and Gulp tasks unless they failed with the following:

hideNonFailingOutput = {
        ignoreExitValue = true
        def execRunner = null
        execOverrides {
            execRunner = it
            it.standardOutput = new ByteArrayOutputStream()
            it.errorOutput = it.standardOutput
        }
        doLast {
            if (result.exitValue != 0) {
                println(execRunner.standardOutput.toString())
                throw new GradleException("exec failed; see output above")
            }
        }
    }

build.gradle

npmSetup {
       configure hideNonFailingOutput
    }

In the newest version, when I try to run gradle npmSetup, the following error occurs:

> Could not find method execOverrides() for arguments [build_13tmtfk6heqf6fa4c13hvdop7$_run_closure3$_closure30$_closure39@1c0d19ca] on task ':webclient:npmSetup' of type com.moowork.gradle.node.npm.NpmSetupTask.

When I look at the current source I see that NpmSetupTask uses an internal NpmExecRunner (https://github.com/srs/gradle-node-plugin/blob/master/src/main/groovy/com/moowork/gradle/node/npm/NpmSetupTask.groovy#L83), but does not provide a way to configure that ExecRunner other than passing args.

Was this functionality or capability removed for a reason? If not, would it be possible to add back in a way to configure execOverrides on an NpmSetupTask (so these could be passed internally to the NpmExecRunner or configured)?

@srs
Copy link
Owner

srs commented Feb 9, 2017

That was not an intentional removal. Will add that back in. Marking this as a bug.

@srs srs added this to the 1.2.0 milestone Feb 9, 2017
@srs srs added the bug label Feb 9, 2017
@srs
Copy link
Owner

srs commented Mar 27, 2017

Could you provide a complete example of this?

@nkoterba
Copy link
Author

@srs I'm confused what you mean by complete example?

My original post shows how we are trying to provide execOverrides for the npmSetup task. However, npmSetup no longer exposes or supports execOverrides configuration. We are doing this so we can squelch NPM output which we don't need in our gradle output unless an error occurs.

Something as simple as:

npmSetup {
   execOverrides {

   } 
}

should cause the error since execOverrides is not defined anymore on the NpmSetupTask.

Error output:

* What went wrong:
A problem occurred evaluating project ':webclient'.
> Could not find method execOverrides() for arguments [build_89gbdgndlf88e5p5k8082bhzi$_run_closure3$_closure28$_closure37@11336498] on task ':webclient:npmSetup' of type com.moowork.gradle.node.npm.NpmSetupTask.

@srs
Copy link
Owner

srs commented Apr 17, 2017

Oh, sorry. Misunderstood the original issue. Will create a simple example of this and then fix it for NpmSetupTask and all the other tasks.

@srs srs closed this as completed in fb8f931 Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants