Skip to content

Commit

Permalink
fix(objectionary#2668): added todo + fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanich96 committed Dec 5, 2023
1 parent 881ed60 commit 336bcf2
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 8 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 (7 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

0 comments on commit 336bcf2

Please sign in to comment.