eolang 0.13.3 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/eo-version.txt +1 -0
- package/mvnw/.mvn/wrapper/maven-wrapper.properties +1 -1
- package/mvnw/pom.xml +5 -5
- package/package.json +6 -6
- package/src/commands/assemble.js +2 -13
- package/src/commands/audit.js +1 -1
- package/src/commands/compile.js +2 -11
- package/src/commands/dataize.js +14 -11
- package/src/commands/link.js +2 -8
- package/src/commands/parse.js +2 -10
- package/src/commands/phi.js +48 -0
- package/src/commands/register.js +2 -9
- package/src/commands/sodg.js +2 -8
- package/src/commands/test.js +2 -7
- package/src/commands/transpile.js +2 -9
- package/src/commands/verify.js +38 -0
- package/src/eoc.js +44 -3
- package/src/mvnw.js +25 -3
- package/src/version.js +2 -2
package/README.md
CHANGED
package/eo-version.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.34.1
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
# KIND, either express or implied. See the License for the
|
|
15
15
|
# specific language governing permissions and limitations
|
|
16
16
|
# under the License.
|
|
17
|
-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.
|
|
17
|
+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
|
|
18
18
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
|
package/mvnw/pom.xml
CHANGED
|
@@ -24,11 +24,11 @@ SOFTWARE.
|
|
|
24
24
|
<modelVersion>4.0.0</modelVersion>
|
|
25
25
|
<groupId>org.eolang</groupId>
|
|
26
26
|
<artifactId>eoc</artifactId>
|
|
27
|
-
<version>
|
|
27
|
+
<version>0.0.0</version>
|
|
28
28
|
<properties>
|
|
29
29
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
30
30
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
31
|
-
<eo.version>
|
|
31
|
+
<eo.version>undefined</eo.version>
|
|
32
32
|
</properties>
|
|
33
33
|
<dependencies>
|
|
34
34
|
<dependency>
|
|
@@ -39,12 +39,12 @@ SOFTWARE.
|
|
|
39
39
|
<dependency>
|
|
40
40
|
<groupId>org.junit.jupiter</groupId>
|
|
41
41
|
<artifactId>junit-jupiter-api</artifactId>
|
|
42
|
-
<version>5.
|
|
42
|
+
<version>5.10.1</version>
|
|
43
43
|
</dependency>
|
|
44
44
|
<dependency>
|
|
45
45
|
<groupId>org.junit.jupiter</groupId>
|
|
46
46
|
<artifactId>junit-jupiter-engine</artifactId>
|
|
47
|
-
<version>5.
|
|
47
|
+
<version>5.10.1</version>
|
|
48
48
|
</dependency>
|
|
49
49
|
</dependencies>
|
|
50
50
|
<build>
|
|
@@ -87,7 +87,7 @@ SOFTWARE.
|
|
|
87
87
|
</plugin>
|
|
88
88
|
<plugin>
|
|
89
89
|
<artifactId>maven-surefire-plugin</artifactId>
|
|
90
|
-
<version>3.
|
|
90
|
+
<version>3.2.3</version>
|
|
91
91
|
<configuration>
|
|
92
92
|
<failIfNoTests>true</failIfNoTests>
|
|
93
93
|
</configuration>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eolang",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"author": "Yegor Bugayenko <yegor256@gmail.com> (https://www.yegor256.com/)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "objectionary/eoc",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"colors": "1.4.0",
|
|
34
|
-
"commander": "
|
|
35
|
-
"fast-xml-parser": "4.
|
|
36
|
-
"node": "
|
|
34
|
+
"commander": "11.1.0",
|
|
35
|
+
"fast-xml-parser": "4.3.2",
|
|
36
|
+
"node": "21.2.0",
|
|
37
37
|
"sync-request": "6.1.0",
|
|
38
38
|
"xmlhttprequest": "1.8.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"eslint": "8.
|
|
41
|
+
"eslint": "8.56.0",
|
|
42
42
|
"eslint-config-google": "0.14.0",
|
|
43
43
|
"grunt": "1.6.1",
|
|
44
44
|
"grunt-contrib-clean": "2.0.1",
|
|
45
|
-
"grunt-eslint": "24.
|
|
45
|
+
"grunt-eslint": "24.3.0",
|
|
46
46
|
"grunt-mocha-cli": "^7.0.0",
|
|
47
47
|
"mocha": "^10.2.0"
|
|
48
48
|
},
|
package/src/commands/assemble.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const path = require('path');
|
|
26
|
-
const mvnw = require('../mvnw');
|
|
26
|
+
const {mvnw, flags} = require('../mvnw');
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Command to assemble .XMIR files.
|
|
@@ -31,18 +31,7 @@ const mvnw = require('../mvnw');
|
|
|
31
31
|
* @return {Promise} of assemble task
|
|
32
32
|
*/
|
|
33
33
|
module.exports = function(opts) {
|
|
34
|
-
return mvnw([
|
|
35
|
-
'eo:assemble',
|
|
36
|
-
'-Deo.version=' + opts.parser,
|
|
37
|
-
'-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
|
|
38
|
-
opts.verbose ? '--errors' : '',
|
|
39
|
-
opts.verbose ? '' : '--quiet',
|
|
40
|
-
opts.trackOptimizationSteps ? '-Deo.trackOptimizationSteps' : '',
|
|
41
|
-
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
42
|
-
`-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
|
|
43
|
-
`-Deo.placed=${path.resolve(opts.target, 'eo-placed.csv')}`,
|
|
44
|
-
`-Deo.placedFormat=csv`,
|
|
45
|
-
], opts.target, opts.batch).then((r) => {
|
|
34
|
+
return mvnw(['eo:assemble'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
|
|
46
35
|
console.info('EO program assembled in %s', path.resolve(opts.target));
|
|
47
36
|
return r;
|
|
48
37
|
});
|
package/src/commands/audit.js
CHANGED
package/src/commands/compile.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const mvnw = require('../mvnw');
|
|
25
|
+
const {mvnw, flags} = require('../mvnw');
|
|
26
26
|
const path = require('path');
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -32,16 +32,7 @@ const path = require('path');
|
|
|
32
32
|
*/
|
|
33
33
|
module.exports = function(opts) {
|
|
34
34
|
const target = path.resolve(opts.target);
|
|
35
|
-
return mvnw([
|
|
36
|
-
'compiler:compile',
|
|
37
|
-
opts.verbose ? '--errors' : '',
|
|
38
|
-
opts.verbose ? '' : '--quiet',
|
|
39
|
-
`-Dmaven.compiler.source=1.8`,
|
|
40
|
-
`-Dmaven.compiler.target=1.8`,
|
|
41
|
-
`-Deo.targetDir=${target}`,
|
|
42
|
-
`-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
|
|
43
|
-
'-Deo.version=' + opts.parser,
|
|
44
|
-
], opts.target, opts.batch).then((r) => {
|
|
35
|
+
return mvnw(['compiler:compile'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
|
|
45
36
|
console.info('Java .class files compiled into %s', target);
|
|
46
37
|
return r;
|
|
47
38
|
});
|
package/src/commands/dataize.js
CHANGED
|
@@ -32,15 +32,18 @@ const path = require('path');
|
|
|
32
32
|
* @param {Hash} opts - All options
|
|
33
33
|
*/
|
|
34
34
|
module.exports = function(obj, args, opts) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
|
|
35
|
+
const params = [
|
|
36
|
+
'-Dfile.encoding=UTF-8',
|
|
37
|
+
`-Xss${opts.stack}`,
|
|
38
|
+
'-jar', path.resolve(opts.target, 'eoc.jar'),
|
|
39
|
+
obj,
|
|
40
|
+
...args,
|
|
41
|
+
];
|
|
42
|
+
console.debug('+ java ' + params.join(' '));
|
|
43
|
+
spawn('java', params, {stdio: 'inherit'}).on('close', (code) => {
|
|
44
|
+
if (code !== 0) {
|
|
45
|
+
console.error(`Java exited with #${code} code`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
46
49
|
};
|
package/src/commands/link.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const mvnw = require('../mvnw');
|
|
25
|
+
const {mvnw, flags} = require('../mvnw');
|
|
26
26
|
const path = require('path');
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -31,13 +31,7 @@ const path = require('path');
|
|
|
31
31
|
* @return {Promise} of link task
|
|
32
32
|
*/
|
|
33
33
|
module.exports = function(opts) {
|
|
34
|
-
return mvnw([
|
|
35
|
-
'jar:jar',
|
|
36
|
-
opts.verbose ? '--errors' : '',
|
|
37
|
-
opts.verbose ? '' : '--quiet',
|
|
38
|
-
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
39
|
-
'-Deo.version=' + opts.parser,
|
|
40
|
-
], opts.target, opts.batch).then((r) => {
|
|
34
|
+
return mvnw(['jar:jar'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
|
|
41
35
|
console.info('Executable JAR created at %s', path.resolve(opts.target, 'eoc.jar'));
|
|
42
36
|
return r;
|
|
43
37
|
});
|
package/src/commands/parse.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const path = require('path');
|
|
26
|
-
const mvnw = require('../mvnw');
|
|
26
|
+
const {mvnw, flags} = require('../mvnw');
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Command to parse EO into .XMIR files.
|
|
@@ -31,15 +31,7 @@ const mvnw = require('../mvnw');
|
|
|
31
31
|
* @return {Promise} of assemble task
|
|
32
32
|
*/
|
|
33
33
|
module.exports = function(opts) {
|
|
34
|
-
return mvnw([
|
|
35
|
-
'eo:parse',
|
|
36
|
-
'-Deo.version=' + opts.parser,
|
|
37
|
-
'-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
|
|
38
|
-
opts.verbose ? '--errors' : '',
|
|
39
|
-
opts.verbose ? '' : '--quiet',
|
|
40
|
-
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
41
|
-
`-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
|
|
42
|
-
], opts.target, opts.batch).then((r) => {
|
|
34
|
+
return mvnw(['eo:parse'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
|
|
43
35
|
console.info('EO sources parsed in %s', path.resolve(opts.target));
|
|
44
36
|
return r;
|
|
45
37
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022-2023 Objectionary.com
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included
|
|
14
|
+
* in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const {mvnw, flags} = require('../mvnw');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Command to convert .XMIR files into .PHI files.
|
|
30
|
+
* @param {Hash} opts - All options
|
|
31
|
+
* @return {Promise} of assemble task
|
|
32
|
+
*/
|
|
33
|
+
module.exports = function(opts) {
|
|
34
|
+
return mvnw(
|
|
35
|
+
['eo:xmir-to-phi']
|
|
36
|
+
.concat(flags(opts))
|
|
37
|
+
.concat(
|
|
38
|
+
[
|
|
39
|
+
`-DphiInputDir=${path.resolve(opts.target, '2-optimize')}`,
|
|
40
|
+
`-DphiOutputDir=${path.resolve(opts.target, 'phi')}`,
|
|
41
|
+
]
|
|
42
|
+
),
|
|
43
|
+
opts.target, opts.batch
|
|
44
|
+
).then((r) => {
|
|
45
|
+
console.info('XMIR files converted into PHI files at %s', path.resolve(opts.target));
|
|
46
|
+
return r;
|
|
47
|
+
});
|
|
48
|
+
};
|
package/src/commands/register.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const mvnw = require('../mvnw');
|
|
25
|
+
const {mvnw, flags} = require('../mvnw');
|
|
26
26
|
const path = require('path');
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -32,14 +32,7 @@ const path = require('path');
|
|
|
32
32
|
*/
|
|
33
33
|
module.exports = function(opts) {
|
|
34
34
|
const foreign = path.resolve(opts.target, 'eo-foreign.json');
|
|
35
|
-
return mvnw([
|
|
36
|
-
'eo:register',
|
|
37
|
-
'-Deo.version=' + opts.parser,
|
|
38
|
-
opts.verbose ? '--errors' : '',
|
|
39
|
-
opts.verbose ? '' : '--quiet',
|
|
40
|
-
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
41
|
-
`-Deo.sourcesDir=${path.resolve(opts.sources)}`,
|
|
42
|
-
], opts.target, opts.batch).then((r) => {
|
|
35
|
+
return mvnw(['eo:register'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
|
|
43
36
|
console.info('EO objects registered in %s', foreign);
|
|
44
37
|
return r;
|
|
45
38
|
});
|
package/src/commands/sodg.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const path = require('path');
|
|
26
|
-
const mvnw = require('../mvnw');
|
|
26
|
+
const {mvnw, flags} = require('../mvnw');
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Generate SODG files from XMIR.
|
|
@@ -31,13 +31,7 @@ const mvnw = require('../mvnw');
|
|
|
31
31
|
* @return {Promise} of sodg task
|
|
32
32
|
*/
|
|
33
33
|
module.exports = function(opts) {
|
|
34
|
-
const argv = [
|
|
35
|
-
'eo:sodg',
|
|
36
|
-
'-Deo.version=' + opts.parser,
|
|
37
|
-
opts.verbose ? '' : '--quiet',
|
|
38
|
-
opts.verbose ? '--errors' : '',
|
|
39
|
-
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
40
|
-
];
|
|
34
|
+
const argv = ['eo:sodg'].concat(flags(opts));
|
|
41
35
|
argv.push('-Deo.sodgIncludes=' + opts.include);
|
|
42
36
|
if (opts.exclude) {
|
|
43
37
|
argv.push('-Deo.sodgExcludes=' + opts.exclude);
|
package/src/commands/test.js
CHANGED
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const mvnw = require('../mvnw');
|
|
26
|
-
const path = require('path');
|
|
25
|
+
const {mvnw, flags} = require('../mvnw');
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
28
|
* Command to run all available unit tests.
|
|
@@ -31,9 +30,5 @@ const path = require('path');
|
|
|
31
30
|
* @return {Promise} of compile task
|
|
32
31
|
*/
|
|
33
32
|
module.exports = function(opts) {
|
|
34
|
-
return mvnw([
|
|
35
|
-
'surefire:test',
|
|
36
|
-
'-Deo.version=' + opts.parser,
|
|
37
|
-
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
38
|
-
]);
|
|
33
|
+
return mvnw(['surefire:test'].concat(flags(opts)));
|
|
39
34
|
};
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const mvnw = require('../mvnw');
|
|
25
|
+
const {mvnw, flags} = require('../mvnw');
|
|
26
26
|
const path = require('path');
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -32,14 +32,7 @@ const path = require('path');
|
|
|
32
32
|
*/
|
|
33
33
|
module.exports = function(opts) {
|
|
34
34
|
const sources = path.resolve(opts.target, 'generated-sources');
|
|
35
|
-
return mvnw([
|
|
36
|
-
'eo:transpile',
|
|
37
|
-
'-Deo.version=' + opts.parser,
|
|
38
|
-
opts.verbose ? '--errors' : '',
|
|
39
|
-
opts.verbose ? '' : '--quiet',
|
|
40
|
-
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
41
|
-
`-Deo.generatedDir=${sources}`,
|
|
42
|
-
], opts.target, opts.batch).then((r) => {
|
|
35
|
+
return mvnw(['eo:transpile'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
|
|
43
36
|
console.info('Java sources generated in %s', sources);
|
|
44
37
|
return r;
|
|
45
38
|
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022-2023 Objectionary.com
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included
|
|
14
|
+
* in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const {mvnw, flags} = require('../mvnw');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Command to verify .XMIR files.
|
|
30
|
+
* @param {Hash} opts - All options
|
|
31
|
+
* @return {Promise} of assemble task
|
|
32
|
+
*/
|
|
33
|
+
module.exports = function(opts) {
|
|
34
|
+
return mvnw(['eo:verify'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
|
|
35
|
+
console.info('EO program verified in %s', path.resolve(opts.target));
|
|
36
|
+
return r;
|
|
37
|
+
});
|
|
38
|
+
};
|
package/src/eoc.js
CHANGED
|
@@ -30,7 +30,9 @@ const clean = require('./commands/clean');
|
|
|
30
30
|
const parse = require('./commands/parse');
|
|
31
31
|
const assemble = require('./commands/assemble');
|
|
32
32
|
const sodg = require('./commands/sodg');
|
|
33
|
+
const phi = require('./commands/phi');
|
|
33
34
|
const register = require('./commands/register');
|
|
35
|
+
const verify = require('./commands/verify');
|
|
34
36
|
const transpile = require('./commands/transpile');
|
|
35
37
|
const compile = require('./commands/compile');
|
|
36
38
|
const link = require('./commands/link');
|
|
@@ -43,16 +45,23 @@ if (process.argv.includes('--verbose')) {
|
|
|
43
45
|
console.debug('Debug output is turned ON');
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
const fs = require('fs');
|
|
49
|
+
const path = require('path');
|
|
50
|
+
let parser = fs.readFileSync(path.join(__dirname, '../eo-version.txt'), 'utf8');
|
|
47
51
|
if (process.argv.includes('--latest')) {
|
|
48
52
|
parser = require('./parser-version').get();
|
|
53
|
+
} else {
|
|
54
|
+
console.debug('EO parser ' + parser + '; use the --latest flag if you need a freshier one');
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
const version = require('./version');
|
|
52
58
|
program
|
|
53
59
|
.name('eoc')
|
|
54
|
-
.
|
|
55
|
-
.
|
|
60
|
+
.usage('[options] command')
|
|
61
|
+
.summary('EO command line toolkit')
|
|
62
|
+
.description('EO command-line toolkit (' + version.what + ' built on ' + version.when + ')')
|
|
63
|
+
.version(version.what, '-v, --version', 'Output the version number')
|
|
64
|
+
.helpOption('-?, --help', 'Print this help information');
|
|
56
65
|
|
|
57
66
|
program
|
|
58
67
|
.option('-s, --sources <path>', 'Directory with .EO sources', '.')
|
|
@@ -65,6 +74,7 @@ program
|
|
|
65
74
|
.option('--no-color', 'Disable colorization of console messages')
|
|
66
75
|
.option('--track-optimization-steps', 'Save intermediate XMIR files')
|
|
67
76
|
.option('-c, --clean', 'Delete ./.eoc directory')
|
|
77
|
+
.option('--debug', 'Print ALL debug messages, heavily overloading the log')
|
|
68
78
|
.option('--verbose', 'Print debug messages and full output of child processes');
|
|
69
79
|
|
|
70
80
|
program.command('audit')
|
|
@@ -136,6 +146,32 @@ program.command('sodg')
|
|
|
136
146
|
}
|
|
137
147
|
});
|
|
138
148
|
|
|
149
|
+
program.command('phi')
|
|
150
|
+
.description('Generate PHI files from XMIR')
|
|
151
|
+
.action((str, opts) => {
|
|
152
|
+
clear(str);
|
|
153
|
+
if (program.opts().alone == undefined) {
|
|
154
|
+
register(program.opts())
|
|
155
|
+
.then((r) => assemble(program.opts()))
|
|
156
|
+
.then((r) => phi(program.opts()));
|
|
157
|
+
} else {
|
|
158
|
+
phi(program.opts());
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
program.command('verify')
|
|
163
|
+
.description('Verify XMIR files and fail if any issues inside')
|
|
164
|
+
.action((str, opts) => {
|
|
165
|
+
clear(str);
|
|
166
|
+
if (program.opts().alone == undefined) {
|
|
167
|
+
register(program.opts())
|
|
168
|
+
.then((r) => assemble(program.opts()))
|
|
169
|
+
.then((r) => verify(program.opts()));
|
|
170
|
+
} else {
|
|
171
|
+
verify(program.opts());
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
139
175
|
program.command('transpile')
|
|
140
176
|
.description('Convert EO files into target language')
|
|
141
177
|
.action((str, opts) => {
|
|
@@ -143,6 +179,7 @@ program.command('transpile')
|
|
|
143
179
|
if (program.opts().alone == undefined) {
|
|
144
180
|
register(program.opts())
|
|
145
181
|
.then((r) => assemble(program.opts()))
|
|
182
|
+
.then((r) => verify(program.opts()))
|
|
146
183
|
.then((r) => transpile(program.opts()));
|
|
147
184
|
} else {
|
|
148
185
|
transpile(program.opts());
|
|
@@ -156,6 +193,7 @@ program.command('compile')
|
|
|
156
193
|
if (program.opts().alone == undefined) {
|
|
157
194
|
register(program.opts())
|
|
158
195
|
.then((r) => assemble(program.opts()))
|
|
196
|
+
.then((r) => verify(program.opts()))
|
|
159
197
|
.then((r) => transpile(program.opts()))
|
|
160
198
|
.then((r) => compile(program.opts()));
|
|
161
199
|
} else {
|
|
@@ -170,6 +208,7 @@ program.command('link')
|
|
|
170
208
|
if (program.opts().alone == undefined) {
|
|
171
209
|
register(program.opts())
|
|
172
210
|
.then((r) => assemble(program.opts()))
|
|
211
|
+
.then((r) => verify(program.opts()))
|
|
173
212
|
.then((r) => transpile(program.opts()))
|
|
174
213
|
.then((r) => compile(program.opts()))
|
|
175
214
|
.then((r) => link(program.opts()));
|
|
@@ -186,6 +225,7 @@ program.command('dataize')
|
|
|
186
225
|
if (program.opts().alone == undefined) {
|
|
187
226
|
register(program.opts())
|
|
188
227
|
.then((r) => assemble(program.opts()))
|
|
228
|
+
.then((r) => verify(program.opts()))
|
|
189
229
|
.then((r) => transpile(program.opts()))
|
|
190
230
|
.then((r) => compile(program.opts()))
|
|
191
231
|
.then((r) => link(program.opts()))
|
|
@@ -202,6 +242,7 @@ program.command('test')
|
|
|
202
242
|
if (program.opts().alone == undefined) {
|
|
203
243
|
register(program.opts())
|
|
204
244
|
.then((r) => assemble(program.opts()))
|
|
245
|
+
.then((r) => verify(program.opts()))
|
|
205
246
|
.then((r) => transpile(program.opts()))
|
|
206
247
|
.then((r) => compile(program.opts()))
|
|
207
248
|
.then((r) => link(program.opts()))
|
package/src/mvnw.js
CHANGED
|
@@ -43,6 +43,28 @@ let target;
|
|
|
43
43
|
let running = false;
|
|
44
44
|
let beginning;
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Prepare options for Maven.
|
|
48
|
+
* @param {Hash} opts - Opts provided to the "eoc"
|
|
49
|
+
* @return {Array} of Maven options
|
|
50
|
+
*/
|
|
51
|
+
module.exports.flags = function(opts) {
|
|
52
|
+
return [
|
|
53
|
+
'-Deo.version=' + opts.parser,
|
|
54
|
+
'-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
|
|
55
|
+
opts.verbose ? '--errors' : '',
|
|
56
|
+
opts.verbose ? '' : '--quiet',
|
|
57
|
+
opts.debug ? '--debug' : '',
|
|
58
|
+
`-Deo.sourcesDir=${path.resolve(opts.sources)}`,
|
|
59
|
+
`-Deo.targetDir=${path.resolve(opts.target)}`,
|
|
60
|
+
`-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
|
|
61
|
+
`-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
|
|
62
|
+
`-Deo.placed=${path.resolve(opts.target, 'eo-placed.csv')}`,
|
|
63
|
+
`-Deo.placedFormat=csv`,
|
|
64
|
+
opts.trackOptimizationSteps ? '-Deo.trackOptimizationSteps' : '',
|
|
65
|
+
];
|
|
66
|
+
};
|
|
67
|
+
|
|
46
68
|
/**
|
|
47
69
|
* Run mvnw with provided commands.
|
|
48
70
|
* @param {Hash} args - All arguments to pass to it
|
|
@@ -50,7 +72,7 @@ let beginning;
|
|
|
50
72
|
* @param {Boolean} batch - Is it batch mode (TRUE) or interactive (FALSE)?
|
|
51
73
|
* @return {Promise} of maven execution task
|
|
52
74
|
*/
|
|
53
|
-
module.exports = function(args, tgt, batch) {
|
|
75
|
+
module.exports.mvnw = function(args, tgt, batch) {
|
|
54
76
|
return new Promise((resolve, reject) => {
|
|
55
77
|
target = tgt;
|
|
56
78
|
phase = args[0];
|
|
@@ -131,7 +153,6 @@ function stop() {
|
|
|
131
153
|
* Prints mvnw execution status.
|
|
132
154
|
*/
|
|
133
155
|
function print() {
|
|
134
|
-
readline.clearLine(process.stdout);
|
|
135
156
|
const duration = Date.now() - beginning;
|
|
136
157
|
/**
|
|
137
158
|
* Recursively calculates number of files under a directory.
|
|
@@ -161,8 +182,9 @@ function print() {
|
|
|
161
182
|
elapsed = `${Math.ceil(duration / 3600000)}min`;
|
|
162
183
|
}
|
|
163
184
|
process.stdout.write(
|
|
164
|
-
colors.yellow(`[${phase}] ${elapsed}; ${count(target, 0)} files generated...`)
|
|
185
|
+
colors.yellow(`[${phase}] ${elapsed}; ${count(target, 0)} files generated so far...`)
|
|
165
186
|
);
|
|
187
|
+
readline.clearLine(process.stdout, 1);
|
|
166
188
|
readline.cursorTo(process.stdout, 0);
|
|
167
189
|
}
|
|
168
190
|
|
package/src/version.js
CHANGED