Skip to content

Commit

Permalink
Merge pull request #85 from vmj/default-paths
Browse files Browse the repository at this point in the history
Support for default source and public paths
  • Loading branch information
jiakuan authored Dec 9, 2024
2 parents f0de4f2 + 556f99e commit efb5572
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions plugin/src/main/java/org/docstr/gwt/GwtCompileConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ File findModuleFile(Project project, String moduleName) {
}

static File findModuleFile(String moduleName, Set<File> sourceFiles) {
String moduleFileName = moduleName.replace('.', '/') + ".gwt.xml";
for (File file : sourceFiles) {
log.info("findModuleFile - file: {}, module: {}",
file.getAbsolutePath(), moduleName);
if (file.getAbsolutePath().replaceAll("\\\\", "/")
.endsWith(moduleName.replace('.', '/') + ".gwt.xml")) {
.endsWith(moduleFileName)) {
return file;
}
}
Expand Down Expand Up @@ -121,20 +122,30 @@ TreeSet<File> extractSourcePaths(File moduleFile) {

// Extract the source paths from the GWT module XML file
NodeList sourceNodes = doc.getElementsByTagName("source");
for (int i = 0; i < sourceNodes.getLength(); i++) {
String path = sourceNodes.item(i).getAttributes().getNamedItem("path")
.getNodeValue();
File sourceDir = new File(moduleParent, path);
if(sourceNodes.getLength() == 0) {
File sourceDir = new File(moduleParent, "client");
sourcePaths.add(sourceDir);
} else {
for(int i = 0; i < sourceNodes.getLength(); i++) {
String path = sourceNodes.item(i).getAttributes().getNamedItem("path")
.getNodeValue();
File sourceDir = new File(moduleParent, path);
sourcePaths.add(sourceDir);
}
}

// Extract the public paths from the GWT module XML file
NodeList publicNodes = doc.getElementsByTagName("public");
for (int i = 0; i < publicNodes.getLength(); i++) {
String path = publicNodes.item(i).getAttributes().getNamedItem("path")
.getNodeValue();
File publicDir = new File(moduleParent, path);
sourcePaths.add(publicDir);
if(publicNodes.getLength() == 0) {
File sourceDir = new File(moduleParent, "public");
sourcePaths.add(sourceDir);
} else {
for(int i = 0; i < publicNodes.getLength(); i++) {
String path = publicNodes.item(i).getAttributes().getNamedItem("path")
.getNodeValue();
File publicDir = new File(moduleParent, path);
sourcePaths.add(publicDir);
}
}
} catch (Exception e) {
log.error("Error reading GWT module file: {}", moduleFile, e);
Expand Down

0 comments on commit efb5572

Please sign in to comment.