Permalink
Browse files

The init script now also specifies the stdin.

  • Loading branch information...
1 parent 6477d49 commit 115fc3a60cd7ab71c6f77535fcaac9c98c4ad5ef @kelemen committed Nov 20, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/org/netbeans/gradle/project/resources/nb-init-script.gradle
@@ -1,3 +1,5 @@
+import org.gradle.api.tasks.JavaExec
+
afterProject { org.gradle.api.Project project ->
if (project == null) {
return;
@@ -12,11 +14,16 @@ afterProject { org.gradle.api.Project project ->
if (definedMainClass == null) definedMainClass = '';
definedMainClass = definedMainClass.toString()
+ def configJavaExec = { JavaExec task ->
+ task.main = definedMainClass
+ task.classpath = project.sourceSets.main.runtimeClasspath
+ task.standardInput = System.in
+ }
+
if (!hasRun) {
if ('' != definedMainClass) {
project.task ('run', dependsOn: project.classes, type: JavaExec) {
- main = definedMainClass
- classpath = project.sourceSets.main.runtimeClasspath
+ configJavaExec(it)
}
}
else {
@@ -29,8 +36,7 @@ afterProject { org.gradle.api.Project project ->
if (!hasDebug) {
if ('' != definedMainClass) {
project.task ('debug', dependsOn: project.classes, type: JavaExec) {
- main = definedMainClass
- classpath = project.sourceSets.main.runtimeClasspath
+ configJavaExec(it)
debug = true
}
}

0 comments on commit 115fc3a

Please sign in to comment.