Libraryless. Click here for Pure Java version (11552L/72K/231K).
!7 sbool verbose = true; p { makeAndroid("Compiler bot with caching!"); } static synchronized S answer(S s) { new Matches m; if (match3("Please compile this JavaX snippet: *", s, m)) { S snippetID = unquote(m.m[0]); S transpiledSrc = getServerTranspiled(snippetID); int i = transpiledSrc.indexOf('\n'); String libs = transpiledSrc.substring(0, Math.max(0, i)); print("Compiling snippet: " + snippetID + ". Libs: " + libs); transpiledSrc = transpiledSrc.substring(i+1); return compile(transpiledSrc, libs); } if "Please compile this Java text: *" ret compile($1, ""); if "Please compile this Java text: * with libraries *" ret compile($1, $2); if (match3("Please compile this Java text: * for java version *", s, m)) { String src = unquote(m.m[0]); String target = unquote(m.m[1]); return compile(src, "", target); } return null; } static synchronized S compile(S src, S libs) { return compile(src, libs, null); } static synchronized S compile(S src, S dehlibs, S javaTarget) { if (verbose) print("Compiling " + l(src) + " chars"); S md5 = md5(src); File jar = getJarFile(md5); if (jar == null || jar.length() <= 22) { // have to compile try { javaCompileToJar(src, dehlibs, jar); } catch e { ret e.getMessage(); } } else { print("Getting classes from cache (" + jar.getAbsolutePath() + ", " + jar.length() + " bytes)"); touchFile(jar); // so we can find the unused ones easier } return "ok, " + quote(jar.getAbsolutePath()); } static File getJarFile(S md5) { assertTrue(isMD5(md5)); ret new File(getCacheProgramDir(), md5 + ".jar"); }
Began life as a copy of #1001155
download show line numbers debug dex old transpilations
Travelled to 22 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gmoysmmjifsf, gwrvuhgaqvyk, hpgrupgrauku, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xprdwmaupziu
No comments. add comment