Warning: session_start(): open(/var/lib/php/sessions/sess_sd9ogvo9l0rer7qfv9a4jl2972, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static class CompilerBot {
static bool verbose;
static File compileSnippet(S snippetID) {
ret compileSnippet(snippetID, "");
}
// returns jar path
static File compileSnippet(S snippetID, S javaTarget) {
S transpiledSrc = getServerTranspiled2(snippetID);
int i = transpiledSrc.indexOf('\n');
String libs = transpiledSrc.substring(0, Math.max(0, i));
if (verbose)
print("Compiling snippet: " + snippetID + ". Libs: " + libs);
transpiledSrc = transpiledSrc.substring(i+1);
return compile(transpiledSrc, libs, javaTarget, snippetID);
}
static File compile(S src) {
ret compile(src, "");
}
static File compile(S src, S libs) {
ret compile(src, libs, null);
}
static File compile(S src, S dehlibs, S javaTarget) {
ret compile(src, dehlibs, javaTarget, null);
}
static File compile(S src, S dehlibs, S javaTarget, S progID) {
if (verbose)
print("Compiling " + l(src) + " chars");
// Note: This is different from the calculation in x30
// (might lead to programs being compiled twice)
S md5 = md5(dehlibs + "\n" + src + "\n" + progID);
File jar = getJarFile(md5);
if (jar == null || jar.length() <= 22) {
// have to compile
bool canRename = useDummyMainClasses() && isSnippetID(progID) && !tok_classHasModifier(findMainClass(javaTok(src)), "public");
if (verbose)
print("useRenaming: " + useDummyMainClasses() + ", canRename: " + canRename + ", progID: " + progID);
if (canRename)
javaCompileToJar_rename(src, dehlibs, jar, progID);
else
javaCompileToJar_standard(src, dehlibs, jar);
} else {
if (verbose)
print("Getting classes from cache (" + jar.getAbsolutePath() + ", " + jar.length() + " bytes)");
touchFile(jar); // so we can find the unused ones easier
}
ret jar;
}
static File getJarFile(S md5) {
assertTrue(isMD5(md5));
ret new File(getCacheProgramDir("#1002203"), md5 + ".jar");
}
}