diff --git a/src/main/groovy/com/moowork/gradle/node/exec/ExecRunner.groovy b/src/main/groovy/com/moowork/gradle/node/exec/ExecRunner.groovy index 405c416..3be6a05 100644 --- a/src/main/groovy/com/moowork/gradle/node/exec/ExecRunner.groovy +++ b/src/main/groovy/com/moowork/gradle/node/exec/ExecRunner.groovy @@ -61,6 +61,7 @@ abstract class ExecRunner if ( this.execOverrides != null ) { + this.execOverrides.setDelegate( getDelegate() ) this.execOverrides( it ) } } ) diff --git a/src/main/groovy/com/moowork/gradle/node/exec/NodeExecRunner.groovy b/src/main/groovy/com/moowork/gradle/node/exec/NodeExecRunner.groovy index df54058..25d4351 100644 --- a/src/main/groovy/com/moowork/gradle/node/exec/NodeExecRunner.groovy +++ b/src/main/groovy/com/moowork/gradle/node/exec/NodeExecRunner.groovy @@ -1,5 +1,6 @@ package com.moowork.gradle.node.exec +import com.moowork.gradle.node.NodeExtension import org.gradle.api.Project import org.gradle.process.ExecResult @@ -24,7 +25,11 @@ class NodeExecRunner nodeEnvironment << System.getenv() } - def nodeBinDirPath = this.variant.nodeBinDir.getAbsolutePath() + String nodeModulesBinPath = + project.extensions.findByType(NodeExtension).nodeModulesDir.absolutePath + '/node_modules/.bin' + + String nodeBinDirPath = + this.variant.nodeBinDir.getAbsolutePath() + File.pathSeparator + nodeModulesBinPath // Take care of Windows environments that may contain "Path" OR "PATH" - both existing // possibly (but not in parallel as of now) diff --git a/src/main/groovy/com/moowork/gradle/node/task/NodeTask.groovy b/src/main/groovy/com/moowork/gradle/node/task/NodeTask.groovy index e7149aa..a2cea3c 100644 --- a/src/main/groovy/com/moowork/gradle/node/task/NodeTask.groovy +++ b/src/main/groovy/com/moowork/gradle/node/task/NodeTask.groovy @@ -1,5 +1,6 @@ package com.moowork.gradle.node.task +import com.moowork.gradle.node.NodeExtension import com.moowork.gradle.node.exec.NodeExecRunner import org.gradle.api.DefaultTask import org.gradle.api.tasks.TaskAction @@ -27,6 +28,13 @@ class NodeTask this.script = value } + void setExecutable( final String execName ) + { + File modulesDir = project.extensions.findByType(NodeExtension).nodeModulesDir + setScript(new File(modulesDir, 'node_modules/.bin/' + execName)) + dependsOn( NpmInstallTask.NAME ) + } + void setArgs( final Iterable value ) { this.args = value