Search in sources :

Example 1 with DefaultBuildIdentifier

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);
}
Also used : DefaultBuildEnvironment(org.gradle.tooling.internal.build.DefaultBuildEnvironment) DefaultBuildIdentifier(org.gradle.tooling.internal.gradle.DefaultBuildIdentifier) CurrentProcess(org.gradle.process.internal.CurrentProcess) File(java.io.File)

Example 2 with DefaultBuildIdentifier

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);
}
Also used : DefaultBuildEnvironment(org.gradle.tooling.internal.build.DefaultBuildEnvironment) StartParameter(org.gradle.StartParameter) ProviderConnectionParameters(org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) ModelMapping(org.gradle.tooling.internal.consumer.versioning.ModelMapping) DefaultBuildIdentifier(org.gradle.tooling.internal.gradle.DefaultBuildIdentifier) InternalBuildAction(org.gradle.tooling.internal.protocol.InternalBuildAction) BuildAction(org.gradle.internal.invocation.BuildAction)

Aggregations

DefaultBuildEnvironment (org.gradle.tooling.internal.build.DefaultBuildEnvironment)2 DefaultBuildIdentifier (org.gradle.tooling.internal.gradle.DefaultBuildIdentifier)2 File (java.io.File)1 StartParameter (org.gradle.StartParameter)1 BuildLayoutParameters (org.gradle.initialization.BuildLayoutParameters)1 BuildAction (org.gradle.internal.invocation.BuildAction)1 DaemonParameters (org.gradle.launcher.daemon.configuration.DaemonParameters)1 BuildActionParameters (org.gradle.launcher.exec.BuildActionParameters)1 CurrentProcess (org.gradle.process.internal.CurrentProcess)1 ModelMapping (org.gradle.tooling.internal.consumer.versioning.ModelMapping)1 InternalBuildAction (org.gradle.tooling.internal.protocol.InternalBuildAction)1 ProviderConnectionParameters (org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters)1 ProviderOperationParameters (org.gradle.tooling.internal.provider.connection.ProviderOperationParameters)1