Skip to content

Commit 701b707

Browse files
authored
Merge pull request #4728 from volodya-lombrozo/4717-fix-fibonacci
fix(#4717): enable fibonacci integration test in pom.xml and update properties
2 parents 780f1a7 + 236cbcd commit 701b707

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

eo-integration-tests/pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,6 @@
210210
<configuration combine.self="override">
211211
<skipInstallation>${skipITs}</skipInstallation>
212212
<skipInvocation>${skipITs}</skipInvocation>
213-
<!--
214-
@todo #4702:90min Enable the fibonacci integration test.
215-
Currently, the fibonacci integration test is disabled because it
216-
fails with the following error:
217-
Couldn't find object 'Φ.org.eolang.examples' because there's
218-
no class or package 'EOorg.EOeolang.EOexamples'.
219-
That said, all the classes and packages are successfully generated by
220-
the eo-maven-plugin during the build process.
221-
-->
222-
<pomExcludes>
223-
<exclude>fibonacci/pom.xml</exclude>
224-
</pomExcludes>
225213
</configuration>
226214
</plugin>
227215
</plugins>

eo-integration-tests/src/it/fibonacci/invoker.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# SPDX-License-Identifier: MIT
33

44
invoker.mavenOpts = -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
5-
invoker.goals = clean test
5+
invoker.goals = clean test -X

eo-integration-tests/src/it/fibonacci/pom.xml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@
3434
</properties>
3535
<build>
3636
<plugins>
37-
<plugin>
38-
<artifactId>maven-compiler-plugin</artifactId>
39-
<version>3.8.1</version>
40-
<configuration combine.self="override"/>
41-
</plugin>
4237
<plugin>
4338
<artifactId>maven-surefire-plugin</artifactId>
4439
<configuration>
@@ -61,20 +56,18 @@
6156
<version>@project.version@</version>
6257
<executions>
6358
<execution>
59+
<id>compile</id>
6460
<goals>
6561
<goal>register</goal>
66-
<goal>assemble</goal>
62+
<goal>compile</goal>
6763
<goal>transpile</goal>
6864
</goals>
6965
</execution>
7066
</executions>
7167
<configuration>
72-
<unrollExitError>true</unrollExitError>
73-
<foreign>${project.build.directory}/eo/foreign.csv</foreign>
74-
<foreignFormat>csv</foreignFormat>
75-
<placed>${project.build.directory}/eo/placed.json</placed>
76-
<placedFormat>json</placedFormat>
77-
<trackTransformationSteps>true</trackTransformationSteps>
68+
<ignoreRuntime>true</ignoreRuntime>
69+
<failOnWarning>false</failOnWarning>
70+
<skipLinting>true</skipLinting>
7871
</configuration>
7972
</plugin>
8073
<plugin>
@@ -83,6 +76,7 @@
8376
<version>3.6.2</version>
8477
<executions>
8578
<execution>
79+
<id>run-eo-fibonacci-app</id>
8680
<phase>test</phase>
8781
<goals>
8882
<goal>java</goal>

eo-maven-plugin/src/main/java/org/eolang/maven/MjTranspile.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ clazz, new FileGenerationReport(saved, tgt, target)
259259
* @param generated Path to generated sources
260260
* @return Amount of created files
261261
* @throws IOException If fails to create a file
262+
* @todo #4717:90min Move {@link #pinfos(Path)} method to a separate class.
263+
* Currently, this method violates Single Responsibility Principle of
264+
* MjTranspile class. After moving, make sure to cover it with unit tests.
262265
*/
263266
private static int pinfos(final Path generated) throws IOException {
264267
final int size;
@@ -269,7 +272,7 @@ private static int pinfos(final Path generated) throws IOException {
269272
for (final Path dir : dirs) {
270273
final String pkg = generated.relativize(dir).toString()
271274
.replace(File.separator, ".");
272-
new Saved(
275+
final Path saved = new Saved(
273276
String.join(
274277
"\n",
275278
"/**",
@@ -284,9 +287,14 @@ private static int pinfos(final Path generated) throws IOException {
284287
),
285288
dir.resolve("package-info.java")
286289
).value();
290+
Logger.debug(MjTranspile.class, "Created %s", saved);
287291
}
288292
size = dirs.size();
289293
} else {
294+
Logger.info(
295+
MjTranspile.class,
296+
"No generated sources found, skipping package-info.java creation"
297+
);
290298
size = 0;
291299
}
292300
return size;

eo-runtime/src/main/java/org/eolang/PhPackage.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ public byte[] delta() {
122122
* Load phi object by package name from ClassLoader.
123123
* @param fqn FQN of the EO object
124124
* @return Phi
125+
* @todo #4717:90min Check 'package-info.class' existence before looking for an object.
126+
* Recently, we got an error when 'maven-compiler-plugin' removed 'package-info.class'
127+
* during compilation and we got quite confusing error message:
128+
* ```
129+
* Couldn't find object 'Φ.org.eolang.examples' because there's no class or package
130+
* 'EOorg.EOeolang.EOexamples' EOorg.EOeolang.EOexamples
131+
* ```
132+
* Having said that, the 'EOorg.EOeolang.EOexamples' package does exist.
133+
* The error tells nothing about missing 'package-info.class'. We need to check for the
134+
* existence of 'package-info.class' before trying to find an object.
125135
*/
126136
@SuppressWarnings("PMD.PreserveStackTrace")
127137
private Phi loadPhi(final String fqn) {

0 commit comments

Comments
 (0)