} catch (final IllegalArgumentException e) {
logger.info(StandaloneJarToolMessages.getString("invalidScope", libClassScope));
return;
}
final ModuleName moduleName = ModuleName.maybeMake(moduleNameString);
if (moduleName == null) {
logger.info(StandaloneJarToolMessages.getString("invalidModuleName", moduleNameString));
return;
}
try {
libClassSpecs.add(LibraryClassSpec.make(scope, libClassName, moduleName));
} catch (final StandaloneJarBuilder.InvalidConfigurationException e) {
logger.log(Level.INFO, StandaloneJarToolMessages.getString("errorPrefix", e.getMessage()));
return;
}
} else if (command.equals("-XX:all")) { // unsupported internal use argument - adds all modules in the program
arguments.consumeArgument();
addAllModulesAsLibraries = true;
} else {
// not a command... so break out of the loop to process the remainder
break;
}
}
if (mainClassSpecs.isEmpty() && libClassSpecs.isEmpty() && !addAllModulesAsLibraries) {
// there must be at least one -main or -lib command specified (or -XX:all)
throw new ArgumentList.NotEnoughArgumentsException();
}
final File outputFile = new File(arguments.getAndConsumeArgument());
final File outputSrcZipFile;
if (arguments.hasMoreArguments()) {
final String command = arguments.getAndConsumeArgument();
if (command.equals("-src")) {
outputSrcZipFile = new File(arguments.getAndConsumeArgument());
} else {
showUsage(logger);
return;
}
} else {
outputSrcZipFile = null;
}
arguments.noMoreArgumentsAllowed();
if (!LECCMachineConfiguration.nonInterruptibleRuntime()) {
logger.info(StandaloneJarToolMessages.getString("nonInterruptiblePropertyNotSet", NON_INTERRUPTIBLE_PROPERTY));
}
////
/// Compile the CAL workspace
//
logger.info(StandaloneJarToolMessages.getString("initializingCalWorkspace"));
final MessageLogger msgLogger = new MessageLogger();
final BasicCALServices calServices = BasicCALServices.makeCompiled(cwsName, msgLogger);
if (calServices == null) {
logger.info(msgLogger.toString());
return;
}
logger.info(StandaloneJarToolMessages.getString("calWorkspaceInitialized"));
final WorkspaceManager workspaceManager = calServices.getWorkspaceManager();
// process the -XX:all argument
if (addAllModulesAsLibraries) {
for (final ModuleName moduleName : workspaceManager.getModuleNamesInProgram()) {
try {
libClassSpecs.add(LibraryClassSpec.make(JavaScope.PUBLIC, "cal.lib." + moduleName.toSourceText(), moduleName));
} catch (final StandaloneJarBuilder.InvalidConfigurationException e) {
logger.log(Level.INFO, StandaloneJarToolMessages.getString("errorPrefix", e.getMessage()));
return;
}