Package org.gradle.initialization

Examples of org.gradle.initialization.CommandLineParser


        List<String> remainingPaths = paths;
        while (!remainingPaths.isEmpty()) {
            String path = remainingPaths.get(0);
            selector.selectTasks(gradle, path);

            CommandLineParser commandLineParser = new CommandLineParser();
            Set<Task> tasks = selector.getTasks();
            Map<String, JavaMethod<Task, ?>> options = new HashMap<String, JavaMethod<Task, ?>>();
            if (tasks.size() == 1) {
                for (Class<?> type = tasks.iterator().next().getClass(); type != Object.class; type = type.getSuperclass()) {
                    for (Method method : type.getDeclaredMethods()) {
                        CommandLineOption commandLineOption = method.getAnnotation(CommandLineOption.class);
                        if (commandLineOption != null) {
                            commandLineParser.option(commandLineOption.options()).hasDescription(commandLineOption.description());
                            options.put(commandLineOption.options()[0], new JavaMethod<Task, Object>(Task.class, Object.class, method));
                        }
                    }
                }
            }

            ParsedCommandLine commandLine = commandLineParser.parse(remainingPaths.subList(1, remainingPaths.size()));
            for (Map.Entry<String, JavaMethod<Task, ?>> entry : options.entrySet()) {
                if (commandLine.hasOption(entry.getKey())) {
                    for (Task task : tasks) {
                        entry.getValue().invoke(task, true);
                    }
View Full Code Here


        return this;
    }

    @Override
    public GradleExecuter withArguments(List<String> args) {
        CommandLineParser parser = new CommandLineParser();
        DefaultCommandLineConverter converter = new DefaultCommandLineConverter();
        converter.configure(parser);
        converter.convert(parser.parse(args), parameter);
        return this;
    }
View Full Code Here

TOP

Related Classes of org.gradle.initialization.CommandLineParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.