@Override public Void execute(File directory, ProjectConnection connection) { connection.newBuild() .withArguments(arguments.toArray(new String[arguments.size()])) .run(); return null; } });
public List<IPath> getGradleSourceSetPaths(final IPath projectRoot) { if ((this.gradleClasspath == null)) { final ByteArrayOutputStream outTask = new ByteArrayOutputStream(); final Consumer<BuildLauncher> _function = (BuildLauncher it) -> { it.withArguments("-q", "sourceSetPaths"); it.setStandardOutput(outTask); it.setStandardError(outTask); }; this.gradle.run(projectRoot.toFile(), null, _function); this.gradleClasspath = this.parseGradleSourcePaths(outTask.toString()); } return this.gradleClasspath; }
@Override public Void execute(File projectDirectory, ProjectConnection connection) { connection.newBuild() .forTasks("doNothing") .withArguments("--refresh-dependencies") .run(); return null; } });
build.forTasks(tasks.toArray(new String[0])); if (taskArgs.size() > 0) { build.withArguments(taskArgs.toArray(new String[0]));
try { BuildLauncher build = connection.newBuild(); //select tasks to run: build.forTasks("clean", "test"); //include some build arguments: build.withArguments("--no-search-upward", "-i", "--project-dir", "someProjectDir"); //configure the standard input: build.setStandardInput(new ByteArrayInputStream("consume this!".getBytes())); //in case you want the build to use java different than default: build.setJavaHome(new File("/path/to/java")); //if your build needs crazy amounts of memory: build.setJvmArguments("-Xmx2048m", "-XX:MaxPermSize=512m"); //if you want to listen to the progress events: ProgressListener listener = null; // use your implementation build.addProgressListener(listener); //kick the build off: build.run(); } finally { connection.close(); }
.newBuild() .forTasks(conf.tasks()) .withArguments("-x", "test"); launcher.withArguments("--info", "--stacktrace"); launcher.setStandardOutput(System.out); launcher.setStandardError(System.err);
@Override public Assignable importBuildOutput() { final String oldValue = removeSAXParserFactoryProperty(); getBuildLauncher().forTasks(tasks).withArguments(arguments).run(); setSAXParserFactoryProperty(oldValue); return this; }
@Override public Assignable importBuildOutput() { final String oldValue = removeSAXParserFactoryProperty(); getBuildLauncher().forTasks(tasks).withArguments(arguments).run(); setSAXParserFactoryProperty(oldValue); return this; }
public void run(List<WatchTarget> targets) { if (targets == null || targets.isEmpty()) { return; } BuildLauncher launcher = connection .newBuild() .withArguments(arguments) .setStandardOutput(System.out); for (WatchTarget target : targets) { launcher.forTasks(target.getTasks().toArray(new String[0])); } final int[] taskNum = new int[1]; launcher.addProgressListener(new ProgressListener() { public void statusChanged(ProgressEvent event) { if ("Execute tasks".equals(event.getDescription())) { taskNum[0]++; } } }); long timestamp = System.currentTimeMillis(); try { launcher.run(); } catch (BuildException e) { // ignore... } for (WatchTarget target : targets) { target.setExecutedAt(timestamp); } }
.setStandardInput(System.in) .setStandardError(System.err) .withArguments(args.toArray(new String[args.size()])) .setColorOutput(false) .run();
.withArguments("-q") .addProgressListener(new ProgressListener() { public void statusChanged(ProgressEvent event) {
launcher.withArguments(finalArgs);