eolang 0.27.1 → 0.28.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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ First, you install [npm][npm-install] and [Java SE][java-se].
18
18
  Then, you install [eolang][npm] package:
19
19
 
20
20
  ```bash
21
- npm install -g eolang@0.26.0
21
+ npm install -g eolang@0.28.0
22
22
  ```
23
23
 
24
24
  Then, you write a simple [EO](https://www.eolang.org) program in `hello.eo` file
@@ -34,7 +34,7 @@ in the current directory:
34
34
  Then, you run it:
35
35
 
36
36
  ```bash
37
- eoc dataize hello
37
+ eoc --easy dataize hello
38
38
  ```
39
39
 
40
40
  That's it.
package/eo-version.txt CHANGED
@@ -1 +1 @@
1
- 0.48.2
1
+ 0.49.2
package/eodocs.html ADDED
File without changes
package/home-tag.txt CHANGED
@@ -1 +1 @@
1
- 0.48.2
1
+ 0.49.2
@@ -0,0 +1,105 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+ <groupId>org.eolang</groupId>
5
+ <artifactId>eoc</artifactId>
6
+ <version>0.0.0</version>
7
+ <build>
8
+ <sourceDirectory>${eo.generatedDir}</sourceDirectory>
9
+ <outputDirectory>${eo.targetDir}/classes</outputDirectory>
10
+ <testOutputDirectory>${eo.targetDir}/classes</testOutputDirectory>
11
+ <directory>${eo.targetDir}</directory>
12
+ <finalName>eoc</finalName>
13
+ <plugins>
14
+ <plugin>
15
+ <artifactId>maven-enforcer-plugin</artifactId>
16
+ <version>3.5.0</version>
17
+ <executions>
18
+ <execution>
19
+ <goals>
20
+ <goal>enforce</goal>
21
+ </goals>
22
+ <configuration>
23
+ <rules>
24
+ <requireJavaVersion>
25
+ <version>[11,)</version>
26
+ </requireJavaVersion>
27
+ </rules>
28
+ </configuration>
29
+ </execution>
30
+ </executions>
31
+ </plugin>
32
+ <plugin>
33
+ <groupId>org.eolang</groupId>
34
+ <artifactId>eo-maven-plugin</artifactId>
35
+ <version>${eo.version}</version>
36
+ <configuration>
37
+ <withRuntimeDependency>false</withRuntimeDependency>
38
+ <excludeSources>**/.eoc/**</excludeSources>
39
+ <sodgIncludes>${eo.sodgIncludes}</sodgIncludes>
40
+ <sodgExcludes>${eo.sodgExcludes}</sodgExcludes>
41
+ <foreign>${project.build.directory}/eo-foreign.json</foreign>
42
+ <foreignFormat>json</foreignFormat>
43
+ </configuration>
44
+ </plugin>
45
+ <plugin>
46
+ <groupId>org.eolang</groupId>
47
+ <artifactId>jeo-maven-plugin</artifactId>
48
+ <version>${jeo.version}</version>
49
+ <configuration>
50
+ <skipVerification>true</skipVerification>
51
+ </configuration>
52
+ </plugin>
53
+ <plugin>
54
+ <artifactId>maven-compiler-plugin</artifactId>
55
+ <version>3.8.1</version>
56
+ <configuration>
57
+ <release>11</release>
58
+ <source>11</source>
59
+ <target>11</target>
60
+ </configuration>
61
+ </plugin>
62
+ <plugin>
63
+ <artifactId>maven-jar-plugin</artifactId>
64
+ <version>3.4.2</version>
65
+ <configuration>
66
+ <archive>
67
+ <manifest>
68
+ <addClasspath>true</addClasspath>
69
+ <mainClass>org.eolang.Main</mainClass>
70
+ </manifest>
71
+ </archive>
72
+ </configuration>
73
+ </plugin>
74
+ <plugin>
75
+ <artifactId>maven-shade-plugin</artifactId>
76
+ <version>3.6.0</version>
77
+ </plugin>
78
+ <plugin>
79
+ <artifactId>maven-surefire-plugin</artifactId>
80
+ <version>3.5.2</version>
81
+ <configuration>
82
+ <failIfNoTests>true</failIfNoTests>
83
+ <useFile>false</useFile>
84
+ <trimStackTrace>false</trimStackTrace>
85
+ <runOrder>random</runOrder>
86
+ <argLine>-Xmx${heap-size} -Xss${stack-size}</argLine>
87
+ <forkNode />
88
+ <properties>
89
+ <configurationParameters>junit.jupiter.execution.parallel.enabled = true
90
+ junit.jupiter.execution.parallel.mode.default = concurrent
91
+ junit.jupiter.execution.parallel.mode.classes.default = concurrent</configurationParameters>
92
+ </properties>
93
+ </configuration>
94
+ </plugin>
95
+ </plugins>
96
+ </build>
97
+ <properties>
98
+ <eo.version>undefined</eo.version>
99
+ <stack-size>undefined</stack-size>
100
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
101
+ <heap-size>undefined</heap-size>
102
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
103
+ <jeo.version>0.6.26</jeo.version>
104
+ </properties>
105
+ </project>
package/mvnw/pom.xml CHANGED
@@ -25,11 +25,14 @@ SOFTWARE.
25
25
  <groupId>org.eolang</groupId>
26
26
  <artifactId>eoc</artifactId>
27
27
  <version>0.0.0</version>
28
+ <packaging>jar</packaging>
28
29
  <properties>
30
+ <jeo.version>0.6.26</jeo.version>
29
31
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
30
32
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
31
33
  <eo.version>undefined</eo.version>
32
- <jeo.version>0.6.22</jeo.version>
34
+ <heap-size>undefined</heap-size>
35
+ <stack-size>undefined</stack-size>
33
36
  </properties>
34
37
  <dependencies>
35
38
  <dependency>
@@ -40,12 +43,14 @@ SOFTWARE.
40
43
  <dependency>
41
44
  <groupId>org.junit.jupiter</groupId>
42
45
  <artifactId>junit-jupiter-api</artifactId>
43
- <version>5.11.3</version>
46
+ <version>5.11.4</version>
47
+ <scope>compile</scope>
44
48
  </dependency>
45
49
  <dependency>
46
50
  <groupId>org.junit.jupiter</groupId>
47
51
  <artifactId>junit-jupiter-engine</artifactId>
48
- <version>5.11.3</version>
52
+ <version>5.11.4</version>
53
+ <scope>compile</scope>
49
54
  </dependency>
50
55
  </dependencies>
51
56
  <build>
@@ -55,12 +60,31 @@ SOFTWARE.
55
60
  <outputDirectory>${eo.targetDir}/classes</outputDirectory>
56
61
  <testOutputDirectory>${eo.targetDir}/classes</testOutputDirectory>
57
62
  <plugins>
63
+ <plugin>
64
+ <artifactId>maven-enforcer-plugin</artifactId>
65
+ <version>3.5.0</version>
66
+ <executions>
67
+ <execution>
68
+ <goals>
69
+ <goal>enforce</goal>
70
+ </goals>
71
+ <configuration>
72
+ <rules>
73
+ <requireJavaVersion>
74
+ <version>[11,)</version>
75
+ </requireJavaVersion>
76
+ </rules>
77
+ </configuration>
78
+ </execution>
79
+ </executions>
80
+ </plugin>
58
81
  <plugin>
59
82
  <groupId>org.eolang</groupId>
60
83
  <artifactId>eo-maven-plugin</artifactId>
61
84
  <version>${eo.version}</version>
62
85
  <configuration>
63
- <excludeSources>.eoc/**</excludeSources>
86
+ <withRuntimeDependency>false</withRuntimeDependency>
87
+ <excludeSources>**/.eoc/**</excludeSources>
64
88
  <sodgIncludes>${eo.sodgIncludes}</sodgIncludes>
65
89
  <sodgExcludes>${eo.sodgExcludes}</sodgExcludes>
66
90
  <foreign>${project.build.directory}/eo-foreign.json</foreign>
@@ -79,8 +103,9 @@ SOFTWARE.
79
103
  <artifactId>maven-compiler-plugin</artifactId>
80
104
  <version>3.8.1</version>
81
105
  <configuration>
82
- <source>1.8</source>
83
- <target>1.8</target>
106
+ <release>11</release>
107
+ <source>11</source>
108
+ <target>11</target>
84
109
  </configuration>
85
110
  </plugin>
86
111
  <plugin>
@@ -89,11 +114,16 @@ SOFTWARE.
89
114
  <configuration>
90
115
  <archive>
91
116
  <manifest>
117
+ <addClasspath>true</addClasspath>
92
118
  <mainClass>org.eolang.Main</mainClass>
93
119
  </manifest>
94
120
  </archive>
95
121
  </configuration>
96
122
  </plugin>
123
+ <plugin>
124
+ <artifactId>maven-shade-plugin</artifactId>
125
+ <version>3.6.0</version>
126
+ </plugin>
97
127
  <plugin>
98
128
  <artifactId>maven-surefire-plugin</artifactId>
99
129
  <version>3.5.2</version>
@@ -101,6 +131,16 @@ SOFTWARE.
101
131
  <failIfNoTests>true</failIfNoTests>
102
132
  <useFile>false</useFile>
103
133
  <trimStackTrace>false</trimStackTrace>
134
+ <runOrder>random</runOrder>
135
+ <argLine>-Xmx${heap-size} -Xss${stack-size}</argLine>
136
+ <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
137
+ <properties>
138
+ <configurationParameters>
139
+ junit.jupiter.execution.parallel.enabled = true
140
+ junit.jupiter.execution.parallel.mode.default = concurrent
141
+ junit.jupiter.execution.parallel.mode.classes.default = concurrent
142
+ </configurationParameters>
143
+ </properties>
104
144
  </configuration>
105
145
  </plugin>
106
146
  </plugins>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eolang",
3
- "version": "0.27.1",
3
+ "version": "0.28.1",
4
4
  "author": "Yegor Bugayenko <yegor256@gmail.com> (https://www.yegor256.com/)",
5
5
  "license": "MIT",
6
6
  "repository": "objectionary/eoc",
@@ -32,9 +32,9 @@
32
32
  "dependencies": {
33
33
  "colors": "1.4.0",
34
34
  "commander": "12.1.0",
35
- "eo2js": "0.0.7",
36
- "fast-xml-parser": "4.5.0",
37
- "node": "23.4.0",
35
+ "eo2js": "0.0.8",
36
+ "fast-xml-parser": "4.5.1",
37
+ "node": "23.5.0",
38
38
  "relative": "3.0.2",
39
39
  "semver": "7.6.3",
40
40
  "sync-request": "6.1.0",
@@ -25,6 +25,7 @@
25
25
  const rel = require('relative');
26
26
  const path = require('path');
27
27
  const {mvnw, flags} = require('../mvnw');
28
+ const {elapsed} = require('../elapsed');
28
29
 
29
30
  /**
30
31
  * Command to assemble .XMIR files.
@@ -33,8 +34,10 @@ const {mvnw, flags} = require('../mvnw');
33
34
  */
34
35
  module.exports = function(opts) {
35
36
  const target = path.resolve(opts.target);
36
- return mvnw(['eo:assemble'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
37
- console.info('EO program assembled in %s', rel(target));
38
- return r;
37
+ return elapsed((tracked) => {
38
+ return mvnw(['eo:assemble'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
39
+ tracked.print('EO program assembled in %s', rel(target));
40
+ return r;
41
+ });
39
42
  });
40
43
  };
@@ -22,10 +22,14 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ const fs = require('fs');
26
+ const path = require('path');
27
+
25
28
  /**
26
29
  * Command to create docs from .EO sources.
27
30
  * @param {Hash} opts - All options
28
31
  */
29
32
  module.exports = function(opts) {
30
- console.info('This command is not yet implemented, sorry');
33
+ const filePath = path.resolve('eodocs.html');
34
+ fs.writeFileSync(filePath, '');
31
35
  };
@@ -33,6 +33,10 @@ const path = require('path');
33
33
  */
34
34
  module.exports = function(opts) {
35
35
  const target = path.resolve(opts.target);
36
+ /**
37
+ * @todo #368:30min Wrap logs in 'elapsed'
38
+ * It is necessary to use 'elapsed' in all logging cases that require output of elapsed time
39
+ */
36
40
  return mvnw(['compiler:compile'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
37
41
  console.info('Java .class files compiled into %s', rel(target));
38
42
  return r;
@@ -33,7 +33,7 @@ const path = require('path');
33
33
  */
34
34
  module.exports = function(opts) {
35
35
  const jar = path.resolve(opts.target, 'eoc.jar');
36
- return mvnw(['jar:jar'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
36
+ return mvnw(['jar:jar', 'shade:shade'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
37
37
  console.info('Executable JAR created at %s', rel(jar));
38
38
  return r;
39
39
  });
@@ -30,5 +30,11 @@ const {mvnw, flags} = require('../../mvnw');
30
30
  * @return {Promise} of compile task
31
31
  */
32
32
  module.exports = function(opts) {
33
- return mvnw(['surefire:test'].concat(flags(opts)));
33
+ return mvnw(
34
+ [
35
+ 'surefire:test',
36
+ `-Dstack-size=${opts.stack}`,
37
+ `-Dheap-size=${opts.heap}`,
38
+ ].concat(flags(opts))
39
+ );
34
40
  };
@@ -43,6 +43,10 @@ module.exports = function(opts) {
43
43
  ).then((r) => {
44
44
  console.info('EO program linted in %s', rel(path.resolve(opts.target)));
45
45
  return r;
46
+ }).catch((error) => {
47
+ throw new Error(
48
+ 'There are error and/or warnings; you may disable warnings via the --easy option'
49
+ );
46
50
  });
47
51
  } else {
48
52
  return mvnw(
@@ -51,6 +55,8 @@ module.exports = function(opts) {
51
55
  ).then((r) => {
52
56
  console.info('EO program verified in %s', rel(path.resolve(opts.target)));
53
57
  return r;
58
+ }).catch((error) => {
59
+ throw new Error('You may disable warnings via the --easy option');
54
60
  });
55
61
  }
56
62
  };
package/src/demand.js CHANGED
@@ -32,6 +32,9 @@ const semver = require('semver');
32
32
  * @param {String} min - Minimal expected version
33
33
  */
34
34
  module.exports.gte = function(subject, current, min) {
35
+ if (current.endsWith('-SNAPSHOT')) {
36
+ return;
37
+ }
35
38
  if (semver.lt(current, min)) {
36
39
  console.error(
37
40
  '%s is required to have version %s or higher, while you use %s',
package/src/elapsed.js ADDED
@@ -0,0 +1,60 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2022-2024 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
+ /**
26
+ * A utility function to measure the elapsed time of a task and provide
27
+ * detailed timing information.
28
+ *
29
+ * This function wraps a given task (callback function) and provides it with
30
+ * a `tracked` object that includes a `print` method. The `print` method can
31
+ * be used within the task to log messages along with the elapsed time
32
+ * since the task started execution. The elapsed time is formatted in milliseconds,
33
+ * seconds, or minutes, based on the duration.
34
+ *
35
+ * @param {Function} task - A callback function to be measured. The function
36
+ * is invoked with a `tracked` object as an argument.
37
+ * @return {*} Result of the wrapped callback function. The result of the
38
+ * `task` callback will be returned unchanged.
39
+ * @todo #368:30min Decide if the `elapsed` utility function is in the right place,
40
+ * consider relocating it and its test file if needed
41
+ */
42
+ module.exports.elapsed = function elapsed(task) {
43
+ const startTime = Date.now();
44
+ return task({
45
+ print: (message) => {
46
+ const duration = Date.now() - startTime;
47
+ let extended;
48
+ if (duration < 1000) {
49
+ extended = `${duration}ms`;
50
+ } else if (duration < 60 * 1000) {
51
+ extended = `${Math.ceil(duration / 1000)}s`;
52
+ } else {
53
+ extended = `${Math.ceil(duration / 3600000)}min`;
54
+ }
55
+ const msg = `${message} in ${extended}`;
56
+ console.info(msg);
57
+ return msg;
58
+ }
59
+ });
60
+ };
package/src/eoc.js CHANGED
@@ -310,7 +310,7 @@ program.command('link')
310
310
 
311
311
  program.command('dataize')
312
312
  .description('Run the single executable binary and dataize an object')
313
- .option('--stack <size>', 'Set stack size for the virtual machine', '1M')
313
+ .option('--stack <size>', 'Set stack size for the virtual machine', '64M')
314
314
  .option('--heap <size>', 'Set the heap size for the VM', '256M')
315
315
  .action((str, opts) => {
316
316
  clear(str);
@@ -333,6 +333,8 @@ program.command('dataize')
333
333
 
334
334
  program.command('test')
335
335
  .description('Run all visible unit tests')
336
+ .option('--stack <size>', 'Set stack size for the virtual machine', '64M')
337
+ .option('--heap <size>', 'Set the heap size for the VM', '256M')
336
338
  .action((str, opts) => {
337
339
  clear(str);
338
340
  if (program.opts().alone == undefined) {
@@ -342,9 +344,9 @@ program.command('test')
342
344
  .then((r) => coms().transpile(program.opts()))
343
345
  .then((r) => coms().compile(program.opts()))
344
346
  .then((r) => coms().link(program.opts()))
345
- .then((r) => coms().test(program.opts()));
347
+ .then((r) => coms().test({...program.opts(), ...str}));
346
348
  } else {
347
- coms().test(program.opts());
349
+ coms().test({...program.opts(), ...str});
348
350
  }
349
351
  });
350
352
 
package/src/version.js CHANGED
@@ -25,6 +25,6 @@
25
25
  // The values here are replaced automatically by the .rultor.yml script,
26
26
  // at the "release" pipeline:
27
27
  module.exports = {
28
- what: '0.27.1',
29
- when: '2024-12-15'
28
+ what: '0.28.1',
29
+ when: '2024-12-23'
30
30
  };