public static void resetModuleManager() { RepositoryManagerBuilder builder = new RepositoryManagerBuilder( new Logger() { @Override public void error(String str) { System.err.println("ERROR: " + str); } @Override public void warning(String str) { System.err.println("WARN: " + str); } @Override public void info(String str) { System.err.println("INFO: " + str); } @Override public void debug(String str) { System.err.println("DEBUG: " + str); } }); RepositoryManager repoManager = builder.buildRepository(); VFS vfs = new VFS(); Context context = new Context(repoManager, vfs); moduleManager = new RuntimeModuleManager(context); moduleManager.initCoreModules(); moduleManager.prepareForTypeChecking(); }
public static Module loadModule( File sysRep, ClassLoader loader, ModuleIdentifier moduleIdentifier) throws Exception { // Field field = CeylonModuleLoader.class.getDeclaredField("JDK_MODULE_NAMES"); field.setAccessible(true); HashSet<String> a = (HashSet<String>) field.get(null); a.add("io.vertx.core"); a.add("io.vertx.platform"); // CeylonUtils.CeylonRepoManagerBuilder metaBuilder = CeylonUtils.repoManager(); metaBuilder.systemRepo(sysRep.getAbsolutePath()); metaBuilder.logger(new JULLogger()); RepositoryManagerBuilder builder = metaBuilder.buildManagerBuilder(); RepositoryManager repo = builder.buildRepository(); // Extend to add system classloader as fallback CeylonModuleLoader moduleLoader = new CeylonModuleLoaderExt(new ClassLoaderLocalLoader(loader), repo); // return moduleLoader.loadModule(moduleIdentifier); }