Create environments #4
@ -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";
|
|
||||||
}
|
|
28
build.js
28
build.js
@ -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());
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user