Warning: session_start(): open(/var/lib/php/sessions/sess_auslq3ado04i415m2n7goe7mlp, 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
!7
sS mainClassName = "StefansOS";
static S v = "x30";
static S sourceID = #1001638;
static S javaTarget = "1.6"; // compile JavaX for everyone
static S ecjSnippetID = #1400052; // ecj.zip
static S compilerBotID = #1001155;
static int compressionLevel = 9; // Zip compression - highest level
p {
File jarFile = new File(programDir(), "Stefans OS.jar");
S s = getServerTranspiled(sourceID);
S libs = firstLine(s);
s = dropFirstLine(s);
S mainCode = getServerTranspiledWithoutLibs(#1016060);
mainCode = jreplace(mainCode, "main.class", mainClassName + ".class");
mainCode = jreplace(mainCode, "class main", "class " + mainClassName);
s = moveImportsUp(s + "\n" + mainCode);
s += x30_makeUtilsSource();
L tok = javaTok(s);
javax_prepareX30SourceForDeployment(tok);
jreplace(tok, "public class " + v, "class " + v);
S src = join(tok);
File javaFile = new File(programDir(), mainClassName + ".java");
saveTextFile(javaFile, src);
print("ok, made " + javaFile.getAbsolutePath());
print("Now compiling.");
S botQuestion = "Please compile this Java text: " + quote(src) + " for java version " + quote(javaTarget);
print("Question to bot: " + shorten(botQuestion, 200));
Class compilerBot = hotwire(compilerBotID);
S answer = cast call(compilerBot, "answer", botQuestion);
print("Bot said: " + answer);
if (answer == null) fail();
new Matches m;
if (!match3("ok, *", answer, m))
if (match3("Compile error", answer))
fail("Compile Error.");
else
fail("I don't understand the bot, exiting");
S classesDir = unquote(m.m[0]);
print("I think the classes dir is: " + classesDir);
if (!new File(classesDir).isDirectory()) fail("huh?");
print("Now making jar.");
File ecj = loadLibrary(ecjSnippetID);
ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(jarFile));
zout.setLevel(compressionLevel);
makeManifestWithMainClass(zout, mainClassName);
dir2zip_recurse(classesDir, zout);
zip2zip_exceptManifest(ecj, zout);
zout.close();
makeExecutable(jarFile);
print("ok, made " + jarFile.getAbsolutePath() + " (" + jarFile.length() + " bytes)");
}