From d8626c158b7014e962aef87f3b057369d924aed7 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 21 Jun 2022 06:46:40 +0300 Subject: [PATCH] #6 polished --- src/commands/assemble.js | 1 + src/commands/compile.js | 4 +++- src/commands/link.js | 1 + src/commands/register.js | 5 +++-- src/commands/transpile.js | 4 +++- src/eoc.js | 1 + src/tinted-console.js | 4 ++-- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/commands/assemble.js b/src/commands/assemble.js index e4a0bb4..7a1ce6a 100644 --- a/src/commands/assemble.js +++ b/src/commands/assemble.js @@ -41,4 +41,5 @@ module.exports = function assemble(opts) { `-Deo.placed=${path.resolve(opts.target, 'eo-placed.csv')}`, `-Deo.placedFormat=csv`, ]); + console.info('EO program assembled in %s', path.resolve(opts.target)); }; diff --git a/src/commands/compile.js b/src/commands/compile.js index bb19e4b..6b3e0ea 100644 --- a/src/commands/compile.js +++ b/src/commands/compile.js @@ -31,12 +31,14 @@ const path = require('path'); * @param {Hash} opts - All options */ module.exports = function compile(opts) { + const target = path.resolve(opts.target); mvnwSync([ 'compiler:compile', opts.verbose ? '' : '--quiet', `-Dmaven.compiler.source=1.8`, `-Dmaven.compiler.target=1.8`, - `-Deo.targetDir=${path.resolve(opts.target)}`, + `-Deo.targetDir=${target}`, `-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`, ]); + console.info('Java .class files compiled into %s', target); }; diff --git a/src/commands/link.js b/src/commands/link.js index 33ce4b4..fc439a8 100644 --- a/src/commands/link.js +++ b/src/commands/link.js @@ -36,4 +36,5 @@ module.exports = function link(opts) { opts.verbose ? '' : '--quiet', `-Deo.targetDir=${path.resolve(opts.target)}`, ]); + console.info('Executable JAR created at %s', path.resolve(opts.target, 'eoc.jar')); }; diff --git a/src/commands/register.js b/src/commands/register.js index 9566b07..34b68c5 100644 --- a/src/commands/register.js +++ b/src/commands/register.js @@ -31,13 +31,14 @@ const path = require('path'); * @param {Hash} opts - All options */ module.exports = function register(opts) { + const foreign = path.resolve(opts.target, 'eo-foreign.csv'); mvnwSync([ 'eo:register', opts.verbose ? '' : '--quiet', `-Deo.targetDir=${path.resolve(opts.target)}`, `-Deo.sourcesDir=${path.resolve(opts.sources)}`, - `-Deo.foreign=${path.resolve(opts.target, 'eo-foreign.csv')}`, + `-Deo.foreign=${foreign}`, `-Deo.foreignFormat=csv`, ]); - console.info(); + console.info('EO objects registered in %s', foreign); }; diff --git a/src/commands/transpile.js b/src/commands/transpile.js index 44f5d1d..9d2571d 100644 --- a/src/commands/transpile.js +++ b/src/commands/transpile.js @@ -31,12 +31,14 @@ const path = require('path'); * @param {Hash} opts - All options */ module.exports = function transpile(opts) { + const sources = path.resolve(opts.target, 'generated-sources'); mvnwSync([ 'eo:transpile', opts.verbose ? '' : '--quiet', `-Deo.targetDir=${path.resolve(opts.target)}`, - `-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`, + `-Deo.generatedDir=${sources}`, `-Deo.foreign=${path.resolve(opts.target, 'eo-foreign.csv')}`, `-Deo.foreignFormat=csv`, ]); + console.info('Java sources generated in %s', sources); }; diff --git a/src/eoc.js b/src/eoc.js index 0d6d9a4..8099e70 100755 --- a/src/eoc.js +++ b/src/eoc.js @@ -38,6 +38,7 @@ const test = require('./commands/test'); if (process.argv.includes('--verbose')) { tinted.enable('debug'); console.debug('Debug output is turned ON'); + console.info('INFO'); } program diff --git a/src/tinted-console.js b/src/tinted-console.js index 75bc2b0..0e6039a 100644 --- a/src/tinted-console.js +++ b/src/tinted-console.js @@ -37,15 +37,15 @@ const levels = { const colors = { 'trace': 'gray', 'debug': 'gray', - 'info': 'black', + 'info': 'white', 'warn': 'orange', 'error': 'red', }; for (const level in levels) { if (levels.hasOwnProperty(level)) { - const before = console[level]; const lvl = level; + const before = console[lvl]; console[level] = function(...args) { if (!levels[lvl]) { return;