make/common/Modules.gmk
changeset 41658 14de1ab85d25
parent 41653 12ac83416f21
child 42289 08548fd6e608
--- a/make/common/Modules.gmk	Thu Oct 27 21:21:52 2016 +0000
+++ b/make/common/Modules.gmk	Fri Oct 28 14:29:20 2016 +0200
@@ -178,6 +178,16 @@
           $(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \
         $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC)))
 
+# Find module-info.java files in the specific source dir
+# Param 1 - Src dir to find module-info.java files in
+FindModuleInfosForSrcDir = \
+    $(wildcard \
+        $(foreach sub, $(SRC_SUBDIRS), \
+          $(patsubst %,%/*/$(sub)/module-info.java, $(strip $1)) \
+        ) \
+        $(patsubst %,%/*/module-info.java, $(strip $1)) \
+    )
+
 # Extract the module names from the paths of module-info.java files. The
 # position of the module directory differs depending on if this is an imported
 # src dir or not.
@@ -193,6 +203,13 @@
     $(sort $(filter-out $(MODULES_FILTER), \
     $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS))))
 
+# Find all modules in a specific src dir
+# Param 1 - Src dir to find modules in
+FindModulesForSrcDir = \
+    $(sort $(filter-out $(MODULES_FILTER), \
+        $(call GetModuleNameFromModuleInfo, $(call FindModuleInfosForSrcDir, $1)) \
+    ))
+
 FindImportedModules = \
     $(filter-out $(MODULES_FILTER), \
     $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*))))