+ static {
+ MODULE_REPOSITORY.setAdvisor(new ModuleCompilationOptionsAdvisor() {
+ ModuleCompilationOptions options = null;
+ @Override
+ public ModuleCompilationOptions getOptions(String moduleName) {
+ if(options == null) {
+ options = new ModuleCompilationOptions(false);
+ options.collectDebugInfo = Activator.getContext().getProperty("osgi.dev") != null; //$NON-NLS-1$
+ }
+ return options;
+ }
+ });
+ }
+
+ public static String compileAllModules() {
+ ArrayList<String> modulesWithErrors = new ArrayList<String>();
+ SCLOsgi.SOURCE_REPOSITORY.forAllModules(new TObjectProcedure<String>() {
+ @Override
+ public boolean execute(String moduleName) {
+ Failable<Module> module = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName);
+ if(module.didSucceed())
+ LOGGER.trace("{} - {}", moduleName, "succeeded");
+ else if(module == DoesNotExist.INSTANCE)
+ LOGGER.trace("{} - {}", moduleName, "does not exist"); // should not happen
+ else {
+ LOGGER.trace("{} - {}", moduleName, "error");
+ modulesWithErrors.add(moduleName);
+ }
+ return true;
+ }
+ });
+ if(!modulesWithErrors.isEmpty()) {
+ StringBuilder b = new StringBuilder();
+ b.append("Some SCL modules failed to compile:");
+ for(String module : modulesWithErrors)
+ b.append(' ').append(module);
+ return b.toString();
+ }
+ return null;
+ }