Create environments #4

Merged
TopchetoEU merged 14 commits from TopchetoEU/environments into master 2023-09-09 15:55:49 +00:00
3 changed files with 18 additions and 20 deletions
Showing only changes of commit 78b192babe - Show all commits

View File

@ -1,7 +0,0 @@
package me.topchetoeu.jscript;
public class Metadata {
public static final String VERSION = "0.0.1-alpha";
public static final String AUTHOR = "TopchetoEU";
public static final String NAME = "java-jscript";
}

View File

@ -38,16 +38,22 @@ function run(cmd, ...args) {
} }
async function compileJava() { async function compileJava() {
await fs.writeFile('Metadata.java', (await fs.readFile('src/me/topchetoeu/jscript/Metadata.java')).toString() try {
.replace('${VERSION}', conf.version) await fs.writeFile('Metadata.java', (await fs.readFile('src/me/topchetoeu/jscript/Metadata.java')).toString()
.replace('${NAME}', conf.name) .replace('${VERSION}', conf.version)
.replace('${AUTHOR}', conf.author) .replace('${NAME}', conf.name)
); .replace('${AUTHOR}', conf.author)
);
const args = ['-d', 'dst/classes', 'Metadata.java']; const args = ['--release', '10', ];
for await (const path of find('src', undefined, v => v.endsWith('.java') && !v.endsWith('Metadata.java'))) args.push(path); if (argv[1] === 'debug') args.push('-g');
await run(conf.javahome + '/javac', ...args); args.push('-d', 'dst/classes', 'Metadata.java');
await fs.rm('Metadata.java');
for await (const path of find('src', undefined, v => v.endsWith('.java') && !v.endsWith('Metadata.java'))) args.push(path);
await run(conf.javahome + 'javac', ...args);
}
finally {
await fs.rm('Metadata.java');
}
} }
(async () => { (async () => {
@ -59,7 +65,7 @@ async function compileJava() {
await run('jar', '-c', '-f', 'dst/jscript.jar', '-e', 'me.topchetoeu.jscript.Main', '-C', 'dst/classes', '.'); await run('jar', '-c', '-f', 'dst/jscript.jar', '-e', 'me.topchetoeu.jscript.Main', '-C', 'dst/classes', '.');
} }
catch (e) { catch (e) {
if (argv.includes('debug')) throw e; if (argv[1] === 'debug') throw e;
else console.log(e.toString()); else console.log(e.toString());
} }
})(); })();

View File

@ -1,6 +1,5 @@
{ {
"version": "0.0.1-alpha",
"name": "java-jscript", "name": "java-jscript",
"author": "TopchetoEU", "author": "TopchetoEU",
"javahome": "/usr/lib/jvm/java-8-openjdk-amd64/bin" "javahome": ""
} }