eolang 0.33.5 → 0.34.1

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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "MD033": {
3
+ "allowed_elements": ["details", "summary"]
4
+ }
5
+ }
6
+
package/Formula/eolang.rb CHANGED
@@ -7,9 +7,9 @@ require "language/node"
7
7
  class Eolang < Formula
8
8
  desc "Command-line Tool-Kit"
9
9
  homepage "https://github.com/objectionary/eoc"
10
- url "https://github.com/objectionary/eoc/archive/refs/tags/0.33.4.tar.gz"
10
+ url "https://github.com/objectionary/eoc/archive/refs/tags/0.34.0.tar.gz"
11
11
  version "0.33.1"
12
- sha256 "68e7583958c2de456c858fbb9d79aed602a89b17b2012d206af863d039bf8e0b"
12
+ sha256 "d29276ab1c51ac3195fd10fb9578c86851bfc2f49a3a6cce6c2d1c3adb72e7aa"
13
13
  license "MIT"
14
14
 
15
15
  depends_on "node"
@@ -7,9 +7,9 @@ require "language/node"
7
7
  class Eolang < Formula
8
8
  desc "Command-line Tool-Kit"
9
9
  homepage "https://github.com/objectionary/eoc"
10
- url "https://github.com/objectionary/eoc/archive/refs/tags/0.33.4.tar.gz"
10
+ url "https://github.com/objectionary/eoc/archive/refs/tags/0.34.0.tar.gz"
11
11
  version "0.32.0"
12
- sha256 "68e7583958c2de456c858fbb9d79aed602a89b17b2012d206af863d039bf8e0b"
12
+ sha256 "d29276ab1c51ac3195fd10fb9578c86851bfc2f49a3a6cce6c2d1c3adb72e7aa"
13
13
  license "MIT"
14
14
 
15
15
  depends_on "node"
@@ -7,9 +7,9 @@ require "language/node"
7
7
  class Eolang < Formula
8
8
  desc "Command-line Tool-Kit"
9
9
  homepage "https://github.com/objectionary/eoc"
10
- url "https://github.com/objectionary/eoc/archive/refs/tags/0.33.4.tar.gz"
10
+ url "https://github.com/objectionary/eoc/archive/refs/tags/0.34.0.tar.gz"
11
11
  version "0.32.1"
12
- sha256 "68e7583958c2de456c858fbb9d79aed602a89b17b2012d206af863d039bf8e0b"
12
+ sha256 "d29276ab1c51ac3195fd10fb9578c86851bfc2f49a3a6cce6c2d1c3adb72e7aa"
13
13
  license "MIT"
14
14
 
15
15
  depends_on "node"
@@ -7,9 +7,9 @@ require "language/node"
7
7
  class Eolang < Formula
8
8
  desc "Command-line Tool-Kit"
9
9
  homepage "https://github.com/objectionary/eoc"
10
- url "https://github.com/objectionary/eoc/archive/refs/tags/0.33.4.tar.gz"
10
+ url "https://github.com/objectionary/eoc/archive/refs/tags/0.34.0.tar.gz"
11
11
  version "0.33.0"
12
- sha256 "68e7583958c2de456c858fbb9d79aed602a89b17b2012d206af863d039bf8e0b"
12
+ sha256 "d29276ab1c51ac3195fd10fb9578c86851bfc2f49a3a6cce6c2d1c3adb72e7aa"
13
13
  license "MIT"
14
14
 
15
15
  depends_on "node"
package/README.md CHANGED
@@ -19,14 +19,14 @@ First, you install [npm][npm-install] and [Java SE][java-se].
19
19
  Then, you install [eolang][npm] package, using [npm][npm-install]:
20
20
 
21
21
  ```bash
22
- npm install -g eolang@0.33.3
22
+ npm install -g eolang@0.34.0
23
23
  ```
24
24
 
25
25
  You can also use [Homebrew] (on macOS):
26
26
 
27
27
  ```bash
28
28
  brew tap objectionary/eoc https://github.com/objectionary/eoc
29
- brew install objectionary/eoc/eolang@0.33.3
29
+ brew install objectionary/eoc/eolang@0.34.0
30
30
  ```
31
31
 
32
32
  Or install it via [Nix flakes](https://nixos.wiki/wiki/Flakes):
@@ -35,7 +35,9 @@ Or install it via [Nix flakes](https://nixos.wiki/wiki/Flakes):
35
35
  nix run github:objectionary/eoc
36
36
  ```
37
37
 
38
- You can also include EOLANG in your own flake:
38
+ <details>
39
+
40
+ <summary>You can also include EOLANG in your own flake</summary>
39
41
 
40
42
  ```nix
41
43
  {
@@ -87,6 +89,8 @@ After that, select one of the methods for installing the package:
87
89
  }
88
90
  ```
89
91
 
92
+ </details>
93
+
90
94
  Then, you write a simple [EO](https://www.eolang.org) program in `hello.eo` file
91
95
  in the current directory:
92
96
 
@@ -147,6 +151,11 @@ There are also commands that help manipulate with XMIR and EO sources
147
151
  This command line toolkit simply integrates other tools available in
148
152
  the [@objectionary](https://github.com/objectionary) GitHub organization.
149
153
 
154
+ ## Linting
155
+
156
+ There are two ways to work with linting. The `--easy` option enables linting
157
+ but ignores warnings, while the `--blind` option completely disables linting.
158
+
150
159
  ## How to Test
151
160
 
152
161
  To execute the project tests, use the following command:
package/eslint.config.js CHANGED
@@ -14,7 +14,7 @@ const localPlugin = {
14
14
 
15
15
  module.exports = [
16
16
  {
17
- ignores: ['node_modules/'],
17
+ ignores: ['node_modules/', '.aidy/'],
18
18
  },
19
19
  {
20
20
  ...configs.all,
@@ -79,7 +79,7 @@
79
79
  </plugin>
80
80
  <plugin>
81
81
  <artifactId>maven-surefire-plugin</artifactId>
82
- <version>3.5.4</version>
82
+ <version>3.5.5</version>
83
83
  <configuration>
84
84
  <skipTests>true</skipTests>
85
85
  </configuration>
@@ -124,7 +124,7 @@
124
124
  </plugin>
125
125
  <plugin>
126
126
  <artifactId>maven-surefire-plugin</artifactId>
127
- <version>3.5.4</version>
127
+ <version>3.5.5</version>
128
128
  <configuration>
129
129
  <skipTests>false</skipTests>
130
130
  <failIfNoTests>true</failIfNoTests>
@@ -162,7 +162,7 @@
162
162
  <dependency>
163
163
  <groupId>org.junit.jupiter</groupId>
164
164
  <artifactId>junit-jupiter-api</artifactId>
165
- <version>6.0.2</version>
165
+ <version>6.0.3</version>
166
166
  <scope>test</scope>
167
167
  <exclusions>
168
168
  <exclusion>
@@ -186,7 +186,7 @@
186
186
  <dependency>
187
187
  <groupId>org.junit.jupiter</groupId>
188
188
  <artifactId>junit-jupiter-engine</artifactId>
189
- <version>6.0.2</version>
189
+ <version>6.0.3</version>
190
190
  <scope>test</scope>
191
191
  <exclusions>
192
192
  <exclusion>
@@ -210,7 +210,7 @@
210
210
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
211
211
  <heap-size>undefined</heap-size>
212
212
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
213
- <junit.version>6.0.2</junit.version>
213
+ <junit.version>6.0.3</junit.version>
214
214
  <jeo.version>0.15.0</jeo.version>
215
215
  </properties>
216
216
  </project>
package/mvnw/pom.xml CHANGED
@@ -16,7 +16,7 @@
16
16
  <eo.version>undefined</eo.version>
17
17
  <heap-size>undefined</heap-size>
18
18
  <stack-size>undefined</stack-size>
19
- <junit.version>6.0.2</junit.version>
19
+ <junit.version>6.0.3</junit.version>
20
20
  </properties>
21
21
  <dependencies>
22
22
  <dependency>
@@ -100,7 +100,7 @@
100
100
  </plugin>
101
101
  <plugin>
102
102
  <artifactId>maven-surefire-plugin</artifactId>
103
- <version>3.5.4</version>
103
+ <version>3.5.5</version>
104
104
  <configuration>
105
105
  <skipTests>true</skipTests>
106
106
  </configuration>
@@ -164,7 +164,7 @@
164
164
  </plugin>
165
165
  <plugin>
166
166
  <artifactId>maven-surefire-plugin</artifactId>
167
- <version>3.5.4</version>
167
+ <version>3.5.5</version>
168
168
  <configuration>
169
169
  <skipTests>false</skipTests>
170
170
  <failIfNoTests>true</failIfNoTests>
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "grunt-mocha-cli": "^7.0.0",
29
29
  "istanbul": "^0.4.5",
30
30
  "mocha": "^11.7.5",
31
- "nyc": "^17.1.0",
31
+ "nyc": "^18.0.0",
32
32
  "patch-package": "^8.0.0"
33
33
  },
34
34
  "engines": {
@@ -72,7 +72,7 @@
72
72
  "scripts": {
73
73
  "coverage": "nyc --reporter=lcov --reporter=text-summary mocha test/**/*.js --timeout 1200000",
74
74
  "postinstall": "node scripts/postinstall.js",
75
- "test": "mocha test/**/*.js --timeout 1200000"
75
+ "test": "mocha 'test/**/*.js' --timeout 1200000"
76
76
  },
77
- "version": "0.33.5"
77
+ "version": "0.34.1"
78
78
  }
@@ -16,8 +16,18 @@ const {elapsed} = require('../elapsed');
16
16
  module.exports = function(opts) {
17
17
  const target = path.resolve(opts.target);
18
18
  return elapsed(async (tracked) => {
19
- const r = await mvnw(['eo:assemble'].concat(flags(opts)), opts.target, opts.batch);
19
+ const r = await mvnw(goals().concat(flags(opts)), opts.target, opts.batch);
20
20
  tracked.print(`EO program assembled in ${rel(target)}`);
21
21
  return r;
22
22
  });
23
23
  };
24
+
25
+ /**
26
+ * Command to get Maven goals for assemble command.
27
+ * @return {Array.<String>} of Maven goals to run for assemble command
28
+ */
29
+ module.exports.goals = goals;
30
+
31
+ function goals() {
32
+ return ['eo:assemble'];
33
+ }
@@ -2,7 +2,6 @@
2
2
  * SPDX-FileCopyrightText: Copyright (c) 2022-2026 Objectionary.com
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
-
6
5
  const rel = require('relative');
7
6
  const {mvnw, flags} = require('../../mvnw');
8
7
  const {elapsed} = require('../../elapsed');
@@ -16,8 +15,18 @@ const path = require('path');
16
15
  module.exports = function(opts) {
17
16
  const target = path.resolve(opts.target);
18
17
  return elapsed(async (tracked) => {
19
- const r = await mvnw(['test-compile'].concat(flags(opts)), opts.target, opts.batch);
18
+ const r = await mvnw(goals().concat(flags(opts)), opts.target, opts.batch);
20
19
  tracked.print(`Java .class files compiled in ${rel(target)}`);
21
20
  return r;
22
21
  });
23
22
  };
23
+
24
+ /**
25
+ * Method to get Maven goals for compile command.
26
+ * @return {Array.<String>} of Maven goals to run for compile command
27
+ */
28
+ module.exports.goals = goals;
29
+
30
+ function goals() {
31
+ return ['test-compile'];
32
+ }
@@ -16,8 +16,18 @@ const path = require('path');
16
16
  module.exports = function(opts) {
17
17
  const jar = path.resolve(opts.target, 'eoc.jar');
18
18
  return elapsed(async (tracked) => {
19
- const r = await mvnw(['jar:jar', 'shade:shade'].concat(flags(opts)), opts.target, opts.batch);
19
+ const r = await mvnw(goals().concat(flags(opts)), opts.target, opts.batch);
20
20
  tracked.print(`Executable JAR created at ${rel(jar)}`);
21
21
  return r;
22
22
  });
23
23
  };
24
+
25
+ /**
26
+ * Command to get Maven goals for link command.
27
+ * @return {Array.<String>} of Maven goals to run for link command
28
+ */
29
+ module.exports.goals = goals;
30
+
31
+ function goals() {
32
+ return ['jar:jar', 'shade:shade'];
33
+ }
@@ -0,0 +1,36 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2026 Objectionary.com
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ const {mvnw, flags} = require('../../mvnw');
7
+ const {elapsed} = require('../../elapsed');
8
+
9
+ /**
10
+ * Runs multiple Maven goals in a single Maven invocation.
11
+ * @param {Object} coms - Command map to resolve goals and extra flags from
12
+ * @param {Array.<String>} commands - Command names to run in order
13
+ * @param {Object} opts - All options
14
+ * @return {Promise} of pipeline task
15
+ */
16
+ module.exports = function(coms, commands, opts, maven = mvnw) {
17
+ return elapsed(async (tracked) => {
18
+ const {goals, extras} = collect(coms, commands, opts);
19
+ const result = await maven(goals.concat(flags(opts)).concat(extras), opts.target, opts.batch);
20
+ tracked.print(`Pipeline [${commands.join(' \u2192 ')}] done`);
21
+ return result;
22
+ });
23
+ };
24
+
25
+ function collect(coms, commands, opts) {
26
+ const extras = [];
27
+ const goals = commands.flatMap((cmd) => {
28
+ const command = coms[cmd];
29
+ if (command.extras) {
30
+ extras.push(...command.extras(opts));
31
+ }
32
+ return command.goals(opts) || [];
33
+ });
34
+ return {goals, extras};
35
+ };
36
+
@@ -15,12 +15,19 @@ const path = require('path');
15
15
  */
16
16
  module.exports = function(opts) {
17
17
  return elapsed(async (tracked) => {
18
- await mvnw(['eo:resolve'].concat(flags(opts)), opts.target, opts.batch);
19
- const sources = path.resolve(opts.target, 'eo/6-resolve');
20
- console.info('Dependencies resolved in %s', rel(sources));
21
- const r = await mvnw(['eo:place'].concat(flags(opts)), opts.target, opts.batch);
18
+ const r = await mvnw(goals().concat(flags(opts)), opts.target, opts.batch);
22
19
  const classes = path.resolve(opts.target, 'classes');
23
20
  tracked.print(`Dependencies placed in ${rel(classes)}`);
24
21
  return r;
25
22
  });
26
23
  };
24
+
25
+ /**
26
+ * Command to get Maven goals for resolve command.
27
+ * @return {Array.<String>} of Maven goals to run for resolve command
28
+ */
29
+ module.exports.goals = goals;
30
+
31
+ function goals() {
32
+ return ['eo:resolve', 'eo:place'];
33
+ }
@@ -16,8 +16,18 @@ const path = require('path');
16
16
  module.exports = function(opts) {
17
17
  const sources = path.resolve(opts.target, 'generated-sources');
18
18
  return elapsed(async (tracked) => {
19
- const r = await mvnw(['eo:transpile'].concat(flags(opts)), opts.target, opts.batch);
19
+ const r = await mvnw(goals().concat(flags(opts)), opts.target, opts.batch);
20
20
  tracked.print(`Java sources generated in ${rel(sources)}`);
21
21
  return r;
22
22
  });
23
23
  };
24
+
25
+ /**
26
+ * Command to get Maven goals for transpile command.
27
+ * @return {Array.<String>} of Maven goals to run for transpile command
28
+ */
29
+ module.exports.goals = goals;
30
+
31
+ function goals() {
32
+ return ['eo:transpile'];
33
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2026 Objectionary.com
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ const {elapsed} = require('../../elapsed');
7
+
8
+ /**
9
+ * Runs multiple JS pipeline steps sequentially.
10
+ * @param {Object} coms - Command map to resolve step functions from
11
+ * @param {Array.<String>} commands - Command names to run in order
12
+ * @param {Object} opts - All options
13
+ * @return {Promise} of pipeline task
14
+ */
15
+ module.exports = function(coms, commands, opts) {
16
+ return elapsed(async (tracked) => {
17
+ for (const cmd of commands) {
18
+ // eslint-disable-next-line no-await-in-loop
19
+ await coms[cmd](opts);
20
+ }
21
+ tracked.print(`Pipeline [${commands.join(' \u2192 ')}] done`);
22
+ });
23
+ };
@@ -15,7 +15,7 @@ const path = require('path');
15
15
  */
16
16
  module.exports = function(opts) {
17
17
  return elapsed(async (tracked) => {
18
- const r = await eo2jsw('transpile', { ...opts, alone: true, project: 'project' });
18
+ const r = await eo2jsw('transpile', {...opts, alone: true, project: 'project'});
19
19
  tracked.print(`JS sources generated in ${rel(path.resolve(opts.target, 'project'))}`);
20
20
  return r;
21
21
  });
@@ -15,15 +15,12 @@ const semver = require('semver');
15
15
  * @return {Promise} of assemble task
16
16
  */
17
17
  module.exports = function(opts) {
18
- const extra = [
19
- `-Deo.failOnWarning=${opts.easy ? 'false' : 'true'}`,
20
- `-Deo.skipLinting=${opts.blind ? 'true' : 'false'}`,
21
- ];
18
+ const extra = extraFlags(opts);
22
19
  return elapsed(async (tracked) => {
23
- if (opts.parser.endsWith('-SNAPSHOT') || semver.gte(opts.parser, '0.45.0')) {
20
+ if (goals(opts)[0] === 'eo:lint') {
24
21
  try {
25
22
  const r = await mvnw(
26
- ['eo:lint'].concat(flags(opts)).concat(extra),
23
+ goals(opts).concat(flags(opts)).concat(extra),
27
24
  opts.target, opts.batch
28
25
  );
29
26
  tracked.print(`EO program linted in ${rel(path.resolve(opts.target))}`);
@@ -31,13 +28,13 @@ module.exports = function(opts) {
31
28
  } catch (error) {
32
29
  throw new Error(
33
30
  'There are errors and/or warnings; you may disable warnings via the --easy option',
34
- { cause: error }
31
+ {cause: error}
35
32
  );
36
33
  }
37
34
  }
38
35
  try {
39
36
  const r = await mvnw(
40
- ['eo:verify'].concat(flags(opts)).concat(extra),
37
+ goals(opts).concat(flags(opts)).concat(extra),
41
38
  opts.target, opts.batch
42
39
  );
43
40
  tracked.print(`EO program verified in ${rel(path.resolve(opts.target))}`);
@@ -45,8 +42,31 @@ module.exports = function(opts) {
45
42
  } catch (error) {
46
43
  throw new Error(
47
44
  'You may disable warnings via the --easy option',
48
- { cause: error }
45
+ {cause: error}
49
46
  );
50
47
  }
51
48
  });
52
49
  };
50
+
51
+ /**
52
+ * Command to get Maven goals for lint command.
53
+ * @return {Array.<String>} of Maven goals to run for lint command
54
+ */
55
+ module.exports.goals = goals;
56
+
57
+ /**
58
+ * Command to get extra Maven flags for lint command.
59
+ * @return {Array.<String>} of extra Maven flags to run for lint command
60
+ */
61
+ module.exports.extras = extras;
62
+
63
+ function goals(opts) {
64
+ if (opts.parser.endsWith('-SNAPSHOT') || semver.gte(opts.parser, '0.45.0')) {
65
+ return ['eo:lint'];
66
+ }
67
+ return ['eo:verify'];
68
+ }
69
+
70
+ function extras(opts) {
71
+ return [`-Deo.failOnWarning=${opts.easy ? 'false' : 'true'}`];
72
+ }
@@ -16,8 +16,19 @@ const {elapsed} = require('../elapsed');
16
16
  module.exports = function(opts) {
17
17
  const target = path.resolve(opts.target);
18
18
  return elapsed(async (tracked) => {
19
- const r = await mvnw(['eo:parse'].concat(flags(opts)), opts.target, opts.batch);
19
+ const r = await mvnw(goals().concat(flags(opts)), opts.target, opts.batch);
20
20
  tracked.print(`EO sources parsed in ${rel(target)}`);
21
21
  return r;
22
22
  });
23
23
  };
24
+
25
+ /**
26
+ * Command to get Maven goals for parse command.
27
+ * @return {Array.<String>} of Maven goals to run for parse command
28
+ */
29
+ module.exports.goals = goals;
30
+
31
+ function goals() {
32
+ return ['eo:parse'];
33
+ }
34
+
@@ -16,8 +16,19 @@ const path = require('path');
16
16
  module.exports = function(opts) {
17
17
  const foreign = path.resolve(opts.target, 'eo-foreign.json');
18
18
  return elapsed(async (tracked) => {
19
- const r = await mvnw(['eo:register'].concat(flags(opts)), opts.target, opts.batch);
19
+ const r = await mvnw(goals().concat(flags(opts)), opts.target, opts.batch);
20
20
  tracked.print(`EO objects registered in ${rel(foreign)}`);
21
21
  return r;
22
22
  });
23
23
  };
24
+
25
+ /**
26
+ * Command to get Maven goals for register command.
27
+ * @return {Array.<String>} of Maven goals to run for register command
28
+ */
29
+ module.exports.goals = goals;
30
+
31
+ function goals() {
32
+ return ['eo:register'];
33
+ }
34
+
package/src/eoc.js CHANGED
@@ -32,7 +32,7 @@ const {program} = require('commander'),
32
32
  generate_comments: require('./commands/generate_comments'),
33
33
  jeo_disassemble: require('./commands/jeo/disassemble'),
34
34
  jeo_assemble: require('./commands/jeo/assemble'),
35
- latex: require('./commands/latex')
35
+ latex: require('./commands/latex'),
36
36
  },
37
37
  commands = {
38
38
  [language.java]: {
@@ -43,7 +43,7 @@ const {program} = require('commander'),
43
43
  link: require('./commands/java/link'),
44
44
  compile: require('./commands/java/compile'),
45
45
  dataize: require('./commands/java/dataize'),
46
- test: require('./commands/java/test')
46
+ test: require('./commands/java/test'),
47
47
  }
48
48
  },
49
49
  [language.js]: {
@@ -54,9 +54,13 @@ const {program} = require('commander'),
54
54
  link: require('./commands/js/link'),
55
55
  compile: require('./commands/js/compile'),
56
56
  dataize: require('./commands/js/dataize'),
57
- test: require('./commands/js/test')
57
+ test: require('./commands/js/test'),
58
58
  }
59
59
  }
60
+ },
61
+ pipelines = {
62
+ [language.java]: require('./commands/java/pipeline'),
63
+ [language.js]: require('./commands/js/pipeline'),
60
64
  };
61
65
 
62
66
  if (process.argv.includes('--verbose')) {
@@ -94,7 +98,7 @@ program
94
98
  .option('-s, --sources <path>', 'Directory with .EO sources', '.')
95
99
  .option('-t, --target <path>', 'Directory with all generated files', '.eoc')
96
100
  .option('--easy', 'Ignore "warnings" and only fail if there are "errors" or "critical" errors')
97
- .option('--blind', 'Ignore "warnings," "errors," and "critical" errors')
101
+ .option('--blind', 'Disable linting')
98
102
  .option('--home-tag <version>', 'Git tag in objectionary/home to compile against', tag)
99
103
  .option('--parser <version>', 'Set the version of EO parser to use', parser)
100
104
  .option('--latest', 'Use the latest parser version from Maven Central')
@@ -105,7 +109,9 @@ program
105
109
  .option('--track-transformation-steps', 'Save intermediate XMIR files')
106
110
  .option('-c, --clean', 'Delete .eoc directory before running a command')
107
111
  .option('--debug', 'Print ALL debug messages, heavily overloading the log')
108
- .option('--verbose', 'Print debug messages and full output of child processes');
112
+ .option('--verbose', 'Print debug messages and full output of child processes')
113
+ .option('--pin <version>', 'Fail if eoc version doesn\'t match exactly', version.what)
114
+ .option('--update-snapshots', 'Update snapshots in the local repository if they are outdated');
109
115
 
110
116
  program.command('audit')
111
117
  .description('Inspect all packages and report their status')
@@ -124,22 +130,24 @@ program
124
130
  .option('--global', 'delete ~/.eo directory')
125
131
  .description('Delete all temporary files')
126
132
  .action((str, opts) => {
133
+ pin(program.opts());
127
134
  coms().clean({...program.opts(), ...str});
128
135
  });
129
136
 
130
137
  program.command('register')
131
138
  .description('Register all visible EO source files')
132
139
  .action((str, opts) => {
140
+ pin(program.opts());
133
141
  coms().register(program.opts());
134
142
  });
135
143
 
136
144
  program.command('parse')
137
145
  .description('Parse EO files into XMIR')
138
146
  .action(async (str, opts) => {
147
+ pin(program.opts());
139
148
  clear(str);
140
149
  if (program.opts().alone === undefined) {
141
- await coms().register(program.opts());
142
- await coms().parse(program.opts());
150
+ await pipe()(coms(), ['register', 'parse'], program.opts());
143
151
  } else {
144
152
  await coms().parse(program.opts());
145
153
  }
@@ -148,10 +156,10 @@ program.command('parse')
148
156
  program.command('assemble')
149
157
  .description('Parse EO files into XMIR and join them with required dependencies')
150
158
  .action(async (str, opts) => {
159
+ pin(program.opts());
151
160
  clear(str);
152
161
  if (program.opts().alone === undefined) {
153
- await coms().register(program.opts());
154
- await coms().assemble(program.opts());
162
+ await pipe()(coms(), ['register', 'assemble'], program.opts());
155
163
  } else {
156
164
  await coms().assemble(program.opts());
157
165
  }
@@ -166,10 +174,10 @@ program.command('sodg')
166
174
  .option('--include <names>', 'Generate SODG for these object names (using mask)', '**')
167
175
  .option('--exclude <names>', 'Don\'t generate SODG for these objects')
168
176
  .action(async (str, opts) => {
177
+ pin(program.opts());
169
178
  clear(str);
170
179
  if (program.opts().alone === undefined) {
171
- await coms().register(program.opts());
172
- await coms().assemble(program.opts());
180
+ await pipe()(coms(), ['register', 'assemble'], program.opts());
173
181
  await coms().sodg({...program.opts(), ...str});
174
182
  } else {
175
183
  await coms().sodg({...program.opts(), ...str});
@@ -189,6 +197,7 @@ program.command('print')
189
197
  'print'
190
198
  )
191
199
  .action((str, opts) => {
200
+ pin(program.opts());
192
201
  clear(str);
193
202
  coms().print({...program.opts(), ...str});
194
203
  });
@@ -196,11 +205,10 @@ program.command('print')
196
205
  program.command('lint')
197
206
  .description('Lint XMIR files and fail if any issues inside')
198
207
  .action(async (str, opts) => {
208
+ pin(program.opts());
199
209
  clear(str);
200
210
  if (program.opts().alone === undefined) {
201
- await coms().register(program.opts());
202
- await coms().assemble(program.opts());
203
- await coms().lint(program.opts());
211
+ await pipe()(coms(), ['register', 'assemble', 'lint'], program.opts());
204
212
  } else {
205
213
  await coms().lint(program.opts());
206
214
  }
@@ -209,12 +217,10 @@ program.command('lint')
209
217
  program.command('resolve')
210
218
  .description('Resolve all the dependencies required for compilation')
211
219
  .action(async (str, opts) => {
220
+ pin(program.opts());
212
221
  clear(str);
213
222
  if (program.opts().alone === undefined) {
214
- await coms().register(program.opts());
215
- await coms().assemble(program.opts());
216
- await coms().lint(program.opts());
217
- await coms().resolve(program.opts());
223
+ await pipe()(coms(), ['register', 'assemble', 'lint', 'resolve'], program.opts());
218
224
  } else {
219
225
  await coms().resolve(program.opts());
220
226
  }
@@ -223,13 +229,10 @@ program.command('resolve')
223
229
  program.command('transpile')
224
230
  .description('Convert EO files into target language')
225
231
  .action(async (str, opts) => {
232
+ pin(program.opts());
226
233
  clear(str);
227
234
  if (program.opts().alone === undefined) {
228
- await coms().register(program.opts());
229
- await coms().assemble(program.opts());
230
- await coms().lint(program.opts());
231
- await coms().resolve(program.opts());
232
- await coms().transpile(program.opts());
235
+ await pipe()(coms(), ['register', 'assemble', 'lint', 'resolve', 'transpile'], program.opts());
233
236
  } else {
234
237
  await coms().transpile(program.opts());
235
238
  }
@@ -238,14 +241,10 @@ program.command('transpile')
238
241
  program.command('compile')
239
242
  .description('Compile target language sources into binaries')
240
243
  .action(async (str, opts) => {
244
+ pin(program.opts());
241
245
  clear(str);
242
246
  if (program.opts().alone === undefined) {
243
- await coms().register(program.opts());
244
- await coms().assemble(program.opts());
245
- await coms().lint(program.opts());
246
- await coms().resolve(program.opts());
247
- await coms().transpile(program.opts());
248
- await coms().compile(program.opts());
247
+ await pipe()(coms(), ['register', 'assemble', 'lint', 'resolve', 'transpile', 'compile'], program.opts());
249
248
  } else {
250
249
  await coms().compile(program.opts());
251
250
  }
@@ -256,13 +255,7 @@ program.command('link')
256
255
  .action(async (str, opts) => {
257
256
  clear(str);
258
257
  if (program.opts().alone === undefined) {
259
- await coms().register(program.opts());
260
- await coms().assemble(program.opts());
261
- await coms().lint(program.opts());
262
- await coms().resolve(program.opts());
263
- await coms().transpile(program.opts());
264
- await coms().compile(program.opts());
265
- await coms().link(program.opts());
258
+ await pipe()(coms(), ['register', 'assemble', 'lint', 'resolve', 'transpile', 'compile', 'link'], program.opts());
266
259
  } else {
267
260
  await coms().link(program.opts());
268
261
  }
@@ -273,15 +266,10 @@ program.command('dataize')
273
266
  .option('--stack <size>', 'Set stack size for the virtual machine', '64M')
274
267
  .option('--heap <size>', 'Set the heap size for the VM', '256M')
275
268
  .action(async (str, opts) => {
269
+ pin(program.opts());
276
270
  clear(str);
277
271
  if (program.opts().alone === undefined) {
278
- await coms().register(program.opts());
279
- await coms().assemble(program.opts());
280
- await coms().lint(program.opts());
281
- await coms().resolve(program.opts());
282
- await coms().transpile(program.opts());
283
- await coms().compile(program.opts());
284
- await coms().link(program.opts());
272
+ await pipe()(coms(), ['register', 'assemble', 'lint', 'resolve', 'transpile', 'compile', 'link'], program.opts());
285
273
  await coms().dataize(
286
274
  program.args[1], program.args.slice(2), {...program.opts(), ...str}
287
275
  );
@@ -297,15 +285,10 @@ program.command('test')
297
285
  .option('--stack <size>', 'Set stack size for the virtual machine', '64M')
298
286
  .option('--heap <size>', 'Set the heap size for the VM', '256M')
299
287
  .action(async (str, opts) => {
288
+ pin(program.opts());
300
289
  clear(str);
301
290
  if (program.opts().alone === undefined) {
302
- await coms().register(program.opts());
303
- await coms().assemble(program.opts());
304
- await coms().lint(program.opts());
305
- await coms().resolve(program.opts());
306
- await coms().transpile(program.opts());
307
- await coms().compile(program.opts());
308
- await coms().link(program.opts());
291
+ await pipe()(coms(), ['register', 'assemble', 'lint', 'resolve', 'transpile', 'compile', 'link'], program.opts());
309
292
  await coms().test({...program.opts(), ...str});
310
293
  } else {
311
294
  await coms().test({...program.opts(), ...str});
@@ -315,6 +298,7 @@ program.command('test')
315
298
  program.command('docs')
316
299
  .description('Generate documentation from XMIR files')
317
300
  .action((str, opts) => {
301
+ pin(program.opts());
318
302
  coms().docs(program.opts());
319
303
  });
320
304
 
@@ -357,6 +341,7 @@ program.command('jeo:disassemble')
357
341
  'xmir'
358
342
  )
359
343
  .action((str, opts) => {
344
+ pin(program.opts());
360
345
  coms().jeo_disassemble({...program.opts(), ...str});
361
346
  });
362
347
 
@@ -380,18 +365,18 @@ program.command('jeo:assemble')
380
365
  program.command('latex')
381
366
  .description('Generate LaTeX files from EO sources')
382
367
  .action(async (str, opts) => {
368
+ pin(program.opts());
383
369
  clear(str);
384
- await coms().register(program.opts());
385
- await coms().parse(program.opts());
370
+ await pipe()(coms(), ['register', 'parse'], program.opts());
386
371
  await coms().latex(program.opts());
387
372
  });
388
373
 
389
374
  program.command('fmt')
390
375
  .description('Format EO files in the source directory')
391
376
  .action(async (str, opts) => {
377
+ pin(program.opts());
392
378
  clear(str);
393
- await coms().register(program.opts());
394
- await coms().parse(program.opts());
379
+ await pipe()(coms(), ['register', 'parse'], program.opts());
395
380
  await coms().print({
396
381
  printInput: '1-parse',
397
382
  printOutput: program.opts().sources,
@@ -417,6 +402,17 @@ function clear(str) {
417
402
  }
418
403
  }
419
404
 
405
+ /** Checks --pin option and fails if version mismatch.
406
+ * @param {*} opts Options
407
+ * @throws {Error} If version mismatch
408
+ */
409
+ function pin(opts) {
410
+ if (opts.pin && opts.pin !== version.what) {
411
+ console.error(`Version mismatch: you are running eoc ${version.what}, but --pin option requires ${opts.pin}`);
412
+ process.exit(1);
413
+ }
414
+ }
415
+
420
416
  /**
421
417
  * Get commands for the target language.
422
418
  * @return {Object} - commands
@@ -429,3 +425,16 @@ function coms() {
429
425
  }
430
426
  return hash;
431
427
  }
428
+
429
+ /**
430
+ * Get pipeline for the target language.
431
+ * @return {Function} - pipeline function
432
+ */
433
+ function pipe() {
434
+ const lang = program.opts().language;
435
+ const pipeline = pipelines[lang];
436
+ if (pipeline === undefined) {
437
+ throw new Error(`Unknown platform ${lang}`);
438
+ }
439
+ return pipeline;
440
+ }
package/src/mvnw.js CHANGED
@@ -7,7 +7,7 @@ const path = require('path');
7
7
  const fs = require('fs');
8
8
  const rel = require('relative');
9
9
  const readline = require('readline');
10
- const { spawn } = require('child_process');
10
+ const {spawn} = require('child_process');
11
11
  const colors = require('colors');
12
12
  const parserVersion = require('./parser-version');
13
13
 
@@ -31,7 +31,13 @@ let beginning,
31
31
  * @param {Object} opts - Opts provided to the "eoc"
32
32
  * @return {Array} of Maven options
33
33
  */
34
- module.exports.flags = function (opts) {
34
+ module.exports.flags = function(opts) {
35
+ if (opts.sources === undefined) {
36
+ throw new Error('Sources directory is not specified. Please provide it with --sources option.');
37
+ }
38
+ if (opts.target === undefined) {
39
+ throw new Error('Target directory is not specified. Please provide it with --target option.');
40
+ }
35
41
  const sources = path.resolve(opts.sources);
36
42
  console.debug('Sources in %s', rel(sources));
37
43
  const target = path.resolve(opts.target);
@@ -50,14 +56,16 @@ module.exports.flags = function (opts) {
50
56
  opts.verbose ? '--errors' : '',
51
57
  opts.verbose ? '' : '--quiet',
52
58
  opts.debug ? '--debug' : '',
59
+ opts.updateSnapshots ? '--update-snapshots' : '',
53
60
  `-Deo.sourcesDir=${sources}`,
54
61
  `-Deo.targetDir=${target}`,
55
62
  `-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
56
63
  `-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
57
64
  `-Deo.placed=${path.resolve(opts.target, 'eo-placed.csv')}`,
58
65
  `-Deo.placedFormat=csv`,
66
+ `-Deo.skipLinting=${opts.blind ? 'true' : 'false'}`,
59
67
  opts.trackTransformationSteps ? '-Deo.trackTransformationSteps' : '',
60
- ];
68
+ ].filter(flag => flag !== '');
61
69
  };
62
70
 
63
71
  /**
@@ -67,10 +75,11 @@ module.exports.flags = function (opts) {
67
75
  * @param {Boolean} [batch] - Is it batch mode (TRUE) or interactive (FALSE)?
68
76
  * @return {Promise} of maven execution task
69
77
  */
70
- module.exports.mvnw = function (args, tgt, batch) {
78
+ module.exports.mvnw = function(args, tgt, batch) {
71
79
  return new Promise((resolve, reject) => {
80
+ console.debug(`Running mvnw with arguments: ${args.join(' ')}`);
72
81
  target = tgt;
73
- phase = args[0];
82
+ phase = args.filter((a) => !a.startsWith('-')).join(' + ');
74
83
  const home = path.resolve(__dirname, '../mvnw');
75
84
  let bin = path.resolve(home, 'mvnw') + (process.platform === 'win32' ? '.cmd' : '');
76
85
  if (!fs.existsSync(bin)) {
@@ -80,7 +89,6 @@ module.exports.mvnw = function (args, tgt, batch) {
80
89
  const params = args.filter((t) => t !== '').concat([
81
90
  '--batch-mode',
82
91
  '--color=never',
83
- '--update-snapshots',
84
92
  '--fail-fast',
85
93
  '--strict-checksums',
86
94
  ]);
@@ -127,7 +135,7 @@ module.exports.mvnw = function (args, tgt, batch) {
127
135
  function start() {
128
136
  running = true;
129
137
  beginning = Date.now();
130
- const check = function () {
138
+ const check = function() {
131
139
  if (running) {
132
140
  print();
133
141
  setTimeout(check, 1000);
package/src/version.js CHANGED
@@ -6,6 +6,6 @@
6
6
  // The values here are replaced automatically by the .rultor.yml script,
7
7
  // at the "release" pipeline:
8
8
  module.exports = {
9
- what: '0.33.5',
10
- when: '2026-02-15'
9
+ what: '0.34.1',
10
+ when: '2026-02-26'
11
11
  };