use of org.gradle.launcher.exec.BuildActionParameters in project gradle by gradle.
the class BuildActionsFactory method runBuildAndCloseServices.
private Runnable runBuildAndCloseServices(StartParameter startParameter, DaemonParameters daemonParameters, BuildActionExecuter<BuildActionParameters> executer, ServiceRegistry sharedServices, Object... stopBeforeSharedServices) {
BuildActionParameters parameters = createBuildActionParamters(startParameter, daemonParameters);
Stoppable stoppable = new CompositeStoppable().add(stopBeforeSharedServices).add(sharedServices);
return new RunBuildAction(executer, startParameter, clientMetaData(), getBuildStartTime(), parameters, sharedServices, stoppable);
}
use of org.gradle.launcher.exec.BuildActionParameters in project gradle by gradle.
the class BuildActionsFactory method runBuildAndCloseServices.
private Runnable runBuildAndCloseServices(StartParameterInternal startParameter, DaemonParameters daemonParameters, BuildActionExecuter<BuildActionParameters> executer, ServiceRegistry sharedServices, Object... stopBeforeSharedServices) {
BuildActionParameters parameters = createBuildActionParameters(startParameter, daemonParameters);
Stoppable stoppable = new CompositeStoppable().add(stopBeforeSharedServices).add(sharedServices);
return new RunBuildAction(executer, startParameter, clientMetaData(), getBuildStartTime(), parameters, sharedServices, stoppable);
}
use of org.gradle.launcher.exec.BuildActionParameters in project gradle by gradle.
the class InProcessGradleExecuter method executeBuild.
private BuildResult executeBuild(GradleInvocation invocation, OutputStream outputStream, OutputStream errorStream, BuildListenerImpl listener) {
// Augment the environment for the execution
System.setIn(connectStdIn());
processEnvironment.maybeSetProcessDir(getWorkingDir());
for (Map.Entry<String, String> entry : invocation.environmentVars.entrySet()) {
processEnvironment.maybeSetEnvironmentVariable(entry.getKey(), entry.getValue());
}
Map<String, String> implicitJvmSystemProperties = getImplicitJvmSystemProperties();
System.getProperties().putAll(implicitJvmSystemProperties);
// TODO: Reuse more of CommandlineActionFactory
CommandLineParser parser = new CommandLineParser();
FileCollectionFactory fileCollectionFactory = TestFiles.fileCollectionFactory();
ParametersConverter parametersConverter = new ParametersConverter(new BuildLayoutFactory(), fileCollectionFactory);
parametersConverter.configure(parser);
Parameters parameters = parametersConverter.convert(parser.parse(getAllArgs()), getWorkingDir());
BuildActionExecuter<BuildActionParameters, BuildRequestContext> actionExecuter = GLOBAL_SERVICES.get(BuildActionExecuter.class);
ListenerManager listenerManager = GLOBAL_SERVICES.get(ListenerManager.class);
listenerManager.addListener(listener);
try {
// TODO: Reuse more of BuildActionsFactory
StartParameterInternal startParameter = parameters.getStartParameter();
BuildAction action = new ExecuteBuildAction(startParameter);
BuildActionParameters buildActionParameters = createBuildActionParameters(startParameter);
BuildRequestContext buildRequestContext = createBuildRequestContext();
LoggingManagerInternal loggingManager = createLoggingManager(startParameter, outputStream, errorStream);
loggingManager.start();
try {
startMeasurement();
try {
BuildActionResult result = actionExecuter.execute(action, buildActionParameters, buildRequestContext);
if (result.getException() != null) {
return new BuildResult(null, result.getException());
}
if (result.getFailure() != null) {
PayloadSerializer payloadSerializer = new PayloadSerializer(new TestClassLoaderRegistry());
return new BuildResult(null, (RuntimeException) payloadSerializer.deserialize(result.getFailure()));
}
return new BuildResult(null, null);
} finally {
stopMeasurement();
}
} finally {
loggingManager.stop();
}
} finally {
listenerManager.removeListener(listener);
}
}
use of org.gradle.launcher.exec.BuildActionParameters in project gradle by gradle.
the class BuildActionsFactory method runBuildAndCloseServices.
private Runnable runBuildAndCloseServices(StartParameterInternal startParameter, DaemonParameters daemonParameters, BuildActionExecuter<BuildActionParameters, BuildRequestContext> executer, ServiceRegistry sharedServices, Object... stopBeforeSharedServices) {
BuildActionParameters parameters = createBuildActionParameters(startParameter, daemonParameters);
Stoppable stoppable = new CompositeStoppable().add(stopBeforeSharedServices).add(sharedServices);
return new RunBuildAction(executer, startParameter, clientMetaData(), getBuildStartTime(), parameters, sharedServices, stoppable);
}
use of org.gradle.launcher.exec.BuildActionParameters in project gradle by gradle.
the class ProviderConnection method createExecuter.
private BuildActionExecuter<ConnectionOperationParameters, BuildRequestContext> createExecuter(ProviderOperationParameters operationParameters, Parameters params) {
LoggingManagerInternal loggingManager;
BuildActionExecuter<BuildActionParameters, BuildRequestContext> executer;
InputStream standardInput = operationParameters.getStandardInput();
if (standardInput == null) {
standardInput = SafeStreams.emptyInput();
}
if (Boolean.TRUE.equals(operationParameters.isEmbedded())) {
loggingManager = sharedServices.getFactory(LoggingManagerInternal.class).create();
loggingManager.captureSystemSources();
executer = new StdInSwapExecuter(standardInput, embeddedExecutor);
} else {
LoggingServiceRegistry loggingServices = LoggingServiceRegistry.newNestedLogging();
loggingManager = loggingServices.getFactory(LoggingManagerInternal.class).create();
ServiceRegistry clientServices = daemonClientFactory.createBuildClientServices(loggingServices.get(OutputEventListener.class), params.daemonParams, standardInput);
executer = clientServices.get(DaemonClient.class);
}
return new LoggingBridgingBuildActionExecuter(new DaemonBuildActionExecuter(executer), loggingManager);
}
Aggregations