use of org.gradle.StartParameter in project gradle by gradle.
the class BuildCacheTaskServices method doCreateBuildCacheController.
private BuildCacheController doCreateBuildCacheController(ServiceRegistry serviceRegistry, BuildCacheConfigurationInternal buildCacheConfiguration, BuildOperationExecutor buildOperationExecutor, InstantiatorFactory instantiatorFactory, GradleInternal gradle) {
StartParameter startParameter = gradle.getStartParameter();
Path buildIdentityPath = gradle.getIdentityPath();
File gradleUserHomeDir = gradle.getGradleUserHomeDir();
BuildCacheMode buildCacheMode = startParameter.isBuildCacheEnabled() ? ENABLED : DISABLED;
RemoteAccessMode remoteAccessMode = startParameter.isOffline() ? OFFLINE : ONLINE;
boolean logStackTraces = startParameter.getShowStacktrace() != ShowStacktrace.INTERNAL_EXCEPTIONS;
return BuildCacheControllerFactory.create(buildOperationExecutor, buildIdentityPath, gradleUserHomeDir, buildCacheConfiguration, buildCacheMode, remoteAccessMode, logStackTraces, instantiatorFactory.inject(serviceRegistry));
}
use of org.gradle.StartParameter in project gradle by gradle.
the class ParallelismConfigurationBuildActionExecuter method execute.
@Override
public Object execute(BuildAction action, BuildRequestContext requestContext, BuildActionParameters actionParameters, ServiceRegistry contextServices) {
StartParameter startParameter = action.getStartParameter();
parallelismConfigurationManager.setParallelismConfiguration(new DefaultParallelismConfiguration(startParameter.isParallelProjectExecutionEnabled(), startParameter.getMaxWorkerCount()));
try {
return delegate.execute(action, requestContext, actionParameters, contextServices);
} finally {
parallelismConfigurationManager.setParallelismConfiguration(DefaultParallelismConfiguration.DEFAULT);
}
}
use of org.gradle.StartParameter in project gradle by gradle.
the class ServicesSetupBuildActionExecuter method execute.
@Override
public Object execute(BuildAction action, BuildRequestContext requestContext, BuildActionParameters actionParameters, ServiceRegistry contextServices) {
StartParameter startParameter = action.getStartParameter();
final ServiceRegistry userHomeServices = userHomeServiceRegistry.getServicesFor(startParameter.getGradleUserHomeDir());
CrossBuildSessionScopeServices crossBuildSessionScopeServices = new CrossBuildSessionScopeServices(contextServices, startParameter);
try {
ServiceRegistry buildSessionScopeServices = new BuildSessionScopeServices(userHomeServices, crossBuildSessionScopeServices, startParameter, requestContext, actionParameters.getInjectedPluginClasspath());
try {
SessionLifecycleListener sessionLifecycleListener = buildSessionScopeServices.get(ListenerManager.class).getBroadcaster(SessionLifecycleListener.class);
try {
sessionLifecycleListener.afterStart();
return delegate.execute(action, requestContext, actionParameters, buildSessionScopeServices);
} finally {
sessionLifecycleListener.beforeComplete();
}
} finally {
CompositeStoppable.stoppable(buildSessionScopeServices).stop();
}
} finally {
new CompositeStoppable().add(new Stoppable() {
@Override
public void stop() {
userHomeServiceRegistry.release(userHomeServices);
}
}, crossBuildSessionScopeServices).stop();
}
}
use of org.gradle.StartParameter in project gradle by gradle.
the class DefaultAutoAppliedPluginRegistry method shouldApplyGradleEnterprisePlugin.
private boolean shouldApplyGradleEnterprisePlugin(Settings settings) {
Gradle gradle = settings.getGradle();
StartParameter startParameter = gradle.getStartParameter();
return startParameter.isBuildScan() && gradle.getParent() == null;
}
use of org.gradle.StartParameter in project gradle by gradle.
the class StartParamsValidatingActionExecuter method execute.
@Override
public BuildActionResult execute(BuildAction action, BuildActionParameters actionParameters, BuildRequestContext requestContext) {
StartParameter startParameter = action.getStartParameter();
@SuppressWarnings("deprecation") File customBuildFile = startParameter.getBuildFile();
if (customBuildFile != null) {
validateIsFileAndExists(customBuildFile, "build file");
}
if (startParameter.getProjectDir() != null) {
if (!startParameter.getProjectDir().isDirectory()) {
if (!startParameter.getProjectDir().exists()) {
throw new IllegalArgumentException(String.format("The specified project directory '%s' does not exist.", startParameter.getProjectDir()));
}
throw new IllegalArgumentException(String.format("The specified project directory '%s' is not a directory.", startParameter.getProjectDir()));
}
}
@SuppressWarnings("deprecation") File customSettingsFile = startParameter.getSettingsFile();
if (customSettingsFile != null) {
validateIsFileAndExists(customSettingsFile, "settings file");
}
for (File initScript : startParameter.getInitScripts()) {
validateIsFileAndExists(initScript, "initialization script");
}
return delegate.execute(action, actionParameters, requestContext);
}
Aggregations