made an automatic stable-download compiler

This commit is contained in:
LAX1DUDE 2022-08-26 00:31:45 -07:00
parent 1bbfa24430
commit 32d063bfa7
19 changed files with 70467 additions and 34559 deletions

4
CreateStableDownload.bat Normal file
View File

@ -0,0 +1,4 @@
@echo off
title CreateStableDownload
java -jar zip-generator/zipGenerator.jar
pause

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
onmessage = function(o) {
importScripts("classes_server.js");
eaglercraftServerOpts = o.data;
main();
};

View File

@ -0,0 +1,169 @@
<!DOCTYPE html>
<!--
To correctly download this file on github, right click on this page of code and press 'Save As...'
To correctly download this file on google drive, press the download button at the top right of the screen near the picture of your google account photo
-->
<!--
Visit this link to check for newer versions of this file:
https://github.com/LAX1DUDE/eaglercraft/blob/main/stable-download/Offline_Download_Version.html
This version of eaglercraft you are using right now is from ${date}
-->
<html>
<head>
<meta charset="UTF-8" />
<title>My Drive - Google Drive</title>
<script type="text/javascript">
window.addEventListener("load", function() {
countdown();
setTimeout(function(){
document.getElementById("locally").remove();
window.eaglercraftOpts = {
container: "game_frame", assetsURI: getAssetsURI(),
serverWorkerURI: createWorkerURI("sp_worker"),
worldsFolder: "TEST", mainMenu: { splashes: [
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",
"EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!"
]}, worldsFolder: "OFFLINE", serverListTitle: "Ayonull hosts a list of servers:",
serverListLink: "https://eagler.nully.tech/servers"
};
main();
}, 6000);
});
</script>
<script type="text/javascript">
function getAssetsURI() {
return "data:application/octet-stream;base64,${assets_epk_base64}";
}
</script>
<script type="text/javascript">
function createWorkerURI(el) {
var eee = document.getElementById(el);
var str = eee.innerHTML;
eee.remove();
str = "onmessage = function(o) { eaglercraftServerOpts = o.data; main(); };\n" + str;
return URL.createObjectURL(new Blob([str], {type:"text/javascript"}));
}
</script>
<link type="image/png" rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGAUlEQVRYw7VXa0xTZxj+oKjJNjWZ10EtZqIQjBdsT2utlZYiMsfiZltUtpiYOZ0zceOmcZfsGLmoQ25hS1jmNJpBL1xEuWwZGduPjW0xcVniLn/YfmlrK6wDRulpz7v3O+1BCgUs4pc8+U5Ov6/P877v837nHEKiGzHEZpYQVhcXEfQ3uuaJjOCfP9pSG5E8GXIzmS+r0Rtk1bqcxCrti+NB76XVaA3EzM6fUxHmELmm7bXkjVde6pPV6WD1x/owyBDrEaTOAD9fTeqDLpJM98CciIBgTRVW0211Rx4k1WWOSiu0flnlDgGrEBsQpELnZz9hRuErAqNNMb8IW+Ex/SCvPzJPILebjm69eQAYm8m7+doeWHVRC0guIBGxDkEupsPfDSsBmokXumLB10TeFETUk3mPFbmq89VFCovJxdhNIG80BhirCVLqd4G0Yjtg9LC5UgvkIx1c/XQTJQevXRLgWwj47MSFJVg860yMRW81VW1tPwCKRqNPYTECxZaGV2B1VTqswUw8jZFrq7ZDv/UZ8Ddh+u0xCOKDL1FEM6maVRZE46ls5lSFNUiK4IW50Qg0C6mXdsPmCg2QCj10f54iRD9il1Bymn6ezhwVZCOpURtSFIDkHaob+yk5J0YvQoMg1YbA0RpVwGsnAvEEcNAhiOiISoCuB080HEqLKUfVti8iOcU2qylArr0MfzTIaPQoQjJJBGZCEOG3kxxBRA+Jm/moDQ2M/jdlSy4l808kZ1DUdswMseW2IHkLdCI5kkXIgh/aaFuS3x96expDisaTW4wFE403DtQLvBa7gjS/nogCEgMt4bWfAMGQWIqC6Q3JsrF0SrOZl2HbebDnHxpvPFAUFYciq8WtSFxNSShZBAG8v1kQ50EfLBNEsCQ2QvTyYNtZjPVC9JaI0QfoeYDlcctt5sVjaf2aLEYCd6j/AxGz0IVeaCb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wELcXIFFwBP7an7M8T8H1bLLDGWzFAAAAABJRU5ErkJggg==" />
<script type="text/javascript">
${classes_js}
${eagswebrtc_js}
</script>
<script type="text/eaglerworker" id="sp_worker">
${classes_server_js}
</script>
<script type="text/javascript">
function countdown() {
const c = document.getElementById("countdown");
setTimeout(function(){ c.innerText = "(Game will launch in 4)"; }, 1000);
setTimeout(function(){ c.innerText = "(Game will launch in 3)"; }, 2000);
setTimeout(function(){ c.innerText = "(Game will launch in 2)"; }, 3000);
setTimeout(function(){ c.innerText = "(Game will launch in 1)"; }, 4000);
setTimeout(function(){ c.innerText = "(Game will launch in 0)"; }, 5000);
}
</script>
</head>
<body style="margin:0px;width:100vw;height:100vh;" id="game_frame">
<div id="locally" style="text-align:center;">
<div style="height:5vh;"></div>
<h2>you are running eaglercraft locally, check <a href="https://github.com/LAX1DUDE/eaglercraft/blob/main/stable-download/Offline_Download_Version.html" target="_blank">this link</a> regularly for an updated version</h2>
<h3>the version you are currently using is from <span style="color:#cc0000;font-size:larger;">${date}</span></h3>
<p id="countdown" style="text-align:center;">(Game will launch in 5)</p>
</div>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,61 @@
package net.lax1dude.eaglercraft.zip_generator;
import java.io.File;
import java.io.IOException;
import java.lang.ProcessBuilder.Redirect;
// taken from 1.8 buildtools
public class JARSubprocess {
public static final char classPathSeperator;
static {
classPathSeperator = System.getProperty("os.name").toLowerCase().contains("windows") ? ';' : ':';
}
public static int runJava(File directory, String[] javaExeArguments, String logPrefix) throws IOException {
if(logPrefix.length() > 0 && !logPrefix.endsWith(" ")) {
logPrefix = logPrefix + " ";
}
String javaHome = System.getProperty("java.home");
if(classPathSeperator == ';') {
File javaExe = new File(javaHome, "bin/java.exe");
if(!javaExe.isFile()) {
javaExe = new File(javaHome, "java.exe");
if(!javaExe.isFile()) {
throw new IOException("Could not find /bin/java.exe equivelant on java.home! (java.home=" + javaHome + ")");
}
}
javaHome = javaExe.getAbsolutePath();
}else {
File javaExe = new File(javaHome, "bin/java");
if(!javaExe.isFile()) {
javaExe = new File(javaHome, "java");
if(!javaExe.isFile()) {
throw new IOException("Could not find /bin/java equivelant on java.home! (java.home=" + javaHome + ")");
}
}
javaHome = javaExe.getAbsolutePath();
}
String[] fullArgs = new String[javaExeArguments.length + 1];
fullArgs[0] = javaHome;
System.arraycopy(javaExeArguments, 0, fullArgs, 1, javaExeArguments.length);
ProcessBuilder exec = new ProcessBuilder(fullArgs);
exec.directory(directory);
exec.redirectOutput(Redirect.INHERIT);
exec.redirectError(Redirect.INHERIT);
Process ps = exec.start();
while(true) {
try {
return ps.waitFor();
} catch (InterruptedException e) {
}
}
}
}

View File

@ -0,0 +1,130 @@
package net.lax1dude.eaglercraft.zip_generator;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
public class ZipGenerator {
public static void main(String[] args) throws IOException {
System.out.println();
System.out.println("Notes:");
System.out.println();
System.out.println(" - please run \"gradlew teavmc\" on the client and integrated server");
System.out.println(" - please run \"epkcompiler/run.bat\" (or run.sh) to generate \"javascript/assets.epk\"");
System.out.println(" - compile eaglercraftbungee and put it in it's \"stable-download/java/bungee_command\" folder");
System.out.println();
try {
if(!net.lax1dude.eaglercraft.v1_8.buildtools.Java11Check.classLoadCheck()) {
throw new RuntimeException("wtf?");
}
}catch(Throwable t) {
System.err.println("ERROR: A minimum of Java 11 is required to run this tool!");
System.err.println();
System.err.println("You are using Java " + System.getProperty("java.version"));
System.err.println();
return;
}
String date = (new SimpleDateFormat("MM/dd/yyyy")).format(new Date());
System.out.println("Using date: " + date);
System.out.println();
System.out.println("Running closure compiler on 'eagswebrtc.js'...");
JARSubprocess.runJava(new File("."), new String[] { "-jar", "zip-generator/google-closure-compiler.jar", "--js", "javascript/eagswebrtc.js",
"--js_output_file", "stable-download/web/eagswebrtc.js", "-O", "SIMPLE" }, "[ClosureCompiler]");
System.out.println("Loading 'javascript/classes.js'");
String classesJs = FileUtils.readFileToString(new File("javascript/classes.js"), "UTF-8").replaceFirst("\\/\\/# sourceMappingURL=.*(\\r\\n|\\r|\\n)*", "").trim();
System.out.println("Loading 'javascript/classes_server.js'");
String classesServerJs = FileUtils.readFileToString(new File("javascript/classes_server.js"), "UTF-8").replaceFirst("\\/\\/# sourceMappingURL=.*(\\r\\n|\\r|\\n)*", "").trim();
System.out.println("Loading 'javascript/assets.epk'");
String assetsEpk = Base64.encodeBase64String(FileUtils.readFileToByteArray(new File("javascript/assets.epk")));
System.out.println("Loading 'stable-download/web/eagswebrtc.js'");
String classesWebRTCJs = FileUtils.readFileToString(new File("stable-download/web/eagswebrtc.js"), "UTF-8").replaceFirst("[\\'\\\"]use strict[\\'\\\"]\\;(\\r\\n|\\r|\\n)*", "").trim();
System.out.println("Loading 'zip-generator/Offline_Download_Version_Template.html'");
String offlineTemplate = FileUtils.readFileToString(new File("zip-generator/Offline_Download_Version_Template.html"), "UTF-8");
System.out.println("Writing 'stable-download/Offline_Download_Version.html'");
offlineTemplate = offlineTemplate.replace("${date}", date).replace("${assets_epk_base64}", assetsEpk).replace("${classes_js}", classesJs);
offlineTemplate = offlineTemplate.replace("${eagswebrtc_js}", classesWebRTCJs).replace("${classes_server_js}", classesServerJs);
FileUtils.writeStringToFile(new File("stable-download/Offline_Download_Version.html"), offlineTemplate, "UTF-8");
System.out.println("Copying 'javascript/classes.js' to 'stable-download/web/classes.js'");
FileUtils.copyFile(new File("javascript/classes.js"), new File("stable-download/web/classes.js"));
System.out.println("Copying 'javascript/classes.js.map' to 'stable-download/web/classes.js.map'");
FileUtils.copyFile(new File("javascript/classes.js.map"), new File("stable-download/web/classes.js.map"));
System.out.println("Copying 'javascript/classes_server.js' to 'stable-download/web/classes_server.js'");
FileUtils.copyFile(new File("javascript/classes_server.js"), new File("stable-download/web/classes_server.js"));
System.out.println("Copying 'javascript/classes_server.js.map' to 'stable-download/web/classes_server.js.map'");
FileUtils.copyFile(new File("javascript/classes_server.js.map"), new File("stable-download/web/classes_server.js.map"));
System.out.println("Copying 'javascript/assets.epk' to 'stable-download/web/assets.epk'");
FileUtils.copyFile(new File("javascript/assets.epk"), new File("stable-download/web/assets.epk"));
System.out.println("Copying 'javascript/worker_bootstrap.js' to 'stable-download/web/worker_bootstrap.js'");
FileUtils.copyFile(new File("javascript/worker_bootstrap.js"), new File("stable-download/web/worker_bootstrap.js"));
System.out.println("Writing 'stable-download/stable-download.zip'");
ZipOutputStream zOut = new ZipOutputStream(new FileOutputStream(new File("stable-download/stable-download.zip")));
zOut.setLevel(9);
zipFolder(zOut, "web", new File("stable-download/web"));
zipFolder(zOut, "java", new File("stable-download/java"));
zOut.close();
System.out.println("Writing 'stable-download/stable-download_repl.zip'");
FileUtils.copyFile(new File("stable-download/stable-download.zip"), new File("stable-download/stable-download_repl.zip"));
}
private static void zipFolder(ZipOutputStream zOut, String pfx, File file) throws IOException {
zipFolder0(zOut, file.getAbsolutePath().replace('\\', '/'), pfx, file);
}
private static void zipFolder0(ZipOutputStream zOut, String pfx, String writePfx, File file) throws IOException {
for(File f : file.listFiles()) {
if(f.isDirectory()) {
zipFolder0(zOut, pfx, writePfx, f);
}else if(f.isFile()) {
String path = f.getAbsolutePath().replace('\\', '/').replace(pfx, "");
if(path.startsWith("/")) {
path = path.substring(1);
}
if(writePfx.length() > 0 && !writePfx.endsWith("/")) {
writePfx = writePfx + "/";
}
zipFile(zOut, writePfx + path, f);
}
}
}
private static void zipFile(ZipOutputStream zOut, String name, File file) throws IOException {
zOut.putNextEntry(new ZipEntry(name));
IOUtils.write(FileUtils.readFileToByteArray(file), zOut);
}
}

Binary file not shown.