use of org.gradle.tooling.internal.build.DefaultBuildEnvironment in project gradle by gradle.
the class BuildEnvironmentBuilder method buildAll.
@Override
public Object buildAll(String modelName, Project target) {
File gradleUserHomeDir = target.getGradle().getGradleUserHomeDir();
String gradleVersion = target.getGradle().getGradleVersion();
CurrentProcess currentProcess = new CurrentProcess(fileCollectionFactory);
File javaHome = currentProcess.getJvm().getJavaHome();
List<String> jvmArgs = currentProcess.getJvmOptions().getAllImmutableJvmArgs();
DefaultBuildIdentifier buildIdentifier = new DefaultBuildIdentifier(target.getRootDir());
return new DefaultBuildEnvironment(buildIdentifier, gradleUserHomeDir, gradleVersion, javaHome, jvmArgs);
}
use of org.gradle.tooling.internal.build.DefaultBuildEnvironment in project gradle by gradle.
the class ProviderConnection method run.
public Object run(String modelName, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
List<String> tasks = providerParameters.getTasks();
if (modelName.equals(ModelIdentifier.NULL_MODEL) && tasks == null) {
throw new IllegalArgumentException("No model type or tasks specified.");
}
Parameters params = initParams(providerParameters);
if (BuildEnvironment.class.getName().equals(modelName)) {
// we don't really need to launch the daemon to acquire information needed for BuildEnvironment
if (tasks != null) {
throw new IllegalArgumentException("Cannot run tasks and fetch the build environment model.");
}
return new DefaultBuildEnvironment(new DefaultBuildIdentifier(providerParameters.getProjectDir()), params.buildLayout.getGradleUserHomeDir(), GradleVersion.current().getVersion(), params.daemonParams.getEffectiveJvm().getJavaHome(), params.daemonParams.getEffectiveJvmArgs());
}
StartParameterInternal startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.buildLayout, params.properties);
ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters, consumerVersion);
BuildAction action = new BuildModelAction(startParameter, modelName, tasks != null, listenerConfig.clientSubscriptions);
return run(action, cancellationToken, listenerConfig, listenerConfig.buildEventConsumer, providerParameters, params);
}
Aggregations