本文整理匯總了Java中org.gradle.cli.ParsedCommandLine類的典型用法代碼示例。如果您正苦於以下問題:Java ParsedCommandLine類的具體用法?Java ParsedCommandLine怎麽用?Java ParsedCommandLine使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ParsedCommandLine類屬於org.gradle.cli包,在下文中一共展示了ParsedCommandLine類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: convert
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public DaemonParameters convert(ParsedCommandLine args, DaemonParameters target) throws CommandLineArgumentException {
if (args.hasOption(FOREGROUND)) {
target.setForeground(true);
}
if (args.hasOption(STOP)) {
target.setStop(true);
}
if (args.hasOption(STATUS)) {
target.setStatus(true);
}
if (args.hasOption(NO_DAEMON)) {
target.setEnabled(false);
} else if (args.hasOption(DAEMON)) {
target.setEnabled(true);
}
return target;
}
示例2: createAction
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public Runnable createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
Parameters parameters = parametersConverter.convert(commandLine, new Parameters());
parameters.getDaemonParameters().applyDefaultsFor(jvmVersionDetector.getJavaVersion(parameters.getDaemonParameters().getEffectiveJvm()));
if (parameters.getDaemonParameters().isStop()) {
return stopAllDaemons(parameters.getDaemonParameters(), loggingServices);
}
if (parameters.getDaemonParameters().isStatus()) {
return showDaemonStatus(parameters.getDaemonParameters(), loggingServices);
}
if (parameters.getDaemonParameters().isForeground()) {
DaemonParameters daemonParameters = parameters.getDaemonParameters();
ForegroundDaemonConfiguration conf = new ForegroundDaemonConfiguration(
UUID.randomUUID().toString(), daemonParameters.getBaseDir(), daemonParameters.getIdleTimeout(), daemonParameters.getPeriodicCheckInterval());
return new ForegroundDaemonAction(loggingServices, conf);
}
if (parameters.getDaemonParameters().isEnabled()) {
return runBuildWithDaemon(parameters.getStartParameter(), parameters.getDaemonParameters(), loggingServices);
}
if (canUseCurrentProcess(parameters.getDaemonParameters())) {
return runBuildInProcess(parameters.getStartParameter(), parameters.getDaemonParameters(), loggingServices);
}
return runBuildInSingleUseDaemon(parameters.getStartParameter(), parameters.getDaemonParameters(), loggingServices);
}
示例3: execute
import org.gradle.cli.ParsedCommandLine; //導入依賴的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);
}
示例4: execute
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public void execute(ExecutionListener executionListener) {
CommandLineConverter<LoggingConfiguration> loggingConfigurationConverter = (CommandLineConverter<LoggingConfiguration>)loggingServices.get(CommandLineConverter.class);
CommandLineParser parser = new CommandLineParser();
loggingConfigurationConverter.configure(parser);
parser.allowUnknownOptions();
parser.allowMixedSubcommandsAndOptions();
try {
ParsedCommandLine parsedCommandLine = parser.parse(args);
loggingConfigurationConverter.convert(parsedCommandLine, loggingConfiguration);
} catch (CommandLineArgumentException e) {
// Ignore
}
LoggingManagerInternal loggingManager = loggingServices.getFactory(LoggingManagerInternal.class).create();
loggingManager.setLevel(loggingConfiguration.getLogLevel());
loggingManager.start();
loggingManager.attachConsole(loggingConfiguration.isColorOutput());
action.execute(executionListener);
}
示例5: createAction
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public Runnable createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
if (commandLine.hasOption(HELP)) {
return new ShowUsageAction(parser);
}
if (commandLine.hasOption(VERSION)) {
return new ShowVersionAction();
}
return null;
}
示例6: execute
import org.gradle.cli.ParsedCommandLine; //導入依賴的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();
}
}
示例7: createAction
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public Runnable createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
if (commandLine.hasOption(GUI)) {
DeprecationLogger.nagUserOfToolReplacedWithExternalOne("Gradle GUI", "an IDE with support for Gradle e.g. Eclipse, IntelliJ or NetBeans");
return new ShowGuiAction();
}
return null;
}
示例8: getBuildLogLevel
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public LogLevel getBuildLogLevel() {
LoggingCommandLineConverter converter = new LoggingCommandLineConverter();
CommandLineParser parser = new CommandLineParser().allowUnknownOptions().allowMixedSubcommandsAndOptions();
converter.configure(parser);
List<String> arguments = parameters.getArguments();
ParsedCommandLine parsedCommandLine = parser.parse(arguments == null ? Collections.<String>emptyList() : arguments);
//configure verbosely only if arguments do not specify any log level.
if (parameters.getVerboseLogging() && !parsedCommandLine.hasAnyOption(converter.getLogLevelOptions())) {
return LogLevel.DEBUG;
}
LoggingConfiguration loggingConfiguration = converter.convert(parsedCommandLine, new DefaultLoggingConfiguration());
return loggingConfiguration.getLogLevel();
}
示例9: main
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
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());
}
示例10: convert
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public BuildLayoutParameters convert(ParsedCommandLine options, BuildLayoutParameters target) throws CommandLineArgumentException {
Transformer<File, String> resolver = new BasicFileResolver(target.getCurrentDir());
if (options.hasOption(NO_SEARCH_UPWARDS)) {
target.setSearchUpwards(false);
}
if (options.hasOption(PROJECT_DIR)) {
target.setProjectDir(resolver.transform(options.option(PROJECT_DIR).getValue()));
}
if (options.hasOption(GRADLE_USER_HOME)) {
target.setGradleUserHomeDir(resolver.transform(options.option(GRADLE_USER_HOME).getValue()));
}
return target;
}
示例11: convert
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public DaemonParameters convert(ParsedCommandLine args, DaemonParameters target) throws CommandLineArgumentException {
if (args.hasOption(NO_DAEMON)) {
return target.setEnabled(false);
}
if (args.hasOption(DAEMON)) {
return target.setEnabled(true);
}
return target;
}
示例12: createAction
import org.gradle.cli.ParsedCommandLine; //導入依賴的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);
}
示例13: getBuildLogLevel
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public LogLevel getBuildLogLevel() {
LoggingCommandLineConverter converter = new LoggingCommandLineConverter();
CommandLineParser parser = new CommandLineParser().allowUnknownOptions().allowMixedSubcommandsAndOptions();
converter.configure(parser);
ParsedCommandLine parsedCommandLine = parser.parse(parameters.getArguments(Collections.<String>emptyList()));
//configure verbosely only if arguments do not specify any log level.
if (parameters.getVerboseLogging(false) && !parsedCommandLine.hasAnyOption(converter.getLogLevelOptions())) {
return LogLevel.DEBUG;
}
LoggingConfiguration loggingConfiguration = converter.convert(parsedCommandLine, new LoggingConfiguration());
return loggingConfiguration.getLogLevel();
}
示例14: main
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
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();
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);
WrapperExecutor wrapperExecutor = WrapperExecutor.forWrapperPropertiesFile(propertiesFile, System.out);
wrapperExecutor.execute(
args,
new Install(new Download("gradlew", wrapperVersion()), new PathAssembler(gradleUserHome)),
new BootstrapMainStarter());
}
示例15: createAction
import org.gradle.cli.ParsedCommandLine; //導入依賴的package包/類
public Action<? super ExecutionListener> createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
if (commandLine.hasOption(HELP)) {
return Actions.toAction(new ShowUsageAction(parser));
}
if (commandLine.hasOption(VERSION)) {
return Actions.toAction(new ShowVersionAction());
}
return null;
}