Search in sources :

Example 1 with SystemPropertiesCommandLineConverter

use of org.gradle.cli.SystemPropertiesCommandLineConverter in project gradle by gradle.

the class GradleWrapperMain method main.

public static void main(String[] args) throws Exception {
    File wrapperJar = wrapperJar();
    File propertiesFile = wrapperProperties(wrapperJar);
    File rootDir = rootDir(wrapperJar);
    CommandLineParser parser = new CommandLineParser();
    parser.allowUnknownOptions();
    parser.option(GRADLE_USER_HOME_OPTION, GRADLE_USER_HOME_DETAILED_OPTION).hasArgument();
    parser.option(GRADLE_QUIET_OPTION, GRADLE_QUIET_DETAILED_OPTION);
    SystemPropertiesCommandLineConverter converter = new SystemPropertiesCommandLineConverter();
    converter.configure(parser);
    ParsedCommandLine options = parser.parse(args);
    Properties systemProperties = System.getProperties();
    systemProperties.putAll(converter.convert(options, new HashMap<String, String>()));
    File gradleUserHome = gradleUserHome(options);
    addSystemProperties(gradleUserHome, rootDir);
    Logger logger = logger(options);
    WrapperExecutor wrapperExecutor = WrapperExecutor.forWrapperPropertiesFile(propertiesFile);
    wrapperExecutor.execute(args, new Install(logger, new Download(logger, "gradlew", wrapperVersion()), new PathAssembler(gradleUserHome)), new BootstrapMainStarter());
}
Also used : HashMap(java.util.HashMap) ParsedCommandLine(org.gradle.cli.ParsedCommandLine) CommandLineParser(org.gradle.cli.CommandLineParser) Properties(java.util.Properties) File(java.io.File) SystemPropertiesCommandLineConverter(org.gradle.cli.SystemPropertiesCommandLineConverter)

Aggregations

File (java.io.File)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 CommandLineParser (org.gradle.cli.CommandLineParser)1 ParsedCommandLine (org.gradle.cli.ParsedCommandLine)1 SystemPropertiesCommandLineConverter (org.gradle.cli.SystemPropertiesCommandLineConverter)1