Skip to content

Commit

Permalink
working system
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudenw committed May 28, 2024
1 parent 1b96fc5 commit be2fc52
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.SortedSet;
import java.util.function.Consumer;
Expand Down Expand Up @@ -376,6 +377,15 @@ public void log(Level level, String msg) {
protected ReportConfiguration getConfiguration() throws MojoExecutionException {
DefaultLog.setInstance(makeLog());
try {
Log log = getLog();
if (log.isDebugEnabled()) {
log.debug("Start BaseRatMojo Configuration options");
for (Map.Entry<String,List<String>> entry : args.entrySet()) {
log.debug(String.format(" * %s %s", entry.getKey(), String.join(", ", entry.getValue())));
}
log.debug("End BaseRatMojo Configuration options");
}

String key = "--"+createName(OptionCollection.EXCLUDE_CLI.getLongOpt());
List<String> argList = args.get(key);
if (argList != null) {
Expand Down Expand Up @@ -414,7 +424,6 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
}
}
if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
Log log = getLog();
if (log.isDebugEnabled()) {
log.debug(String.format("%s license families loaded from pom", families.length));
}
Expand All @@ -436,7 +445,6 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
}

if (licenses != null) {
Log log = getLog();
if (log.isDebugEnabled()) {
log.debug(String.format("%s licenses loaded from pom", licenses.length));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
*/
@Mojo(name = "check", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true)
public class RatCheckMojo extends AbstractRatMojo {

@Parameter(property = "rat.outputFile", defaultValue = "${project.build.directory}/rat.txt")
private File defaultReportFile;

/**
* Where to store the report.
* @deprecated use 'out' property.
Expand Down Expand Up @@ -150,7 +154,12 @@ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("RAT will not execute since it is configured to be skipped via system property 'rat.skip'.");
return;
}

if (args.get("--"+OptionCollection.OUT.getLongOpt()) == null) {
setArg("--"+OptionCollection.OUT.getLongOpt(), defaultReportFile.getPath());
}
ReportConfiguration config = getConfiguration();

logLicenses(config.getLicenses(LicenseFilter.ALL));
try {
this.reporter = new Reporter(config);
Expand Down

0 comments on commit be2fc52

Please sign in to comment.