當前位置: 首頁>>代碼示例>>Java>>正文


Java BuildLayoutParameters類代碼示例

本文整理匯總了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();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:19,代碼來源:StartParameter.java

示例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);
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:27,代碼來源:CommandLineActionFactory.java

示例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);
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:25,代碼來源:ProviderConnection.java

示例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;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:9,代碼來源:LayoutToPropertiesConverter.java

示例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();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:29,代碼來源:CommandLineActionFactory.java

示例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());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:36,代碼來源:ProviderConnection.java

示例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;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:16,代碼來源:DefaultConnection.java

示例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();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:StartParameter.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:GradleExecutionHelper.java

示例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;
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:12,代碼來源:LayoutToPropertiesConverter.java

示例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);
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:33,代碼來源:BuildActionsFactory.java

示例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);
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:31,代碼來源:ProviderConnection.java

示例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();
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:13,代碼來源:StartParameter.java

示例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();
    }
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:13,代碼來源:StartParameter.java

示例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);
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:33,代碼來源:BuildActionsFactory.java


注:本文中的org.gradle.initialization.BuildLayoutParameters類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。