Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/simian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
distribution: 'temurin'
java-version: 17
- run: wget --quiet http://public.yegor256.com/simian.jar -O /tmp/simian.jar
- run: java -jar /tmp/simian.jar -threshold=15 "-excludes=**/EOsocketTest.java" "-excludes=**/gen" "-excludes=**/it" "**/*.java"
- run: java -jar /tmp/simian.jar -threshold=15 "-excludes=**/EOsocketTest.java" "-excludes=**/gen" "-excludes=**/it" "**/*.java" "-excludes=**/AppendedPlugin.java" "-excludes=**/ContainsFiles.java"

Copilot AI Dec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exclusion patterns for AppendedPlugin.java and ContainsFiles.java should use path patterns (e.g., "**AppendedPlugin.java") to properly exclude files. The current syntax may not correctly match these files in subdirectories.

Suggested change
- run: java -jar /tmp/simian.jar -threshold=15 "-excludes=**/EOsocketTest.java" "-excludes=**/gen" "-excludes=**/it" "**/*.java" "-excludes=**/AppendedPlugin.java" "-excludes=**/ContainsFiles.java"
- run: java -jar /tmp/simian.jar -threshold=15 "-excludes=**/EOsocketTest.java" "-excludes=**/gen" "-excludes=**/it" "**/*.java" "-excludes=**AppendedPlugin.java" "-excludes=**ContainsFiles.java"

Copilot uses AI. Check for mistakes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
* SPDX-License-Identifier: MIT
*/
package org.eolang.maven;

import com.jcabi.manifests.Manifests;
import com.yegor256.farea.Execution;
import com.yegor256.farea.Farea;
import java.io.IOException;
import org.cactoos.Scalar;

/**
* Configures the EO Maven plugin within a {@link Farea}.
* @since 0.52
* @todo #4777:90min Continue moving integration tests from eo-maven-plugin to
* eo-integration-tests module. You can recognize these tests by the -IT suffix.
* They use Farea to run Maven builds with eo-maven-plugin.
* After moving all tests, remove the duplicated
* {@link AppendedPlugin} class from eo-maven-plugin module.
* Don't forget to remove exclusion from 'simian.yaml' as well.
*/
final class AppendedPlugin implements Scalar<Execution> {
/**
* The Farea object.
*/
private final Farea farea;

/**
* Ctor.
* @param farea The Farea
*/
AppendedPlugin(final Farea farea) {
this.farea = farea;
}

@Override
public Execution value() throws IOException {
return this.farea.build()
.plugins()
.append(
"org.eolang",
"eo-maven-plugin",
System.getProperty(
"eo.version",
Manifests.read("EO-Version")
)
).execution();
}
Comment on lines +38 to +49

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Check for eo.version property definitions and EO-Version manifest references
rg "eo\.version" -C3

Repository: objectionary/eo

Length of output: 5843


🏁 Script executed:

# Check for EO-Version manifest entries
rg "EO-Version" -C3

Repository: objectionary/eo

Length of output: 13757


🏁 Script executed:

# Look for the Manifests class to understand how it reads manifest files
fd -e java | xargs rg -l "class Manifests|Manifests.read" | head -5

Repository: objectionary/eo

Length of output: 361


🏁 Script executed:

# Check pom.xml for version properties and manifest configuration
find . -name "pom.xml" | xargs rg -l "eo.version|EO-Version" | head -5

Repository: objectionary/eo

Length of output: 99


🏁 Script executed:

# Find and examine eo-integration-tests pom.xml for version and manifest configuration
find . -path "*/eo-integration-tests/pom.xml" -exec cat {} \;

Repository: objectionary/eo

Length of output: 8034


🏁 Script executed:

# Find the Manifests class to understand how it reads manifest entries
fd -e java -type f | xargs rg -l "class Manifests|public static.*read"

Repository: objectionary/eo

Length of output: 231


🏁 Script executed:

# Check if eo-integration-tests inherits system property from parent
find . -path "*/eo-integration-tests/pom.xml" -o -path "*/pom.xml" | head -1 | xargs cat | grep -A 20 "systemPropertyVariables"

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Search for Manifests class definition and usage pattern
rg -l "class Manifests" --type=java

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Check the manifest file in eo-integration-tests test resources
cat eo-integration-tests/src/test/resources/META-INF/MANIFEST.MF

Repository: objectionary/eo

Length of output: 138


🏁 Script executed:

# Verify that eo-integration-tests test manifest is accessible during tests
find eo-integration-tests -name "MANIFEST.MF" -o -name "pom.xml" | grep -E "test/resources|pom.xml"

Repository: objectionary/eo

Length of output: 194


🏁 Script executed:

# Check if Maven filters test resources for eo-integration-tests
grep -r "filtering" eo-integration-tests/pom.xml

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Check the parent pom (eo-parent) for system property or resource configuration
find . -path "*/eo-parent/pom.xml" -exec head -100 {} \; | grep -A 30 "systemPropertyVariables"

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Verify if the manifest placeholder is properly handled during build
rg "filtering.*true" eo-integration-tests

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Find and examine the parent pom.xml (eo-parent)
find . -name "eo-parent" -type d -o -name "pom.xml" | xargs grep -l "eo-parent" | head -1 | xargs dirname | xargs find . -name "pom.xml" -path "*/eo-parent/*" | head -1 | xargs cat | head -150

Repository: objectionary/eo

Length of output: 177


🏁 Script executed:

# Check how parent pom configures test resources and system properties
rg "eo-parent" -A 200 | head -100

Repository: objectionary/eo

Length of output: 4330


🏁 Script executed:

# Look at the actual parent pom location
git ls-files | grep "pom.xml" | grep -i parent

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Check if parent pom configures test resource filtering
cat pom.xml | grep -A 50 "build"

Repository: objectionary/eo

Length of output: 6664


🏁 Script executed:

# Search for test resources configuration in parent or child
rg "testResources|filtering" pom.xml -A 5

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Check if there are any issues or comments about the manifest in the codebase
rg "manifest|EO-Version" eo-integration-tests/pom.xml -C 5

Repository: objectionary/eo

Length of output: 377


🏁 Script executed:

# Check if test resources are configured with filtering in any pom
rg "testResources" -A 10 pom.xml eo-integration-tests/pom.xml

Repository: objectionary/eo

Length of output: 41


🏁 Script executed:

# Check if Maven properties filtering is configured for the project
rg "maven-resources-plugin" -C 5

Repository: objectionary/eo

Length of output: 612


🏁 Script executed:

# Check eo-maven-plugin's pom for system property configuration
cat eo-maven-plugin/pom.xml | grep -A 20 "systemPropertyVariables"

Repository: objectionary/eo

Length of output: 915


🏁 Script executed:

# Verify the AppendedPlugin in eo-maven-plugin module to see if it inherits system property from there
cat eo-maven-plugin/src/test/java/org/eolang/maven/AppendedPlugin.java | head -60

Repository: objectionary/eo

Length of output: 1081


🏁 Script executed:

# Check if there's a shared test base or superclass for AppendedPlugin
rg "class AppendedPlugin" -A 5 eo-maven-plugin/

Repository: objectionary/eo

Length of output: 591


Version resolution will fail in test execution due to unfiltered manifest placeholder.

The eo.version system property is not set in the eo-integration-tests module build, leaving Manifests.read("EO-Version") as the sole fallback. However, the test manifest at src/test/resources/META-INF/MANIFEST.MF contains an unfiltered placeholder (EO-Version: ${project.version}) that will return the literal string "${project.version}" instead of an actual version number. This will cause test failures when the plugin version is resolved.

Either configure Maven resource filtering to replace the placeholder in test resources, or add eo.version to the module's systemPropertyVariables in the surefire/failsafe plugin configuration.

🤖 Prompt for AI Agents
In eo-integration-tests/src/test/java/org/eolang/maven/AppendedPlugin.java
around lines 38 to 49, the code falls back to reading EO-Version from the test
MANIFEST which contains an unfiltered placeholder "${project.version}", causing
version resolution to fail; fix by ensuring the plugin version is provided at
test runtime — either add a concrete eo.version system property to the module's
surefire/failsafe configuration (systemPropertyVariables.eo.version) or enable
Maven resource filtering for src/test/resources/META-INF/MANIFEST.MF so the
EO-Version placeholder is replaced, and then update the test build configuration
accordingly so Manifests.read("EO-Version") returns a real version string.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
* SPDX-License-Identifier: MIT
*/
package org.eolang.maven;

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;

/**
* Asserting that path contains files matching provided globs.
* @since 0.31.0
* @todo #4777:30min Remove {@link ContainsFiles} duplicate.
* We have exactly the same class in eo-maven-plugin module.
* We need to keep only one copy of this class and use it in both
* eo-maven-plugin and eo-integration-tests modules.
* Don't forget to remove exclusion from 'simian.yaml' as well.
*/
@SuppressWarnings({
"JTCOP.RuleAllTestsHaveProductionClass",
"JTCOP.RuleCorrectTestName",
"JTCOP.RuleInheritanceInTests"
})
final class ContainsFiles extends TypeSafeMatcher<Path> {
/**
* Patterns.
*/
private final String[] globs;

/**
* Ctor.
* @param glbs Patterns
*/
ContainsFiles(final String... glbs) {
this.globs = Arrays.copyOf(glbs, glbs.length);
}

@Override
public void describeTo(final Description description) {
description.appendText(String.format("Matching globs: %s", Arrays.toString(this.globs)));
}

@Override
public boolean matchesSafely(final Path path) {
return Arrays.stream(this.globs)
.anyMatch(
glob -> ContainsFiles.matchesGlob(
path,
glob
)
);
}

/**
* Returns whether a path matches a file pattern.
* @param item The path.
* @param glob The file pattern.
* @return True if the item matches the glob.
*/
private static boolean matchesGlob(final Path item, final String glob) {
try {
return Files.walk(item)
.anyMatch(
FileSystems
.getDefault()
.getPathMatcher(
String.format(
"glob:%s",
glob
)
)::matches
);
} catch (final IOException ex) {
throw new IllegalStateException(
String.format(
"Error while matching glob=`%s` for %s",
glob,
item
),
ex
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ final class MjAssembleIT {
@Test
void assemblesTogether(@Mktmp final Path temp) throws IOException {
final String stdout = "target/eo/%s/org/eolang/io/stdout.%s";
final String parsed = String.format(stdout, MjParse.DIR, MjAssemble.XMIR);
final String pulled = String.format(stdout, MjPull.DIR, MjAssemble.EO);
final String parsed = String.format(stdout, "1-parse", "xmir");
final String pulled = String.format(stdout, "2-pull", "eo");
new Farea(temp).together(
f -> {
f.clean();
Expand Down Expand Up @@ -83,8 +83,8 @@ void assemblesNotFailWithFailOnError(@Mktmp final Path temp) throws IOException
f.exec("test");
MatcherAssert.assertThat(
"Even if the eo program invalid we still have to parse it, but we didn't",
temp.resolve(String.format("target/eo/%s", MjParse.DIR)).toAbsolutePath(),
new ContainsFiles(String.format("**/main.%s", MjAssemble.XMIR))
temp.resolve(String.format("target/eo/%s", "1-parse")).toAbsolutePath(),
new ContainsFiles("**/main.xmir")
);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@
import org.junit.jupiter.api.extension.ExtendWith;

/**
* Integration tests for {@link MjTranspile}.
* Integration tests for eo-maven-plugin:transpile goal.
*
* @since 0.52
* @todo #4718:90min Make {@linkg MjTranspileIT} independent on the previous eo-maven-plugin.
* The tests in {@link MjTranspileIT} depend on the eo-maven-plugin being installed
* on the local maven repository instead of using the current one.
* We should either move these tests to eo-integration-tests, or find a way to use
* the current eo-maven-plugin build for testing.
* Otherwise, these tests check the previous version of the plugin.
*/
@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleNotContainsTestWord"})
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class, RandomProgramResolver.class})
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class})
final class MjTranspileIT {

@Test
Expand Down Expand Up @@ -91,8 +85,18 @@ void transpilesWithPackage(@Mktmp final Path temp) throws Exception {
}

@Test
void transpilesSimpleApp(@Mktmp final Path temp, @RandomProgram final String prog)
void transpilesSimpleApp(@Mktmp final Path temp)
throws Exception {
final String prog = String.join(
"\n",
"# This is a random program in EO, which supposedly",
"# complies with all syntactic rules of the language,",
"# include the requirements for comments.",
"[] > foo",
" QQ.io.stdout > @",
" \"Hello, world!\\n\"",
""
);
new Farea(temp).together(
f -> {
f.clean();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
* SPDX-License-Identifier: MIT
*/
/**
* Integration tests for different eo-maven-plugin goals.
* In these tests we extensively use Farea framework to run some parts of eo-maven-plugin
* in a real Maven build.
*/
package org.eolang.maven;
Loading