Search in sources :

Example 6 with StartParameterInternal

use of org.gradle.api.internal.StartParameterInternal in project gradle by gradle.

the class ProviderConnection method runTests.

public Object runTests(ProviderInternalTestExecutionRequest testExecutionRequest, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    Parameters params = initParams(providerParameters);
    StartParameterInternal startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.properties);
    ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters);
    TestExecutionRequestAction action = TestExecutionRequestAction.create(listenerConfig.clientSubscriptions, startParameter, testExecutionRequest);
    return run(action, cancellationToken, listenerConfig, providerParameters, params);
}
Also used : ProviderConnectionParameters(org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) StartParameterInternal(org.gradle.api.internal.StartParameterInternal)

Example 7 with StartParameterInternal

use of org.gradle.api.internal.StartParameterInternal in project gradle by gradle.

the class ProviderStartParameterConverter method toStartParameter.

public StartParameterInternal toStartParameter(ProviderOperationParameters parameters, Map<String, String> properties) {
    // Important that this is constructed on the client so that it has the right gradleHomeDir and other state internally
    StartParameterInternal startParameter = new StartParameterInternal();
    startParameter.setProjectDir(parameters.getProjectDir());
    if (parameters.getGradleUserHomeDir() != null) {
        startParameter.setGradleUserHomeDir(parameters.getGradleUserHomeDir());
    }
    List<InternalLaunchable> launchables = parameters.getLaunchables(null);
    if (launchables != null) {
        startParameter.setTaskRequests(unpack(launchables, parameters.getProjectDir()));
    } else if (parameters.getTasks() != null) {
        startParameter.setTaskNames(parameters.getTasks());
    }
    new PropertiesToStartParameterConverter().convert(properties, startParameter);
    List<String> arguments = parameters.getArguments();
    if (arguments != null) {
        DefaultCommandLineConverter converter = new DefaultCommandLineConverter();
        try {
            converter.convert(arguments, startParameter);
        } catch (CommandLineArgumentException e) {
            throw new InternalUnsupportedBuildArgumentException("Problem with provided build arguments: " + arguments + ". " + "\n" + e.getMessage() + "\nEither it is not a valid build option or it is not supported in the target Gradle version." + "\nNot all of the Gradle command line options are supported build arguments." + "\nExamples of supported build arguments: '--info', '-u', '-p'." + "\nExamples of unsupported build options: '--daemon', '-?', '-v'." + "\nPlease find more information in the javadoc for the BuildLauncher class.", e);
        }
    }
    if (parameters.isSearchUpwards() != null) {
        startParameter.setSearchUpwards(parameters.isSearchUpwards());
    }
    if (parameters.getBuildLogLevel() != null) {
        startParameter.setLogLevel(parameters.getBuildLogLevel());
    }
    if (parameters.getStandardInput() != null) {
        startParameter.setInteractive(true);
    }
    return startParameter;
}
Also used : DefaultCommandLineConverter(org.gradle.initialization.DefaultCommandLineConverter) StartParameterInternal(org.gradle.api.internal.StartParameterInternal) PropertiesToStartParameterConverter(org.gradle.launcher.cli.converter.PropertiesToStartParameterConverter) InternalUnsupportedBuildArgumentException(org.gradle.tooling.internal.protocol.exceptions.InternalUnsupportedBuildArgumentException) CommandLineArgumentException(org.gradle.cli.CommandLineArgumentException) InternalLaunchable(org.gradle.tooling.internal.protocol.InternalLaunchable)

Aggregations

StartParameterInternal (org.gradle.api.internal.StartParameterInternal)7 BuildActionParameters (org.gradle.launcher.exec.BuildActionParameters)4 BuildLayoutParameters (org.gradle.initialization.BuildLayoutParameters)3 BuildAction (org.gradle.internal.invocation.BuildAction)3 DaemonParameters (org.gradle.launcher.daemon.configuration.DaemonParameters)3 ProviderConnectionParameters (org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters)3 ProviderOperationParameters (org.gradle.tooling.internal.provider.connection.ProviderOperationParameters)3 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 BuildResult (org.gradle.BuildResult)1 StartParameter (org.gradle.StartParameter)1 GradleInternal (org.gradle.api.internal.GradleInternal)1 FileResolver (org.gradle.api.internal.file.FileResolver)1 ClassLoaderScope (org.gradle.api.internal.initialization.ClassLoaderScope)1 IProjectFactory (org.gradle.api.internal.project.IProjectFactory)1 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 CommandLineArgumentException (org.gradle.cli.CommandLineArgumentException)1 CommandLineParser (org.gradle.cli.CommandLineParser)1 BuildRequestContext (org.gradle.initialization.BuildRequestContext)1