use of org.gradle.tooling.BuildLauncher in project dspot by STAMP-project.
the class GradleAutomaticBuilder method runTasks.
protected byte[] runTasks(String pathToRootOfProject, String... tasks) {
ProjectConnection connection = GradleConnector.newConnector().forProjectDirectory(new File(pathToRootOfProject)).connect();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
BuildLauncher build = connection.newBuild();
build.forTasks(tasks);
build.setStandardOutput(outputStream);
build.setStandardError(outputStream);
build.run();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
connection.close();
}
return outputStream.toByteArray();
}
use of org.gradle.tooling.BuildLauncher in project paraphrase by JakeWharton.
the class ToolingApiGradleHandleFactory method start.
public GradleHandle start(File directory, List<String> arguments) {
GradleConnector connector = GradleConnector.newConnector();
connector.forProjectDirectory(directory);
ProjectConnection connection = connector.connect();
BuildLauncher launcher = connection.newBuild();
String[] argumentArray = new String[arguments.size()];
arguments.toArray(argumentArray);
launcher.withArguments(argumentArray);
return new BuildLauncherBackedGradleHandle(launcher);
}
Aggregations