throws CmdLineException, IOException {
// If there is only one argument, and it starts with an '@', then treat it
// as an options file, relative to the current working directory.
if ((args.length == 1) && (args[0].startsWith("@"))) {
FileRef optionsFile = defaultDir.join(args[0].substring(1));
Reader in = optionsFile.openReader(Charsets.UTF_8);
List<String> lines = CharStreams.readLines(in);
in.close();
List<String> parsedTokens = Lists.newArrayList();
for (String line : lines) {
for (String token : line.trim().split("\\s+")) {
if (token.length() > 0) {
parsedTokens.add(token);
}
}
}
args = parsedTokens.toArray(new String[parsedTokens.size()]);
}
commandLine = new CommandLine(args);
Set<FileRef> underlyingInputFiles = getFileRefs(fs, commandLine.trailingArgs);
FileRef outputDir = (commandLine.FLAG_dir == null)
? defaultDir : fs.parseFilename(commandLine.FLAG_dir);
List<FileRef> sourcePaths = (commandLine.FLAG_source == null)
? Collections.singletonList(defaultDir)
: fs.parseFilenameList(commandLine.FLAG_source);
SourcePathFileSystem sourcePathFs = new SourcePathFileSystem(fs,
sourcePaths,
underlyingInputFiles,
outputDir);
sourceFiles = ImmutableSet.copyOf(sourcePathFs.getSourceFileRefs());
schemaFiles = getFileRefs(fs, commandLine.FLAG_schema);
// Compute Output Languages
Set<OutputLanguage> tmpOutputLanguages = EnumSet.noneOf(OutputLanguage.class);
for (String outputLanguage : commandLine.FLAG_output_language) {
tmpOutputLanguages.add(OutputLanguage.valueOf(outputLanguage.toUpperCase()));
}
outputLanguages = ImmutableSet.copyOf(tmpOutputLanguages);
allowedOutputFiles = getFileRefs(sourcePathFs, commandLine.FLAG_output);
alertPolicy = computeAlertPolicy(commandLine.FLAG_warn, commandLine.FLAG_error);
// Compute Dependency File
dependencyFile = (commandLine.FLAG_depend == null)
? null : fs.parseFilename(commandLine.FLAG_depend);
// Compute Properties File
propertiesFile = (commandLine.FLAG_output_properties
&& commandLine.FLAG_message_source != null)
? outputDir.join(
"/" + commandLine.FLAG_message_source.replace(".", "/") + "_en.properties")
: null;
isVerboseEnabled = commandLine.FLAG_verbose;
isDebugEnabled = commandLine.FLAG_g;