Skip to content

Commit

Permalink
Merge pull request #421 from objectionary/420
Browse files Browse the repository at this point in the history
--easy
  • Loading branch information
yegor256 authored Dec 13, 2024
2 parents abf64d8 + 1e7a5e2 commit 58e8f33
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/itest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
node: [ 16 ]
# lang: [Java, JavaScript]
lang: [ Java ]
parser: [ 0.48.1 ]
tag: [ 0.48.1 ]
parser: [ 0.48.2 ]
tag: [ 0.48.2 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -55,7 +55,7 @@ jobs:
- run: npm install
- run: |
cd itest
node ../src/eoc.js "--parser=${{ matrix.parser }}" "--home-tag=${{ matrix.tag }}" --batch "--language=${{ matrix.lang }}" dataize program
node ../src/eoc.js "--parser=${{ matrix.parser }}" "--home-tag=${{ matrix.tag }}" --batch --alone "--language=${{ matrix.lang }}" dataize program
node ../src/eoc.js "--parser=${{ matrix.parser }}" "--home-tag=${{ matrix.tag }}" --batch "--language=${{ matrix.lang }}" --easy dataize program
node ../src/eoc.js "--parser=${{ matrix.parser }}" "--home-tag=${{ matrix.tag }}" --batch --alone "--language=${{ matrix.lang }}" --easy dataize program
node ../src/eoc.js clean
node ../src/eoc.js "--parser=${{ matrix.parser }}" "--home-tag=${{ matrix.tag }}" --batch "--language=${{ matrix.lang }}" test
node ../src/eoc.js "--parser=${{ matrix.parser }}" "--home-tag=${{ matrix.tag }}" --batch "--language=${{ matrix.lang }}" --easy test
2 changes: 1 addition & 1 deletion eo-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.48.1
0.48.2
2 changes: 1 addition & 1 deletion home-tag.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.48.1
0.48.2
2 changes: 2 additions & 0 deletions mvnw/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ SOFTWARE.
<version>3.5.2</version>
<configuration>
<failIfNoTests>true</failIfNoTests>
<useFile>false</useFile>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
Expand Down
13 changes: 11 additions & 2 deletions src/commands/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,22 @@ const semver = require('semver');
* @return {Promise} of assemble task
*/
module.exports = function(opts) {
const extra = [
`-Deo.failOnWarning=${opts.easy ? 'false' : 'true'}`,
];
if (semver.gte(opts.parser, '0.45.0')) {
return mvnw(['eo:lint'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
return mvnw(
['eo:lint'].concat(flags(opts)).concat(extra),
opts.target, opts.batch
).then((r) => {
console.info('EO program linted in %s', rel(path.resolve(opts.target)));
return r;
});
} else {
return mvnw(['eo:verify'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
return mvnw(
['eo:verify'].concat(flags(opts)).concat(extra),
opts.target, opts.batch
).then((r) => {
console.info('EO program verified in %s', rel(path.resolve(opts.target)));
return r;
});
Expand Down
10 changes: 5 additions & 5 deletions src/eoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if (process.argv.includes('--latest')) {
// latest hash of the objectionary/home repository, and then
// set it to the "hash" variable?
} else {
console.debug('EO parser ' + parser + '; use the --latest flag if you need a freshier one');
console.debug(`EO parser ${parser}; use the --latest flag if you need a freshier one`);
}

const version = require('./version');
Expand All @@ -100,17 +100,17 @@ program
.usage('[options] command')
.summary('EO command line toolkit')
.description(
'EO command-line toolkit (' +
version.what + ' built on ' + version.when +
'): https://github.com/objectionary/eoc'
`EO command-line toolkit (${version.what}) ` +
`built on ${version.when}): https://github.com/objectionary/eoc`
)
.version(version.what, '-v, --version', 'Output the version number')
.version(version.what, '-v, --version', `Just print the number of the version (${version.what})`)
.helpOption('-?, --help', 'Print this help information')
.configureHelp({sortOptions: true, sortSubcommands: true});

program
.option('-s, --sources <path>', 'Directory with .EO sources', '.')
.option('-t, --target <path>', 'Directory with all generated files', '.eoc')
.option('--easy', 'Ignore "warnings" and only fail if there are "errorst" or "criticals"')
.option('--home-tag <version>', 'Git tag in objectionary/home to compile against', tag)
.option('--parser <version>', 'Set the version of EO parser to use', parser)
.option('--latest', 'Use the latest parser version from Maven Central')
Expand Down
4 changes: 2 additions & 2 deletions src/mvnw.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ module.exports.flags = function(opts) {
const target = path.resolve(opts.target);
console.debug('Target in %s', rel(target));
return [
'-Deo.version=' + opts.parser,
'-Deo.tag=' + (opts.homeTag ? opts.homeTag : opts.parser),
`-Deo.version=${opts.parser}`,
`-Deo.tag=${opts.homeTag ? opts.homeTag : opts.parser}`,
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
opts.debug ? '--debug' : '',
Expand Down
3 changes: 3 additions & 0 deletions test/commands/test_compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('compile', function() {
'compile',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'--easy',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
Expand Down Expand Up @@ -74,6 +75,7 @@ describe('compile', function() {
const stdout = runSync([
'compile',
'--verbose',
'--easy',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'-s', path.resolve(home, 'src'),
Expand All @@ -98,6 +100,7 @@ describe('compile', function() {
runSync([
'compile',
'--clean',
'--easy',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'-s', path.resolve(home, 'src'),
Expand Down
3 changes: 3 additions & 0 deletions test/commands/test_dataize.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {runSync, parserVersion, homeTag, weAreOnline} = require('../helpers');

const options = [
{lang: 'Java', version: parserVersion, tag: homeTag},
{lang: 'Java', version: '0.48.1', tag: '0.48.1'},
{lang: 'Java', version: '0.46.0', tag: '0.46.0'},
{lang: 'Java', version: '0.45.0', tag: '0.45.0'},
{lang: 'Java', version: '0.44.0', tag: '0.44.0'},
Expand Down Expand Up @@ -63,6 +64,7 @@ describe('dataize', function() {
'--stack=64M',
'--heap=1G',
'--clean',
'--easy',
`--parser=${version}`,
`--home-tag=${tag}`,
'-s', path.resolve(home, 'src'),
Expand Down Expand Up @@ -93,6 +95,7 @@ describe('dataize', function() {
const stdout = runSync([
'dataize', 'simple',
'--clean',
'--easy',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'-s', home,
Expand Down
3 changes: 2 additions & 1 deletion test/commands/test_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ describe('link', function() {
return runSync([
'link',
'--verbose',
'--easy',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
'--language=' + lang,
`--language=${lang}`,
]);
};
it('compiles a simple .EO program into an executable .JAR', function(done) {
Expand Down
1 change: 1 addition & 0 deletions test/commands/test_lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('lint', function() {
const stdout = runSync([
'lint',
'--verbose',
'--easy',
'--track-optimization-steps',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
Expand Down
1 change: 1 addition & 0 deletions test/commands/test_sodg.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('sodg', function() {
'sodg',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'--easy',
'--verbose',
'--dot',
'--include=simple',
Expand Down
3 changes: 2 additions & 1 deletion test/commands/test_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ describe('test', function() {
return runSync([
'test',
'--verbose',
'--easy',
`--parser=${parser}`,
`--home-tag=${hash}`,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
'--language=' + lang
`--language=${lang}`
]);
};

Expand Down
3 changes: 2 additions & 1 deletion test/commands/test_transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ describe('transpile', function() {
return runSync([
'transpile',
'--verbose',
'--easy',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
'--language=' + lang,
`--language=${lang}`,
]);
};

Expand Down
2 changes: 1 addition & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports.assertFilesExist = function assertFilesExist(stdout, home, paths)
const abs = path.resolve(home, p);
assert(
fs.existsSync(abs),
stdout + '\nFile ' + abs + ' is absent'
`${stdout}\nFile ${abs} is absent`
);
});
};
Expand Down

0 comments on commit 58e8f33

Please sign in to comment.