Skip to content

Commit

Permalink
#205: compile works
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 22, 2023
1 parent ec64572 commit 1d848a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/commands/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = function(opts) {
`-Deo.targetDir=${target}`,
`-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
'-Deo.version=' + opts.parser,
'-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
], opts.target, opts.batch).then((r) => {
console.info('Java .class files compiled into %s', target);
return r;
Expand Down
17 changes: 14 additions & 3 deletions test/commands/test_compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ describe('compile', function() {
fs.mkdirSync(path.resolve(home, 'src'), {recursive: true});
fs.writeFileSync(path.resolve(home, 'src/simple.eo'), simple());
const stdout = runSync([
'compile', '-s', path.resolve(home, 'src'), '-t', path.resolve(home, 'target'),
'compile',
'--parser=0.34.1',
'--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
assertFilesExist(
stdout, home,
Expand Down Expand Up @@ -68,6 +72,8 @@ describe('compile', function() {
const stdout = runSync([
'compile',
'--verbose',
'--parser=0.34.1',
'--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
Expand All @@ -87,7 +93,12 @@ describe('compile', function() {
fs.mkdirSync(path.resolve(home, 'src'), {recursive: true});
fs.writeFileSync(path.resolve(home, 'src/simple.eo'), simple());
const stdout = runSync([
'compile', '--clean', '-s', path.resolve(home, 'src'), '-t', path.resolve(home, 'target'),
'compile',
'--clean',
'--parser=0.34.1',
'--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
assert(stdout.includes(`The directory ${path.resolve(home, 'target')} deleted`), stdout);
done();
Expand All @@ -103,7 +114,7 @@ function simple() {
'+package foo.bar',
'+alias org.eolang.io.stdout',
'',
'[args...] > app',
'[args] > app',
' stdout "Hello, world!" > @',
].join('\n');
}

0 comments on commit 1d848a8

Please sign in to comment.