Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
Signed-off-by: tvallin <thibault.vallin@oracle.com>
  • Loading branch information
tvallin committed Jul 12, 2023
1 parent dfd3864 commit 8fa19ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
Expand All @@ -38,6 +39,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

Expand Down Expand Up @@ -306,7 +308,7 @@ protected String determinePackageName(Optional<ServiceProvider<ModuleComponent>>

if (persistIt) {
// record it to scratch file for later consumption (during test build for example)
saveAppPackageName(packageName);
saveAppPackageName(packageName, getLog());
}

return packageName;
Expand All @@ -326,7 +328,10 @@ protected Optional<String> loadAppPackageName() {
*
* @param packageName the package name
*/
protected void saveAppPackageName(String packageName) {
protected void saveAppPackageName(String packageName, Log logger) {
if ("unnamed".equals(packageName)) {
logger.debug("Errors: " + Arrays.toString(Thread.currentThread().getStackTrace()));
}
ModuleUtils.saveAppPackageName(getPicoScratchDir().toPath(), packageName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
Expand Down Expand Up @@ -370,7 +371,11 @@ Optional<Path> codegenModuleInfoFilerOut(ModuleInfoDescriptor newDeltaDescriptor
}

if (!newDeltaDescriptor.isUnnamed()) {
saveAppPackageName(scratchBaseOutputPath, normalizedBaseModuleName(newDeltaDescriptor.name()));
String name = normalizedBaseModuleName(newDeltaDescriptor.name());
if (name.equals("unnamed")) {
messager.debug("Errors: name " + Arrays.toString(Thread.currentThread().getStackTrace()));
}
saveAppPackageName(scratchBaseOutputPath, name);
}

return filePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
Expand Down Expand Up @@ -358,7 +357,7 @@ public static Path toBasePath(String sourcePath) {
if (pos < 0) {
throw new ToolsException("Invalid source path: " + sourcePath);
}
return Objects.requireNonNull(Path.of(path.substring(0, pos)));
return Objects.requireNonNull(Path.of(sourcePath.substring(0, pos)));
}

/**
Expand Down

0 comments on commit 8fa19ba

Please sign in to comment.