Search in sources :

Example 1 with DefaultBuildActionParameters

use of org.gradle.launcher.exec.DefaultBuildActionParameters in project gradle by gradle.

the class DaemonBuildActionExecuter method execute.

public Object execute(BuildAction action, BuildRequestContext buildRequestContext, ProviderOperationParameters parameters, ServiceRegistry contextServices) {
    boolean continuous = action.getStartParameter() != null && action.getStartParameter().isContinuous() && isNotBuildingModel(action);
    if (continuous && !doesConsumerSupportCancellation(buildRequestContext)) {
        throw new UnsupportedVersionException("Continuous build requires Tooling API client version 2.1 or later.");
    }
    ClassPath classPath = DefaultClassPath.of(parameters.getInjectedPluginClasspath(Collections.<File>emptyList()));
    BuildActionParameters actionParameters = new DefaultBuildActionParameters(daemonParameters.getEffectiveSystemProperties(), daemonParameters.getEnvironmentVariables(), SystemProperties.getInstance().getCurrentDir(), parameters.getBuildLogLevel(), daemonParameters.isEnabled(), continuous, false, classPath);
    try {
        return executer.execute(action, buildRequestContext, actionParameters, contextServices);
    } catch (ReportedException e) {
        Throwable t = e.getCause();
        while (t != null) {
            if (t instanceof BuildCancelledException) {
                throw new InternalBuildCancelledException(e.getCause());
            }
            t = t.getCause();
        }
        throw new BuildExceptionVersion1(e.getCause());
    }
}
Also used : DefaultClassPath(org.gradle.internal.classpath.DefaultClassPath) ClassPath(org.gradle.internal.classpath.ClassPath) BuildExceptionVersion1(org.gradle.tooling.internal.protocol.BuildExceptionVersion1) DefaultBuildActionParameters(org.gradle.launcher.exec.DefaultBuildActionParameters) DefaultBuildActionParameters(org.gradle.launcher.exec.DefaultBuildActionParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) File(java.io.File) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException) BuildCancelledException(org.gradle.api.BuildCancelledException) UnsupportedVersionException(org.gradle.tooling.UnsupportedVersionException) ReportedException(org.gradle.initialization.ReportedException) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException)

Aggregations

File (java.io.File)1 BuildCancelledException (org.gradle.api.BuildCancelledException)1 ReportedException (org.gradle.initialization.ReportedException)1 ClassPath (org.gradle.internal.classpath.ClassPath)1 DefaultClassPath (org.gradle.internal.classpath.DefaultClassPath)1 BuildActionParameters (org.gradle.launcher.exec.BuildActionParameters)1 DefaultBuildActionParameters (org.gradle.launcher.exec.DefaultBuildActionParameters)1 UnsupportedVersionException (org.gradle.tooling.UnsupportedVersionException)1 BuildExceptionVersion1 (org.gradle.tooling.internal.protocol.BuildExceptionVersion1)1 InternalBuildCancelledException (org.gradle.tooling.internal.protocol.InternalBuildCancelledException)1