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() {
await fs.writeFile('Metadata.java', (await fs.readFile('src/me/topchetoeu/jscript/Metadata.java')).toString()
.replace('${VERSION}', conf.version)
.replace('${NAME}', conf.name)
.replace('${AUTHOR}', conf.author)
);
const args = ['-d', 'dst/classes', '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);
await fs.rm('Metadata.java');
try {
await fs.writeFile('Metadata.java', (await fs.readFile('src/me/topchetoeu/jscript/Metadata.java')).toString()
.replace('${VERSION}', conf.version)
.replace('${NAME}', conf.name)
.replace('${AUTHOR}', conf.author)
);
const args = ['--release', '10', ];
if (argv[1] === 'debug') args.push('-g');
args.push('-d', 'dst/classes', '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 () => {
@ -59,7 +65,7 @@ async function compileJava() {
await run('jar', '-c', '-f', 'dst/jscript.jar', '-e', 'me.topchetoeu.jscript.Main', '-C', 'dst/classes', '.');
}
catch (e) {
if (argv.includes('debug')) throw e;
if (argv[1] === 'debug') throw e;
else console.log(e.toString());
}
})();

View File

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