use of org.gradle.tooling.internal.gradle.DefaultBuildIdentifier 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();
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.gradle.DefaultBuildIdentifier 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);
Class<?> type = new ModelMapping().getProtocolTypeFromModelName(modelName);
if (type == InternalBuildEnvironment.class) {
//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.gradleUserhome, GradleVersion.current().getVersion(), params.daemonParams.getEffectiveJvm().getJavaHome(), params.daemonParams.getEffectiveJvmArgs());
}
StartParameter startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.properties);
ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters);
BuildAction action = new BuildModelAction(startParameter, modelName, tasks != null, listenerConfig.clientSubscriptions);
return run(action, cancellationToken, listenerConfig, providerParameters, params);
}
Aggregations