Skip to content

Commit

Permalink
Merge branch 'master' into fix/objectionary#3529/remove-abstract-attr…
Browse files Browse the repository at this point in the history
…ibute
  • Loading branch information
maxonfjvipon committed Nov 27, 2024
2 parents 67a996a + c686952 commit 0e807fe
Show file tree
Hide file tree
Showing 146 changed files with 909 additions and 566 deletions.
3 changes: 1 addition & 2 deletions .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@
# package name contains capital letter and such names are conventional.
---
exclude_paths:
- "eo-runtime/src/main/java/EOorg/EOeolang/EOmalloc$EOof$EOallocated$EOresize.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOmalloc$EOof$EOallocated$EOsize.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOmalloc$EOof$EOallocated$EOresized.java"
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: teatimeguest/[email protected].3
- uses: teatimeguest/[email protected].4
with:
update-all-packages: true
packages: scheme-basic geometry xcolor naive-ebnf microtype etoolbox
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: teatimeguest/[email protected].3
- uses: teatimeguest/[email protected].4
with:
update-all-packages: true
packages: scheme-basic geometry xcolor naive-ebnf microtype etoolbox
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ebnf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- run: |
sudo apt-get update
sudo apt-get -y install ghostscript imagemagick texlive-extra-utils pdf2svg inkscape
- uses: teatimeguest/[email protected].3
- uses: teatimeguest/[email protected].4
with:
update-all-packages: true
packages: scheme-basic geometry xcolor naive-ebnf microtype etoolbox
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/mvn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ jobs:
name: mvn
strategy:
matrix:
os: [ ubuntu-24.04, windows-2022, macos-12 ]
os: [ ubuntu-24.04, windows-2022, macos-13 ]
java: [ 11, 21 ]
exclude:
- os: windows-2022
java: 11
- os: macos-13
java: 11
runs-on: ${{ matrix.os }}
env:
CONVERT_PATH: /tmp/antlr4-to-bnf-converter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: teatimeguest/[email protected].3
- uses: teatimeguest/[email protected].4
with:
update-all-packages: true
packages: scheme-basic geometry xcolor naive-ebnf microtype etoolbox
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/telegram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
"$(curl --silent 'https://api.github.com/repos/objectionary/eo/issues?state=open&per_page=100&labels=help%20wanted' | jq length)"
printf 'in the backlog, where your help is needed!\n\n'
printf 'You may also be interested in helping us in these repositories:\n\n'
for r in jeo lints eoc eo2js; do
for r in jeo-maven-plugin lints eoc eo2js; do
printf ' - [objectionary/%s](https://github.com/objectionary/%s) ' "${r}" "${r}"
printf '([%d issues]' \
"$(curl --silent "https://api.github.com/repos/objectionary/${r}/issues?state=open&per_page=100&labels=help%20wanted" | jq length)"
Expand Down
86 changes: 45 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ This is how a copy of the object `stdout` is made:

```eo
QQ.io.stdout
"Hello, world!"
"Hello, world!\n"
```

The indentation in EO is important, just like in Python.
Expand All @@ -126,7 +126,7 @@ argument: a copy of the object `sprintf`:
QQ.io.stdout > @
QQ.txt.sprintf
"Hello, %s!"
"Jeffrey"
* "Jeffrey"
```

Here, the object `sprintf` is also
Expand All @@ -139,7 +139,7 @@ This program can be written using horizontal notation:
+alias org.eolang.txt.sprintf
[] > app
(stdout (sprintf "Hello, %s!" "Jeffrey")) > @
(stdout (sprintf "Hello, %s!" (* "Jeffrey"))) > @
```

The special attribute `@` denotes an object that is being
Expand All @@ -155,7 +155,7 @@ inside `app` and use it to build the output string:
[] > app
QQ.io.stdout (msg "Jeffrey") > @
[name] > msg
QQ.txt.sprintf "Hello, %s!" name > @
QQ.txt.sprintf "Hello, %s!" (* name) > @
```

Now, the object `app` has two "bound" attributes: `@` and `msg`. The attribute
Expand All @@ -165,25 +165,29 @@ Now, the object `app` has two "bound" attributes: `@` and `msg`. The attribute
This is how you iterate:

```eo
# Multiplication table.
[args] > app
memory 0 > x
seq > @
*
x.write 2
while.
x.lt 6
[i]
seq > @
*
QQ.io.stdout
QQ.txt.sprintf
"%d x %d = %d\n"
x
x
x.times x
x.write
x.plus 1
true
malloc.for > @
0
[x] >>
seq > @
*
x.put 2
while
x.as-number.lt 6 > [i]
[i] >>
seq > @
*
QQ.io.stdout
QQ.txt.sprintf
"%d x %d = %d\n"
*
^.x
^.x
^.x.as-number.times ^.x
^.x.put
^.x.as-number.plus 1
true
```

This code will print this:
Expand Down Expand Up @@ -249,28 +253,28 @@ the `eo-runtime` module:
<!-- benchmark_begin -->

```text
to-java.xsl 42908 38.18%
add-refs.xsl 9815 8.73%
stars-to-tuples.xsl 9180 8.17%
set-locators.xsl 6401 5.70%
tests.xsl 5514 4.91%
rename-tests-inners.xsl 4905 4.37%
package.xsl 2786 2.48%
add-probes.xsl 2768 2.46%
classes.xsl 2741 2.44%
vars-float-up.xsl 2736 2.43%
resolve-aliases.xsl 2705 2.41%
explicit-data.xsl 2587 2.30%
add-default-package.xsl 2522 2.24%
cti-adds-errors.xsl 2384 2.12%
const-to-dataized.xsl 2003 1.78%
wrap-method-calls.xsl 1886 1.68%
to-java.xsl 41011 34.79%
add-refs.xsl 11386 9.66%
stars-to-tuples.xsl 8669 7.35%
set-locators.xsl 7047 5.98%
tests.xsl 5408 4.59%
rename-tests-inners.xsl 4647 3.94%
resolve-aliases.xsl 3456 2.93%
add-probes.xsl 3292 2.79%
vars-float-up.xsl 3231 2.74%
package.xsl 3166 2.69%
explicit-data.xsl 3135 2.66%
add-default-package.xsl 3128 2.65%
cti-adds-errors.xsl 2849 2.42%
classes.xsl 2790 2.37%
const-to-dataized.xsl 2688 2.28%
expand-qqs.xsl 2402 2.04%
```

The results were calculated in [this GHA job][benchmark-gha]
on 2024-11-24 at 18:45,
on 2024-11-26 at 12:21,
on Linux with 4 CPUs.
The total is 112369 milliseconds.
The total is 117897 milliseconds.
We show only the first 16 most expensive XSL stylesheets.

<!-- benchmark_end -->
Expand Down Expand Up @@ -313,4 +317,4 @@ to enhance the performance of EO components:

[cargo]: https://doc.rust-lang.org/cargo/getting-started/installation.html

[benchmark-gha]: https://github.com/objectionary/eo/actions/runs/11998586030
[benchmark-gha]: https://github.com/objectionary/eo/actions/runs/12030199693
4 changes: 2 additions & 2 deletions eo-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ create a file `pom.xml` with this content (it's just a sample):
<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
<version>0.43.1</version>
<version>0.43.2</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -156,7 +156,7 @@ execution within `eo-maven-plugin/pom.xml`:
...
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>0.43.1</version>
<version>0.43.2</version>
<configuration>
<skipInstallation>true</skipInstallation>
<skipInvocation>true</skipInvocation>
Expand Down
28 changes: 16 additions & 12 deletions eo-maven-plugin/src/main/java/org/eolang/maven/OptimizeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,23 @@ private Optimization optimization() {
* @throws IOException If fails
*/
private static XML lint(final XML xmir) throws IOException {
final Directives dirs = new Directives().xpath("/program").addIf("errors").strict(1);
for (final Defect defect : new Program(xmir).defects()) {
if (OptimizeMojo.suppressed(xmir, defect)) {
continue;
final Directives dirs = new Directives();
final Collection<Defect> defects = new Program(xmir).defects();
if (!defects.isEmpty()) {
dirs.xpath("/program").addIf("errors").strict(1);
for (final Defect defect : defects) {
if (OptimizeMojo.suppressed(xmir, defect)) {
continue;
}
dirs.add("error")
.attr("check", defect.rule())
.attr("severity", defect.severity().toString().toLowerCase(Locale.ENGLISH))
.set(defect.text());
if (defect.line() > 0) {
dirs.attr("line", defect.line());
}
dirs.up();
}
dirs.add("error")
.attr("check", defect.rule())
.attr("severity", defect.severity().toString().toLowerCase(Locale.ENGLISH))
.set(defect.text());
if (defect.line() > 0) {
dirs.attr("line", defect.line());
}
dirs.up();
}
final Node node = xmir.node();
new Xembler(dirs).applyQuietly(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void exec() throws IOException {
}
} else {
Logger.info(
this, "The directory is absent, nothing to place to %[file]s",
this, "The directory %[file]s is absent, nothing to place from it",
home
);
}
Expand Down
84 changes: 50 additions & 34 deletions eo-maven-plugin/src/main/java/org/eolang/maven/PullMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,48 +106,64 @@ public final class PullMojo extends SafeMojo {
private boolean overWrite;

@Override
@SuppressWarnings("PMD.PrematureDeclaration")
public void exec() throws IOException {
if (this.offline) {
Logger.info(
this,
"No programs were pulled because eo.offline flag is TRUE"
"No programs were pulled because eo.offline flag is set to TRUE"
);
} else {
final long start = System.currentTimeMillis();
if (this.hash == null) {
this.hash = new ChCached(
new ChNarrow(
new ChRemote(this.tag)
)
);
}
final Collection<ForeignTojo> tojos = this.scopedTojos().withoutSources();
final Collection<ObjectName> names = new ArrayList<>(0);
final Path base = this.targetDir.toPath().resolve(PullMojo.DIR);
final String hsh = this.hash.value();
for (final ForeignTojo tojo : tojos) {
final ObjectName object = new OnCached(
new OnSwap(
this.withVersions,
new OnVersioned(tojo.identifier(), hsh)
)
this.pull();
}
}

/**
* Pull them all.
* @throws IOException If fails
*/
@SuppressWarnings("PMD.PrematureDeclaration")
private void pull() throws IOException {
final long start = System.currentTimeMillis();
if (this.hash == null) {
this.hash = new ChCached(
new ChNarrow(
new ChRemote(this.tag)
)
);
}
final Collection<ForeignTojo> tojos = this.scopedTojos().withoutSources();
final Collection<ObjectName> names = new ArrayList<>(0);
final Path base = this.targetDir.toPath().resolve(PullMojo.DIR);
final String hsh = this.hash.value();
for (final ForeignTojo tojo : tojos) {
final ObjectName object = new OnCached(
new OnSwap(
this.withVersions,
new OnVersioned(tojo.identifier(), hsh)
)
);
try {
tojo.withSource(this.pulled(object, base, hsh))
.withHash(new ChNarrow(this.hash));
} catch (final IOException exception) {
throw new IOException(
String.format(
"Failed to pull '%s' earlier discovered at %s",
tojo.identifier(),
tojo.discoveredAt()
),
exception
);
try {
tojo.withSource(this.pulled(object, base, hsh))
.withHash(new ChNarrow(this.hash));
} catch (final IOException exception) {
throw new IOException(
String.format(
"Failed to pull object '%s' discovered at %s",
tojo.identifier(),
tojo.discoveredAt()
),
exception
);
}
names.add(object);
}
names.add(object);
}
if (tojos.isEmpty()) {
Logger.info(
this,
"No programs were pulled in %[ms]s",
System.currentTimeMillis() - start
);
} else {
Logger.info(
this,
"%d program(s) were pulled in %[ms]s: %s",
Expand Down
Loading

0 comments on commit 0e807fe

Please sign in to comment.