Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Dec 6, 2023
2 parents 015f738 + ef024e2 commit 3553322
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 17 deletions.
59 changes: 59 additions & 0 deletions eo-maven-plugin/src/main/java/org/eolang/maven/AssembleMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,32 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Set;
import java.util.function.BiConsumer;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.cactoos.set.SetOf;
import org.eolang.maven.objectionary.Objectionaries;
import org.eolang.maven.objectionary.ObjsDefault;

/**
* Pull all necessary EO XML files from Objectionary and parse them all.
*
* @since 0.1
* @todo #2406:90min Make up with idea how to get rid of duplicate parameters between mojos.
* There's a situation where AssembleMojo owns, creates and executes other mojos,
* like {@link ParseMojo} or {@link OptimizeMojo}. When we configure our compiler via pom.xml maven
* tries to set parameters directly to the calling mojo. That's why we must to have all parameters
* from child mojos in AssembleMojo or {@link SafeMojo} (in order they won't be skipped and lost).
* That causes duplication of parameters between "parent" mojo and "child" mojos.
* Also it obliges the developer to remember that if he adds new parameter to some child mojo,
* this parameter must be present in parent mojo as well.
* We didn't find a way how we can resolve such duplication at the moment.
* So we need to either accept this as impossible to solve or resolve somehow.
* Anyway don't forget to remove the puzzle when the decision about the puzzle is made.
*/
@Mojo(
name = "assemble",
Expand All @@ -65,6 +78,24 @@ public final class AssembleMojo extends SafeMojo {
)
private File outputDir;

/**
* List of inclusion GLOB filters for finding class files.
* @since 0.15
* @checkstyle MemberNameCheck (7 lines)
* @checkstyle ConstantUsageCheck (5 lines)
*/
@Parameter
private final Set<String> includeBinaries = new SetOf<>("**");

/**
* List of exclusion GLOB filters for finding class files.
* @since 0.15
* @checkstyle MemberNameCheck (7 lines)
* @checkstyle ConstantUsageCheck (5 lines)
*/
@Parameter
private final Set<String> excludeBinaries = new SetOf<>();

/**
* Objectionaries.
* @checkstyle MemberNameCheck (6 lines)
Expand All @@ -89,6 +120,24 @@ public final class AssembleMojo extends SafeMojo {
@Parameter(property = "eo.overWrite", required = true, defaultValue = "false")
private boolean overWrite;

/**
* Track optimization steps into intermediate XML files?
*
* @checkstyle MemberNameCheck (7 lines)
* @since 0.24.0
*/
@SuppressWarnings("PMD.LongVariable")
@Parameter(property = "eo.trackOptimizationSteps", required = true, defaultValue = "false")
private boolean trackOptimizationSteps;

/**
* The Git tag to pull objects from, in objectionary.
* @since 0.21.0
*/
@SuppressWarnings("PMD.ImmutableField")
@Parameter(property = "eo.tag", required = true, defaultValue = "master")
private String tag = "master";

/**
* Skip artifact with the version 0.0.0.
* @checkstyle MemberNameCheck (7 lines)
Expand All @@ -105,6 +154,16 @@ public final class AssembleMojo extends SafeMojo {
@Parameter(property = "eo.discoverSelf", required = true, defaultValue = "false")
private boolean discoverSelf;

/**
* Fail resolution process on conflicting dependencies.
*
* @checkstyle MemberNameCheck (7 lines)
* @since 1.0
*/
@Parameter(property = "eo.ignoreVersionConflicts", required = true, defaultValue = "false")
@SuppressWarnings("PMD.LongVariable")
private boolean ignoreVersionConflicts;

/**
* Whether we should fail on error.
* @checkstyle MemberNameCheck (11 lines)
Expand Down
9 changes: 0 additions & 9 deletions eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,6 @@ abstract class SafeMojo extends AbstractMojo {
new Sticky<>(() -> Catalogs.INSTANCE.make(this.transpiled.toPath(), this.transpiledFormat))
);

/**
* The Git hash to pull objects from, in objectionary.
* If not set, will be computed from {@code tag} field.
*
* @since 0.29.6
*/
@SuppressWarnings({"PMD.ImmutableField", "PMD.UnusedPrivateField"})
private CommitHash hash;

/**
* Cached tojos.
* @checkstyle VisibilityModifierCheck (5 lines)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ void assemblesSuccessfullyInOfflineMode(final Logs out, @TempDir final Path temp
}

@Test
@Disabled
void configuresChildParameters(@TempDir final Path temp) throws IOException {
final Map<String, Path> res = new FakeMaven(temp)
.withHelloWorld()
Expand Down
7 changes: 0 additions & 7 deletions eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@
* their behaviour and results.
* NOT thread-safe.
* @since 0.28.12
* @todo #2406:30min Fix {@link FakeMaven#allowedParams(Class)}
* This function configures parameters of executed Mojo in {@link FakeMaven#execute(Class)}
* and parameters those Mojos which are inside this executed Mojo.
* If executed Mojo doesn't have parameters that are inside other Mojos,
* other Mojos parameters will not be configured.
* We need to make sure that custom parameters can be configured too.
* We need to enable the test {@link AssembleMojoTest#configuresChildParameters(Path)}.
*/
@SuppressWarnings({
"PMD.TooManyMethods",
Expand Down

2 comments on commit 3553322

@0pdd
Copy link

@0pdd 0pdd commented on 3553322 Dec 6, 2023

Choose a reason for hiding this comment

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

Puzzle 2406-a4a297dd disappeared from eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java), that's why I closed #2668. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link

@0pdd 0pdd commented on 3553322 Dec 6, 2023

Choose a reason for hiding this comment

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

Puzzle 2406-424948df discovered in eo-maven-plugin/src/main/java/org/eolang/maven/AssembleMojo.java) and submitted as #2679. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.