Download Jar. Libraryless. Click here for Pure Java version (8323L/57K).
!7 sS mainClassName = "StefansOS"; static S v = "x30"; static S sourceID = #1001638; static S javaTarget = "1.8"; // compile JavaX for everyone static S ecjSnippetID = #1400467; static S compilerBotID = #1001155; static int compressionLevel = 9; // Zip compression - highest level p { File jarFile = javaxArtifactsDir("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<S> 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(new File(classesDir), zout); zip2zip_exceptManifest(ecj, zout); zout.close(); makeExecutable(jarFile); print("ok, made " + jarFile.getAbsolutePath() + " (" + jarFile.length() + " bytes)"); }
Began life as a copy of #1001639
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016058 |
Snippet name: | Make Stefan's OS Starter ["Stefans-OS.jar", OK] |
Eternal ID of this version: | #1016058/33 |
Text MD5: | 071f7c46cb61739603f0ae381bf9e299 |
Transpilation MD5: | 86924f087d60ec2e4594db6d97f39a5d |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-20 07:04:16 |
Source code size: | 2224 bytes / 67 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 722 / 1601 |
Version history: | 32 change(s) |
Referenced in: | #1023963 - How to build Stefan's OS (internal document, old) |