Warning: session_start(): open(/var/lib/php/sessions/sess_f5vj70se45bj479re6k8ue2092, 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
// can be false, it's compiled on the server anyway
// defaults to true
static new ThreadLocal transpileForServer_compile;
static long transpileForServer_localTime;
sbool transpileForServer_forceJavacOnServer;
sbool transpileForServer_forceJavacWhenLibs;
svoid transpileForServer(S progID) {
S server = tb_mainServer();
S javax = loadSnippet(progID);
print("Source: " + l(javax));
long time = sysNow();
time "Transpile" {
transpileRaw_silent = false;
S java;
try {
java = transpileRaw(javax);
} catch e {
// (line 980,col 1)
int line = parseIntOpt(jextract("(line ,", str(e)));
if (line != 0) {
L lines = lines(loadProgramTextFile("error.java"));
for (int i = line-1; i <= line+1; i++)
print("[line " + i + "] " + get(lines, i-1));
}
throw rethrow(e);
}
print("Transpiled: " + l(java));
}
new L libs;
java = findTranslators2(java, libs);
print("Libs: " + or2(joinWithComma(libs), "-"));
S dehlibs = join(" ", libs);
if (!isFalse(transpileForServer_compile!)) {
File bytecode = javaCompile_overInternalBot(java, dehlibs);
print("Bytecode: " + f2s(assertNotNull(bytecode)));
}
transpileForServer_localTime = sysNow()-time;
// Compiled OK, let's upload
S result = postPageWithCredentials(server + "/tb/upload-transpilation.php",
id := psI(progID),
transpilation := java,
libs := lines(splitAtSpace(dehlibs)),
computer := computerID());
Matcher m = regexp("URL=/(dexcompile\\.php.*?)'", result);
if (!m.find()) fail("Server said: " + result);
S url = server + "/" + m.group(1);
if (transpileForServer_forceJavacOnServer || transpileForServer_forceJavacWhenLibs && nempty(libs))
url += "&javac=1";
result = postPageWithCredentials(url);
if (!result.contains("SUCCESS"))
fail("Server said: " + result);
print("Transpiled & uploaded " + fsI(progID) + "!");
}