Java Code Examples for org.gradle.StartParameter#setProfile()

The following examples show how to use org.gradle.StartParameter#setProfile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuildSourceBuilder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private GradleLauncher buildGradleLauncher(StartParameter startParameter) {
    final StartParameter startParameterArg = startParameter.newInstance();
    startParameterArg.setProjectProperties(startParameter.getProjectProperties());
    startParameterArg.setSearchUpwards(false);
    startParameterArg.setProfile(startParameter.isProfile());
    return gradleLauncherFactory.newInstance(startParameterArg, cancellationToken);
}
 
Example 2
Source File: BuildSourceBuilder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private GradleLauncher buildGradleLauncher(StartParameter startParameter) {
    final StartParameter startParameterArg = startParameter.newInstance();
    startParameterArg.setProjectProperties(startParameter.getProjectProperties());
    startParameterArg.setSearchUpwards(false);
    startParameterArg.setProfile(startParameter.isProfile());
    return gradleLauncherFactory.newInstance(startParameterArg);
}
 
Example 3
Source File: BuildSourceBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private GradleLauncher buildGradleLauncher(StartParameter startParameter) {
    final StartParameter startParameterArg = startParameter.newInstance();
    startParameterArg.setProjectProperties(startParameter.getProjectProperties());
    startParameterArg.setSearchUpwards(false);
    startParameterArg.setProfile(startParameter.isProfile());
    return gradleLauncherFactory.newInstance(startParameterArg, cancellationToken);
}
 
Example 4
Source File: BuildSourceBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private GradleLauncher buildGradleLauncher(StartParameter startParameter) {
    final StartParameter startParameterArg = startParameter.newInstance();
    startParameterArg.setProjectProperties(startParameter.getProjectProperties());
    startParameterArg.setSearchUpwards(false);
    startParameterArg.setProfile(startParameter.isProfile());
    return gradleLauncherFactory.newInstance(startParameterArg);
}
 
Example 5
Source File: DefaultCommandLineConverter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public StartParameter convert(final ParsedCommandLine options, final StartParameter startParameter) throws CommandLineArgumentException {
    loggingConfigurationCommandLineConverter.convert(options, startParameter);
    Transformer<File, String> resolver = new BasicFileResolver(startParameter.getCurrentDir());

    Map<String, String> systemProperties = systemPropertiesCommandLineConverter.convert(options, new HashMap<String, String>());
    convertCommandLineSystemProperties(systemProperties, startParameter, resolver);

    Map<String, String> projectProperties = projectPropertiesCommandLineConverter.convert(options, new HashMap<String, String>());
    startParameter.getProjectProperties().putAll(projectProperties);

    BuildLayoutParameters layout = new BuildLayoutParameters()
            .setGradleUserHomeDir(startParameter.getGradleUserHomeDir())
            .setProjectDir(startParameter.getProjectDir())
            .setCurrentDir(startParameter.getCurrentDir());
    layoutCommandLineConverter.convert(options, layout);
    startParameter.setGradleUserHomeDir(layout.getGradleUserHomeDir());
    if (layout.getProjectDir() != null) {
        startParameter.setProjectDir(layout.getProjectDir());
    }
    startParameter.setSearchUpwards(layout.getSearchUpwards());

    if (options.hasOption(BUILD_FILE)) {
        startParameter.setBuildFile(resolver.transform(options.option(BUILD_FILE).getValue()));
    }
    if (options.hasOption(SETTINGS_FILE)) {
        startParameter.setSettingsFile(resolver.transform(options.option(SETTINGS_FILE).getValue()));
    }

    for (String script : options.option(INIT_SCRIPT).getValues()) {
        startParameter.addInitScript(resolver.transform(script));
    }

    if (options.hasOption(PROJECT_CACHE_DIR)) {
        startParameter.setProjectCacheDir(resolver.transform(options.option(PROJECT_CACHE_DIR).getValue()));
    }

    if (options.hasOption(NO_PROJECT_DEPENDENCY_REBUILD)) {
        startParameter.setBuildProjectDependencies(false);
    }

    if (!options.getExtraArguments().isEmpty()) {
        startParameter.setTaskNames(options.getExtraArguments());
    }

    if (options.hasOption(DRY_RUN)) {
        startParameter.setDryRun(true);
    }

    if (options.hasOption(RERUN_TASKS)) {
        startParameter.setRerunTasks(true);
    }

    if (options.hasOption(RECOMPILE_SCRIPTS)) {
        startParameter.setRecompileScripts(true);
    }

    if (options.hasOption(EXCLUDE_TASK)) {
        startParameter.setExcludedTaskNames(options.option(EXCLUDE_TASK).getValues());
    }

    if (options.hasOption(PROFILE)) {
        startParameter.setProfile(true);
    }

    if (options.hasOption(CONTINUE)) {
        startParameter.setContinueOnFailure(true);
    }

    if (options.hasOption(OFFLINE)) {
        startParameter.setOffline(true);
    }

    if (options.hasOption(REFRESH_DEPENDENCIES)) {
        startParameter.setRefreshDependencies(true);
    }

    if (options.hasOption(PARALLEL)) {
        startParameter.setParallelThreadCount(-1);
    }

    if (options.hasOption(PARALLEL_THREADS)) {
        try {
            int parallelThreads = Integer.parseInt(options.option(PARALLEL_THREADS).getValue());
            startParameter.setParallelThreadCount(parallelThreads);
        } catch (NumberFormatException e) {
            throw new CommandLineArgumentException(String.format("Not a numeric argument for %s", PARALLEL_THREADS));
        }
    }

    if (options.hasOption(CONFIGURE_ON_DEMAND)) {
        startParameter.setConfigureOnDemand(true);
    }

    return startParameter;
}
 
Example 6
Source File: DefaultCommandLineConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public StartParameter convert(final ParsedCommandLine options, final StartParameter startParameter) throws CommandLineArgumentException {
    loggingConfigurationCommandLineConverter.convert(options, startParameter);
    Transformer<File, String> resolver = new BasicFileResolver(startParameter.getCurrentDir());

    Map<String, String> systemProperties = systemPropertiesCommandLineConverter.convert(options, new HashMap<String, String>());
    convertCommandLineSystemProperties(systemProperties, startParameter, resolver);

    Map<String, String> projectProperties = projectPropertiesCommandLineConverter.convert(options, new HashMap<String, String>());
    startParameter.getProjectProperties().putAll(projectProperties);

    BuildLayoutParameters layout = new BuildLayoutParameters()
            .setGradleUserHomeDir(startParameter.getGradleUserHomeDir())
            .setProjectDir(startParameter.getProjectDir())
            .setCurrentDir(startParameter.getCurrentDir());
    layoutCommandLineConverter.convert(options, layout);
    startParameter.setGradleUserHomeDir(layout.getGradleUserHomeDir());
    if (layout.getProjectDir() != null) {
        startParameter.setProjectDir(layout.getProjectDir());
    }
    startParameter.setSearchUpwards(layout.getSearchUpwards());

    if (options.hasOption(BUILD_FILE)) {
        startParameter.setBuildFile(resolver.transform(options.option(BUILD_FILE).getValue()));
    }
    if (options.hasOption(SETTINGS_FILE)) {
        startParameter.setSettingsFile(resolver.transform(options.option(SETTINGS_FILE).getValue()));
    }

    for (String script : options.option(INIT_SCRIPT).getValues()) {
        startParameter.addInitScript(resolver.transform(script));
    }

    if (options.hasOption(PROJECT_CACHE_DIR)) {
        startParameter.setProjectCacheDir(resolver.transform(options.option(PROJECT_CACHE_DIR).getValue()));
    }

    if (options.hasOption(NO_PROJECT_DEPENDENCY_REBUILD)) {
        startParameter.setBuildProjectDependencies(false);
    }

    if (!options.getExtraArguments().isEmpty()) {
        startParameter.setTaskNames(options.getExtraArguments());
    }

    if (options.hasOption(DRY_RUN)) {
        startParameter.setDryRun(true);
    }

    if (options.hasOption(RERUN_TASKS)) {
        startParameter.setRerunTasks(true);
    }

    if (options.hasOption(RECOMPILE_SCRIPTS)) {
        startParameter.setRecompileScripts(true);
    }

    if (options.hasOption(EXCLUDE_TASK)) {
        startParameter.setExcludedTaskNames(options.option(EXCLUDE_TASK).getValues());
    }

    if (options.hasOption(PROFILE)) {
        startParameter.setProfile(true);
    }

    if (options.hasOption(CONTINUE)) {
        startParameter.setContinueOnFailure(true);
    }

    if (options.hasOption(OFFLINE)) {
        startParameter.setOffline(true);
    }

    if (options.hasOption(REFRESH_DEPENDENCIES)) {
        startParameter.setRefreshDependencies(true);
    }

    if (options.hasOption(PARALLEL)) {
        startParameter.setParallelThreadCount(-1);
    }

    if (options.hasOption(PARALLEL_THREADS)) {
        try {
            int parallelThreads = Integer.parseInt(options.option(PARALLEL_THREADS).getValue());
            startParameter.setParallelThreadCount(parallelThreads);
        } catch (NumberFormatException e) {
            throw new CommandLineArgumentException(String.format("Not a numeric argument for %s", PARALLEL_THREADS));
        }
    }

    if (options.hasOption(CONFIGURE_ON_DEMAND)) {
        startParameter.setConfigureOnDemand(true);
    }

    return startParameter;
}