本文整理汇总了Java中org.gradle.initialization.BuildLayoutParameters类的典型用法代码示例。如果您正苦于以下问题:Java BuildLayoutParameters类的具体用法?Java BuildLayoutParameters怎么用?Java BuildLayoutParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BuildLayoutParameters类属于org.gradle.initialization包,在下文中一共展示了BuildLayoutParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StartParameter
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
/**
* Creates a {@code StartParameter} with default values. This is roughly equivalent to running Gradle on the command-line with no arguments.
*/
public StartParameter() {
GradleInstallation gradleInstallation = CurrentGradleInstallation.get();
if (gradleInstallation == null) {
gradleHomeDir = null;
} else {
gradleHomeDir = gradleInstallation.getGradleHome();
}
BuildLayoutParameters layoutParameters = new BuildLayoutParameters();
searchUpwards = layoutParameters.getSearchUpwards();
currentDir = layoutParameters.getCurrentDir();
projectDir = layoutParameters.getProjectDir();
gradleUserHomeDir = layoutParameters.getGradleUserHomeDir();
maxWorkerCount = Runtime.getRuntime().availableProcessors();
}
示例2: execute
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
public void execute(ExecutionListener executionListener) {
CommandLineConverter<LoggingConfiguration> loggingConfigurationConverter = new LoggingCommandLineConverter();
CommandLineConverter<BuildLayoutParameters> buildLayoutConverter = new LayoutCommandLineConverter();
BuildLayoutParameters buildLayout = new BuildLayoutParameters();
CommandLineParser parser = new CommandLineParser();
loggingConfigurationConverter.configure(parser);
buildLayoutConverter.configure(parser);
parser.allowUnknownOptions();
parser.allowMixedSubcommandsAndOptions();
try {
ParsedCommandLine parsedCommandLine = parser.parse(args);
loggingConfigurationConverter.convert(parsedCommandLine, loggingConfiguration);
buildLayoutConverter.convert(parsedCommandLine, buildLayout);
} catch (CommandLineArgumentException e) {
// Ignore, deal with this problem later
}
LoggingManagerInternal loggingManager = loggingServices.getFactory(LoggingManagerInternal.class).create();
loggingManager.setLevel(loggingConfiguration.getLogLevel());
loggingManager.start();
NativeServices.initialize(buildLayout.getGradleUserHomeDir());
loggingManager.attachConsole(loggingConfiguration.isColorOutput());
action.execute(executionListener);
}
示例3: initParams
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
private Parameters initParams(ProviderOperationParameters operationParameters) {
BuildLayoutParameters layout = new BuildLayoutParameters()
.setGradleUserHomeDir(GUtil.elvis(operationParameters.getGradleUserHomeDir(), StartParameter.DEFAULT_GRADLE_USER_HOME))
.setSearchUpwards(operationParameters.isSearchUpwards() != null ? operationParameters.isSearchUpwards() : true)
.setProjectDir(operationParameters.getProjectDir());
Map<String, String> properties = new HashMap<String, String>();
new LayoutToPropertiesConverter().convert(layout, properties);
DaemonParameters daemonParams = new DaemonParameters(layout);
new PropertiesToDaemonParametersConverter().convert(properties, daemonParams);
//override the params with the explicit settings provided by the tooling api
List<String> defaultJvmArgs = daemonParams.getAllJvmArgs();
daemonParams.setJvmArgs(operationParameters.getJvmArguments(defaultJvmArgs));
File defaultJavaHome = daemonParams.getEffectiveJavaHome();
daemonParams.setJavaHome(operationParameters.getJavaHome(defaultJavaHome));
if (operationParameters.getDaemonMaxIdleTimeValue() != null && operationParameters.getDaemonMaxIdleTimeUnits() != null) {
int idleTimeout = (int) operationParameters.getDaemonMaxIdleTimeUnits().toMillis(operationParameters.getDaemonMaxIdleTimeValue());
daemonParams.setIdleTimeout(idleTimeout);
}
return new Parameters(daemonParams, properties);
}
示例4: convert
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
public Map<String, String> convert(BuildLayoutParameters layout, Map<String, String> properties) {
configureFromBuildDir(layout.getSearchDir(), layout.getSearchUpwards(), properties);
configureFromGradleUserHome(layout.getGradleUserHomeDir(), properties);
Map<Object, Object> systemProperties = new HashMap<Object, Object>(System.getProperties());
Map filteredSystemProperties = filterNonSerializableEntries(systemProperties);
properties.putAll(filteredSystemProperties);
return properties;
}
示例5: execute
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
public void execute(ExecutionListener executionListener) {
CommandLineConverter<LoggingConfiguration> loggingConfigurationConverter = new LoggingCommandLineConverter();
CommandLineConverter<BuildLayoutParameters> buildLayoutConverter = new LayoutCommandLineConverter();
BuildLayoutParameters buildLayout = new BuildLayoutParameters();
CommandLineParser parser = new CommandLineParser();
loggingConfigurationConverter.configure(parser);
buildLayoutConverter.configure(parser);
parser.allowUnknownOptions();
parser.allowMixedSubcommandsAndOptions();
try {
ParsedCommandLine parsedCommandLine = parser.parse(args);
loggingConfigurationConverter.convert(parsedCommandLine, loggingConfiguration);
buildLayoutConverter.convert(parsedCommandLine, buildLayout);
} catch (CommandLineArgumentException e) {
// Ignore, deal with this problem later
}
LoggingManagerInternal loggingManager = loggingServices.getFactory(LoggingManagerInternal.class).create();
loggingManager.setLevelInternal(loggingConfiguration.getLogLevel());
loggingManager.start();
try {
NativeServices.initialize(buildLayout.getGradleUserHomeDir());
loggingManager.attachProcessConsole(loggingConfiguration.getConsoleOutput());
action.execute(executionListener);
} finally {
loggingManager.stop();
}
}
示例6: initParams
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
private Parameters initParams(ProviderOperationParameters operationParameters) {
BuildLayoutParameters layout = new BuildLayoutParameters();
if (operationParameters.getGradleUserHomeDir() != null) {
layout.setGradleUserHomeDir(operationParameters.getGradleUserHomeDir());
}
layout.setSearchUpwards(operationParameters.isSearchUpwards() != null ? operationParameters.isSearchUpwards() : true);
layout.setProjectDir(operationParameters.getProjectDir());
Map<String, String> properties = new HashMap<String, String>();
new LayoutToPropertiesConverter().convert(layout, properties);
DaemonParameters daemonParams = new DaemonParameters(layout);
new PropertiesToDaemonParametersConverter().convert(properties, daemonParams);
if (operationParameters.getDaemonBaseDir(null) != null) {
daemonParams.setBaseDir(operationParameters.getDaemonBaseDir(null));
}
//override the params with the explicit settings provided by the tooling api
List<String> jvmArguments = operationParameters.getJvmArguments();
if (jvmArguments != null) {
daemonParams.setJvmArgs(jvmArguments);
}
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, properties, layout.getGradleUserHomeDir());
}
示例7: configure
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
/**
* This is used by consumers 1.2-rc-1 and later.
*/
public void configure(ConnectionParameters parameters) {
UnsupportedJavaRuntimeException.assertUsingVersion("Gradle", JavaVersion.VERSION_1_7);
ProviderConnectionParameters providerConnectionParameters = new ProtocolToModelAdapter().adapt(ProviderConnectionParameters.class, parameters);
File gradleUserHomeDir = providerConnectionParameters.getGradleUserHomeDir(null);
if (gradleUserHomeDir == null) {
gradleUserHomeDir = new BuildLayoutParameters().getGradleUserHomeDir();
}
initializeServices(gradleUserHomeDir);
connection.configure(providerConnectionParameters);
consumerVersion = GradleVersion.version(providerConnectionParameters.getConsumerVersion());
supportedConsumerVersion = consumerVersion.compareTo(MIN_CLIENT_VERSION) >= 0;
}
示例8: setCurrentDir
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
/**
* Sets the directory to use to select the default project, and to search for the settings file. Set to null to use the default current directory.
*
* @param currentDir The directory. Set to null to use the default.
*/
public void setCurrentDir(File currentDir) {
if (currentDir != null) {
this.currentDir = FileUtils.canonicalize(currentDir);
} else {
this.currentDir = new BuildLayoutParameters().getCurrentDir();
}
}
示例9: mergeJvmArgs
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
private static List<String> mergeJvmArgs(String serviceDirectory, Iterable<String> jvmArgs1, Iterable<String> jvmArgs2) {
File gradleUserHomeDir = serviceDirectory != null ? new File(serviceDirectory) : new BuildLayoutParameters().getGradleUserHomeDir();
LOG.debug("Gradle home: " + gradleUserHomeDir);
NativeServices.initialize(gradleUserHomeDir, false);
JvmOptions jvmOptions = new JvmOptions(null);
jvmOptions.setAllJvmArgs(ContainerUtil.concat(jvmArgs1, jvmArgs2));
return jvmOptions.getAllJvmArgs();
}
示例10: convert
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
public Map<String, String> convert(BuildLayoutParameters layout, Map<String, String> properties) {
configureFromBuildDir(layout.getSearchDir(), layout.getSearchUpwards(), properties);
configureFromGradleUserHome(layout.getGradleUserHomeDir(), properties);
properties.putAll(Maps.filterEntries((Map) System.getProperties(), new Predicate<Map.Entry<?, ?>>() {
public boolean apply(Map.Entry<?, ?> input) {
return input.getKey() instanceof Serializable
&& (input.getValue() instanceof Serializable || input.getValue() == null);
}
}));
return properties;
}
示例11: createAction
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
public Runnable createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
BuildLayoutParameters layout = new BuildLayoutParameters();
layoutConverter.convert(commandLine, layout);
Map<String, String> properties = new HashMap<String, String>();
layoutToPropertiesConverter.convert(layout, properties);
propertiesConverter.convert(commandLine, properties);
StartParameter startParameter = new StartParameter();
propertiesToStartParameterConverter.convert(properties, startParameter);
commandLineConverter.convert(commandLine, startParameter);
DaemonParameters daemonParameters = new DaemonParameters(layout, startParameter.getSystemPropertiesArgs());
propertiesToDaemonParametersConverter.convert(properties, daemonParameters);
daemonConverter.convert(commandLine, daemonParameters);
if (commandLine.hasOption(STOP)) {
return stopAllDaemons(daemonParameters, loggingServices);
}
if (commandLine.hasOption(FOREGROUND)) {
ForegroundDaemonConfiguration conf = new ForegroundDaemonConfiguration(
daemonParameters.getUid(), daemonParameters.getBaseDir(), daemonParameters.getIdleTimeout());
return new ForegroundDaemonAction(loggingServices, conf);
}
if (daemonParameters.isEnabled()) {
return runBuildWithDaemon(startParameter, daemonParameters, loggingServices);
}
if (canUseCurrentProcess(daemonParameters)) {
return runBuildInProcess(startParameter, daemonParameters, loggingServices);
}
return runBuildInSingleUseDaemon(startParameter, daemonParameters, loggingServices);
}
示例12: initParams
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
private Parameters initParams(ProviderOperationParameters operationParameters) {
BuildLayoutParameters layout = new BuildLayoutParameters();
if (operationParameters.getGradleUserHomeDir() != null) {
layout.setGradleUserHomeDir(operationParameters.getGradleUserHomeDir());
}
layout.setSearchUpwards(operationParameters.isSearchUpwards() != null ? operationParameters.isSearchUpwards() : true);
layout.setProjectDir(operationParameters.getProjectDir());
Map<String, String> properties = new HashMap<String, String>();
new LayoutToPropertiesConverter().convert(layout, properties);
DaemonParameters daemonParams = new DaemonParameters(layout);
new PropertiesToDaemonParametersConverter().convert(properties, daemonParams);
if (operationParameters.getDaemonBaseDir(null) != null) {
daemonParams.setBaseDir(operationParameters.getDaemonBaseDir(null));
}
//override the params with the explicit settings provided by the tooling api
List<String> defaultJvmArgs = daemonParams.getAllJvmArgs();
daemonParams.setJvmArgs(operationParameters.getJvmArguments(defaultJvmArgs));
File defaultJavaHome = daemonParams.getEffectiveJavaHome();
daemonParams.setJavaHome(operationParameters.getJavaHome(defaultJavaHome));
if (operationParameters.getDaemonMaxIdleTimeValue() != null && operationParameters.getDaemonMaxIdleTimeUnits() != null) {
int idleTimeout = (int) operationParameters.getDaemonMaxIdleTimeUnits().toMillis(operationParameters.getDaemonMaxIdleTimeValue());
daemonParams.setIdleTimeout(idleTimeout);
}
return new Parameters(daemonParams, properties);
}
示例13: StartParameter
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
/**
* Creates a {@code StartParameter} with default values. This is roughly equivalent to running Gradle on the command-line with no arguments.
*/
public StartParameter() {
gradleHomeDir = new DefaultModuleRegistry().getGradleHome();
BuildLayoutParameters layoutParameters = new BuildLayoutParameters();
searchUpwards = layoutParameters.getSearchUpwards();
currentDir = layoutParameters.getCurrentDir();
projectDir = layoutParameters.getProjectDir();
gradleUserHomeDir = layoutParameters.getGradleUserHomeDir();
}
示例14: setCurrentDir
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
/**
* Sets the directory to use to select the default project, and to search for the settings file. Set to null to use the default current directory.
*
* @param currentDir The directory. Set to null to use the default.
*/
public void setCurrentDir(File currentDir) {
if (currentDir != null) {
this.currentDir = GFileUtils.canonicalise(currentDir);
} else {
this.currentDir = new BuildLayoutParameters().getCurrentDir();
}
}
示例15: createAction
import org.gradle.initialization.BuildLayoutParameters; //导入依赖的package包/类
public Action<? super ExecutionListener> createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
BuildLayoutParameters layout = new BuildLayoutParameters();
layoutConverter.convert(commandLine, layout);
Map<String, String> properties = new HashMap<String, String>();
layoutToPropertiesConverter.convert(layout, properties);
propertiesConverter.convert(commandLine, properties);
StartParameter startParameter = new StartParameter();
propertiesToStartParameterConverter.convert(properties, startParameter);
commandLineConverter.convert(commandLine, startParameter);
DaemonParameters daemonParameters = new DaemonParameters(layout);
propertiesToDaemonParametersConverter.convert(properties, daemonParameters);
daemonConverter.convert(commandLine, daemonParameters);
if (commandLine.hasOption(STOP)) {
return stopAllDaemons(daemonParameters, loggingServices);
}
if (commandLine.hasOption(FOREGROUND)) {
ForegroundDaemonConfiguration conf = new ForegroundDaemonConfiguration(
daemonParameters.getUid(), daemonParameters.getBaseDir(), daemonParameters.getIdleTimeout());
return Actions.toAction(new ForegroundDaemonMain(conf));
}
if (daemonParameters.isEnabled()) {
return runBuildWithDaemon(startParameter, daemonParameters, loggingServices);
}
if (canUseCurrentProcess(daemonParameters)) {
return runBuildInProcess(startParameter, daemonParameters, loggingServices);
}
return runBuildInSingleUseDaemon(startParameter, daemonParameters, loggingServices);
}