use of org.gradle.launcher.configuration.BuildLayoutResult in project gradle by gradle.
the class LayoutToPropertiesConverter method convert.
public AllProperties convert(InitialProperties initialProperties, BuildLayoutResult layout) {
BuildLayoutParameters layoutParameters = new BuildLayoutParameters();
layout.applyTo(layoutParameters);
Map<String, String> properties = new HashMap<>();
configureFromHomeDir(layoutParameters.getGradleInstallationHomeDir(), properties);
configureFromBuildDir(layoutParameters.getSearchDir(), properties);
configureFromHomeDir(layout.getGradleUserHomeDir(), properties);
configureFromSystemPropertiesOfThisJvm(Cast.uncheckedNonnullCast(properties));
properties.putAll(initialProperties.getRequestedSystemProperties());
return new Result(properties, initialProperties);
}
use of org.gradle.launcher.configuration.BuildLayoutResult in project gradle by gradle.
the class BuildLayoutConverter method convert.
public BuildLayoutResult convert(InitialProperties systemProperties, ParsedCommandLine commandLine, @Nullable File workingDir, Consumer<BuildLayoutParameters> defaults) {
BuildLayoutParameters layoutParameters = new BuildLayoutParameters();
if (workingDir != null) {
layoutParameters.setCurrentDir(workingDir);
}
defaults.accept(layoutParameters);
Map<String, String> requestedSystemProperties = systemProperties.getRequestedSystemProperties();
new BuildLayoutParametersBuildOptions().propertiesConverter().convert(requestedSystemProperties, layoutParameters);
buildLayoutConverter.convert(commandLine, layoutParameters);
return new Result(layoutParameters);
}
use of org.gradle.launcher.configuration.BuildLayoutResult in project gradle by gradle.
the class ProviderConnection method initParams.
private Parameters initParams(ProviderOperationParameters operationParameters) {
CommandLineParser commandLineParser = new CommandLineParser();
commandLineParser.allowUnknownOptions();
commandLineParser.allowMixedSubcommandsAndOptions();
InitialPropertiesConverter initialPropertiesConverter = new InitialPropertiesConverter();
BuildLayoutConverter buildLayoutConverter = new BuildLayoutConverter();
initialPropertiesConverter.configure(commandLineParser);
buildLayoutConverter.configure(commandLineParser);
ParsedCommandLine parsedCommandLine = commandLineParser.parse(operationParameters.getArguments() == null ? Collections.emptyList() : operationParameters.getArguments());
InitialProperties initialProperties = initialPropertiesConverter.convert(parsedCommandLine);
BuildLayoutResult buildLayoutResult = buildLayoutConverter.convert(initialProperties, parsedCommandLine, operationParameters.getProjectDir(), layout -> {
if (operationParameters.getGradleUserHomeDir() != null) {
layout.setGradleUserHomeDir(operationParameters.getGradleUserHomeDir());
}
layout.setProjectDir(operationParameters.getProjectDir());
});
AllProperties properties = new LayoutToPropertiesConverter(buildLayoutFactory).convert(initialProperties, buildLayoutResult);
DaemonParameters daemonParams = new DaemonParameters(buildLayoutResult, fileCollectionFactory);
new DaemonBuildOptions().propertiesConverter().convert(properties.getProperties(), daemonParams);
if (operationParameters.getDaemonBaseDir() != null) {
daemonParams.setBaseDir(operationParameters.getDaemonBaseDir());
}
// override the params with the explicit settings provided by the tooling api
List<String> jvmArguments = operationParameters.getJvmArguments();
if (jvmArguments != null) {
daemonParams.setJvmArgs(jvmArguments);
}
// Include the system properties that are defined in the daemon JVM args
properties = properties.merge(daemonParams.getSystemProperties());
Map<String, String> envVariables = operationParameters.getEnvironmentVariables(null);
if (envVariables != null) {
daemonParams.setEnvironmentVariables(envVariables);
}
File javaHome = operationParameters.getJavaHome();
if (javaHome != null) {
daemonParams.setJvm(Jvm.forHome(javaHome));
}
daemonParams.applyDefaultsFor(jvmVersionDetector.getJavaVersion(daemonParams.getEffectiveJvm()));
if (operationParameters.getDaemonMaxIdleTimeValue() != null && operationParameters.getDaemonMaxIdleTimeUnits() != null) {
int idleTimeout = (int) operationParameters.getDaemonMaxIdleTimeUnits().toMillis(operationParameters.getDaemonMaxIdleTimeValue());
daemonParams.setIdleTimeout(idleTimeout);
}
return new Parameters(daemonParams, buildLayoutResult, properties);
}
use of org.gradle.launcher.configuration.BuildLayoutResult in project gradle by gradle.
the class ParametersConverter method convert.
public Parameters convert(ParsedCommandLine args, @Nullable File currentDir) throws CommandLineArgumentException {
InitialProperties initialProperties = initialPropertiesConverter.convert(args);
BuildLayoutResult buildLayout = buildLayoutConverter.convert(initialProperties, args, currentDir);
AllProperties properties = layoutToPropertiesConverter.convert(initialProperties, buildLayout);
StartParameterInternal startParameter = new StartParameterInternal();
startParameterConverter.convert(args, buildLayout, properties, startParameter);
DaemonParameters daemonParameters = new DaemonParameters(buildLayout, fileCollectionFactory, properties.getRequestedSystemProperties());
daemonParametersConverter.convert(args, properties, daemonParameters);
return new Parameters(buildLayout, startParameter, daemonParameters);
}
Aggregations