static Class<?> hotwire_overBot(String progID) ctex { S compilerBot = "Compiler Bot with caching!"; startBot(compilerBot, "#1002203"); S ss = "please compile this javax snippet: *"; print("Sending to compiler bot: " + ss); S s = sendToLocalBot_cached(compilerBot, ss, progID); new Matches m; print(s); assertTrue("Compiler Bot response: " + s, match("ok, *", s, m)); S jarPath = m.unq(0); File jar = new File(jarPath); assertTrue(jar.getAbsolutePath(), jar.isFile()); // collect urls (program + libraries) L<URL> urls = litlist(jar.toURI().toURL()); S dehlibs = unnull(loadTextFileFromZip(jar, "libraries")); Matcher matcher = Pattern.compile("\\d+").matcher(dehlibs); while (matcher.find()) { S libID = matcher.group(); urls.add(loadLibrary(libID).toURI().toURL()); } // make class loader URLClassLoader classLoader = new URLClassLoader(urls.toArray(new URL[l(urls)])); // load & return main class Class<?> theClass = classLoader.loadClass("main"); Class j = getJavaX(); S src = loadTextFileFromZip(jar, "main.java"); call(j, "registerSourceCode", theClass, src); synchronized(j) { // hopefully this goes well... call(j, "setVars", theClass, progID); callOpt(j, "addInstance", progID, theClass); } hotwire_copyOver(theClass); return theClass; }
Began life as a copy of #1000963
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
1 comment(s) hidden. show
| Snippet ID: | #1002246 |
| Snippet name: | hotwire_overBot (uses compiler bot, experimental) |
| Eternal ID of this version: | #1002246/1 |
| Text MD5: | 424a67ec0a6ba64da2ace23a48c1a811 |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-05-01 18:12:36 |
| Source code size: | 1388 bytes / 45 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1199 / 2425 |
| Referenced in: | [show references] |