Skip to content

Commit

Permalink
Drop group project support
Browse files Browse the repository at this point in the history
  • Loading branch information
shuyangzhou committed Apr 19, 2021
1 parent b19266d commit e7ab7f0
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 552 deletions.
1 change: 0 additions & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ display.gradle.process.output=false

jpda.settings=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y

group.depth=2
group.stop.words=third-party,modules

include.generated.jsp.servlet=false
Expand Down
148 changes: 0 additions & 148 deletions src/com/liferay/netbeansproject/CreateGroupModule.java

This file was deleted.

104 changes: 0 additions & 104 deletions src/com/liferay/netbeansproject/CreateGroupUmbrella.java

This file was deleted.

75 changes: 2 additions & 73 deletions src/com/liferay/netbeansproject/ProjectBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ public static void main(String[] args) throws Exception {
String ignoredDirs = PropertiesUtil.getRequiredProperty(
buildProperties, "ignored.dirs");

int groupDepth = Integer.valueOf(
PropertiesUtil.getRequiredProperty(buildProperties, "group.depth"));

List<String> groupStopWords = Arrays.asList(
StringUtil.split(
PropertiesUtil.getRequiredProperty(
buildProperties, "group.stop.words"),
','));

boolean includeJsps = Boolean.valueOf(
PropertiesUtil.getRequiredProperty(
buildProperties, "include.generated.jsp.servlet"));
Expand All @@ -85,13 +76,6 @@ public static void main(String[] args) throws Exception {
for (String portalDir : portalDirs) {
Path portalDirPath = Paths.get(portalDir);

List<String> currentGroupStopWords = new ArrayList<>(
groupStopWords);

currentGroupStopWords.add(
String.valueOf(
portalDirPath.getName(portalDirPath.getNameCount() - 2)));

Properties appServerProperties = new Properties();

Path trunkPath = null;
Expand All @@ -107,7 +91,7 @@ public static void main(String[] args) throws Exception {
projectBuilder.scanPortal(
projectDirPath.resolve(portalDirPath.getFileName()),
portalDirPath, displayGradleProcessOutput, ignoredDirs,
groupDepth, currentGroupStopWords, trunkPath,
trunkPath,
appServerProperties.getProperty("app.server.tomcat.version"),
includeJsps, gradleBuildExcludeDirs, gradleOpts);
}
Expand All @@ -116,8 +100,7 @@ public static void main(String[] args) throws Exception {
public void scanPortal(
final Path projectPath, Path portalPath,
final boolean displayGradleProcessOutput, String ignoredDirs,
int groupDepth, List<String> groupStopWords, Path trunkPath,
String tomcatVersion, boolean includeJsps,
Path trunkPath, String tomcatVersion, boolean includeJsps,
String gradleBuildExcludeDirs, String gradleOpts)
throws Exception {

Expand Down Expand Up @@ -213,60 +196,6 @@ public FileVisitResult preVisitDirectory(
CreateUmbrella.createUmbrella(
portalPath, moduleNames, projectPath.resolve("umbrella"), trunkPath,
tomcatVersion);

if (groupDepth < 1) {
return;
}

Map<Path, List<Module>> moduleGroups = _createModuleGroups(
modules, groupDepth, groupStopWords);

Path groupProjectPath = projectPath.resolve("group-modules");

FileUtil.delete(groupProjectPath);

for (Map.Entry<Path, List<Module>> entry : moduleGroups.entrySet()) {
CreateGroupModule.createModule(
groupProjectPath, portalPath, entry.getKey(), entry.getValue(),
portalLibJars, compatJars);
}

CreateGroupUmbrella.createUmbrella(
portalPath, moduleGroups.keySet(),
projectPath.resolve("group-umbrella"), trunkPath, tomcatVersion);
}

private Map<Path, List<Module>> _createModuleGroups(
List<Module> modules, int groupDepth, List<String> groupStopWords) {

Map<Path, List<Module>> moduleGroups = new HashMap<>();

for (Module module : modules) {
Path groupPath = module.getModulePath();

for (int i = 1; i < groupDepth; i++) {
if (groupStopWords.contains(
String.valueOf(
groupPath.getName(groupPath.getNameCount() - 2)))) {

break;
}

groupPath = groupPath.getParent();
}

List<Module> moduleGroup = moduleGroups.get(groupPath);

if (moduleGroup == null) {
moduleGroup = new ArrayList<>();

moduleGroups.put(groupPath, moduleGroup);
}

moduleGroup.add(module);
}

return moduleGroups;
}

}
Loading

0 comments on commit e7ab7f0

Please sign in to comment.