Skip to content

Commit

Permalink
Considered changes in CLI API
Browse files Browse the repository at this point in the history
  • Loading branch information
salmonb committed Mar 21, 2024
1 parent 054833d commit 71addac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/dev/webfx/mavenplugin/ExportMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import dev.webfx.cli.commands.CommandWorkspace;
import dev.webfx.cli.core.Module;
import dev.webfx.cli.core.*;
import dev.webfx.cli.modulefiles.DevWebFxModuleFile;
import dev.webfx.cli.modulefiles.ExportedWebFxModuleFile;
import dev.webfx.cli.modulefiles.abstr.WebFxModuleFile;
import dev.webfx.cli.util.textfile.TextFileReaderWriter;
import dev.webfx.cli.util.xml.XmlUtil;
import dev.webfx.lib.reusablestream.ReusableStream;
Expand Down Expand Up @@ -112,7 +112,7 @@ public static int export(String projectDirectory, String webfxXmlArtifactPath) {
CommandWorkspace workspace = new CommandWorkspace(projectDirectory);
Path artifactPath = Path.of(webfxXmlArtifactPath);
Files.createDirectories(artifactPath.getParent());
DevWebFxModuleFile webFxModuleFile = workspace.getWorkingDevProjectModule().getWebFxModuleFile();
WebFxModuleFile webFxModuleFile = workspace.getWorkingDevProjectModule().getWebFxModuleFile();
Document document = exportDocument(webFxModuleFile);
if (document != null) {
TextFileReaderWriter.writeTextFile(XmlUtil.formatXmlText(document), artifactPath);
Expand All @@ -126,7 +126,7 @@ public static int export(String projectDirectory, String webfxXmlArtifactPath) {
}
}

private static Document exportDocument(DevWebFxModuleFile webFxModuleFile) {
private static Document exportDocument(WebFxModuleFile webFxModuleFile) {
Document document = webFxModuleFile.getDocument();
Node exportNode = XmlUtil.lookupNode(document, EXPORT_SNAPSHOT_TAG);
boolean exportNodeWasPresent = exportNode != null;
Expand All @@ -141,7 +141,7 @@ private static Document exportDocument(DevWebFxModuleFile webFxModuleFile) {
// Exporting this and children modules in depth
LOGGER.accept("Exporting children modules");
final Node finalExportNode = exportNode;
DevProjectModule projectModule = webFxModuleFile.getProjectModule();
ProjectModule projectModule = webFxModuleFile.getProjectModule();
projectModule.getThisAndChildrenModulesInDepth()
.forEach(pm -> exportChildModuleProject(pm, projectModule, finalExportNode));
// Adding usage to resolve if-uses-java-package and if-uses-java-class directives without downloading the sources
Expand Down Expand Up @@ -174,7 +174,7 @@ private static <T extends Comparable<? super T>> List<T> convertSetToSortedList(
return list;
}

private static void exportChildModuleProject(ProjectModule childModule, DevProjectModule projectModule, Node exportNode) {
private static void exportChildModuleProject(ProjectModule childModule, ProjectModule projectModule, Node exportNode) {
//LOGGER.accept("Exporting child " + childModule.getName());
Document childDocument = childModule.getWebFxModuleFile().getDocument();
if (childDocument != null) {
Expand Down Expand Up @@ -212,7 +212,7 @@ private static void exportChildModuleProject(ProjectModule childModule, DevProje
JavaSourceRootAnalyzer childMainJavaSourceRootAnalyzer = childModule.getMainJavaSourceRootAnalyzer();
if (childModule.getWebFxModuleFile().areSourcePackagesAutomaticallyExported()
// It's also necessary to list the source packages for GWT (as they are listed in module.gwt.xml)
|| childModule.getTarget().isPlatformSupported(Platform.GWT)) {
|| childModule.getTarget().isPlatformSupported(Platform.GWT)) { // TODO: check if it works with -gwt-j2cl modules (ex: charba)
childMainJavaSourceRootAnalyzer.getSourcePackages()
.sorted()
.forEach(p -> XmlUtil.appendElementWithTextContentIfNotAlreadyExists(childProjectElement, "source-packages/package", p, true));
Expand Down

0 comments on commit 71addac

Please sign in to comment.