Create environments #4
8
build.js
8
build.js
@ -3,7 +3,7 @@ const fs = require('fs/promises');
|
|||||||
const pt = require('path');
|
const pt = require('path');
|
||||||
const conf = require('./meta');
|
const conf = require('./meta');
|
||||||
const { argv } = require('process');
|
const { argv } = require('process');
|
||||||
conf.version = argv[2];
|
conf.version = argv[3].substring(1);
|
||||||
|
|
||||||
async function* find(src, dst, wildcard) {
|
async function* find(src, dst, wildcard) {
|
||||||
const stat = await fs.stat(src);
|
const stat = await fs.stat(src);
|
||||||
@ -45,7 +45,7 @@ async function compileJava() {
|
|||||||
.replace('${NAME}', conf.name)
|
.replace('${NAME}', conf.name)
|
||||||
.replace('${AUTHOR}', conf.author)
|
.replace('${AUTHOR}', conf.author)
|
||||||
);
|
);
|
||||||
const args = ['--release', '10', ];
|
const args = ['--release', '11', ];
|
||||||
if (argv[1] === 'debug') args.push('-g');
|
if (argv[1] === 'debug') args.push('-g');
|
||||||
args.push('-d', 'dst/classes', 'Metadata.java');
|
args.push('-d', 'dst/classes', 'Metadata.java');
|
||||||
|
|
||||||
@ -59,14 +59,14 @@ async function compileJava() {
|
|||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
fs.rm('dst', { recursive: true });
|
try { await fs.rm('dst', { recursive: true }); } catch {}
|
||||||
await copy('src', 'dst/classes', v => !v.endsWith('.java'));
|
await copy('src', 'dst/classes', v => !v.endsWith('.java'));
|
||||||
await run('tsc', '-p', 'lib/tsconfig.json', '--outFile', 'dst/classes/me/topchetoeu/jscript/js/core.js'),
|
await run('tsc', '-p', 'lib/tsconfig.json', '--outFile', 'dst/classes/me/topchetoeu/jscript/js/core.js'),
|
||||||
await compileJava();
|
await 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[1] === 'debug') throw e;
|
if (argv[2] === 'debug') throw e;
|
||||||
else console.log(e.toString());
|
else console.log(e.toString());
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -35,8 +35,8 @@ interface Internals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
var env: Environment = arguments[0], internals: Internals = arguments[1];
|
||||||
var env: Environment = arguments[0], internals: Internals = arguments[1], log = internals.constructor.log;
|
globalThis.log = internals.constructor.log;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
run('values/object');
|
run('values/object');
|
||||||
|
Loading…
Reference in New Issue
Block a user