8153969: Clean up module src dir logic
Reviewed-by: ihse
This commit is contained in:
parent
d425397e1e
commit
ec3913386e
@ -469,32 +469,7 @@ jdk.localedata_EXCLUDE_FILES += sun/text/resources/th/BreakIteratorRules_th.java
|
||||
################################################################################
|
||||
# Setup the compilation for the module
|
||||
#
|
||||
# Order src dirs in order of override with the most important first. Generated
|
||||
# source before static source and platform specific source before shared.
|
||||
#
|
||||
GENERATED_SRC_DIRS += \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc \
|
||||
#
|
||||
|
||||
TOP_SRC_DIRS += \
|
||||
$(HOTSPOT_TOPDIR)/src \
|
||||
$(CORBA_TOPDIR)/src \
|
||||
$(JDK_TOPDIR)/src \
|
||||
$(LANGTOOLS_TOPDIR)/src \
|
||||
$(JAXP_TOPDIR)/src \
|
||||
$(JAXWS_TOPDIR)/src \
|
||||
$(NASHORN_TOPDIR)/src \
|
||||
#
|
||||
|
||||
SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
|
||||
ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
|
||||
SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
|
||||
endif
|
||||
SRC_SUBDIRS += share/classes
|
||||
|
||||
MODULE_SRC_DIRS := $(strip \
|
||||
$(addsuffix /$(MODULE), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
|
||||
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(MODULE)/$(sub), $(TOP_SRC_DIRS))))
|
||||
MODULE_SRC_DIRS := $(call FindModuleSrcDirs, $(MODULE))
|
||||
|
||||
# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
|
||||
# JDK_FILTER at the make command line, only a subset of the JDK java files will
|
||||
@ -502,27 +477,20 @@ MODULE_SRC_DIRS := $(strip \
|
||||
# space separated list.
|
||||
JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
|
||||
|
||||
# Rewrite the MODULE_SRC_DIRS with a wildcard for the module so that all module
|
||||
# source dirs are available on the path.
|
||||
MODULESOURCEPATH := $(subst $(SPACE),$(PATH_SEP),$(subst $(MODULE),*,$(MODULE_SRC_DIRS)))
|
||||
# Get the complete module source path.
|
||||
MODULESOURCEPATH := $(call GetModuleSrcPath)
|
||||
|
||||
# Add imported modules to the moduleclasspath
|
||||
MODULECLASSPATH := $(subst $(SPACE),$(PATH_SEP), $(IMPORT_MODULES_CLASSES))
|
||||
# Add imported modules to the modulepath
|
||||
MODULEPATH := $(call PathList, $(IMPORT_MODULES_CLASSES))
|
||||
|
||||
ifeq ($(MODULE), jdk.vm.ci)
|
||||
## WORKAROUND jdk.vm.ci source structure issue
|
||||
JVMCI_MODULESOURCEPATH := $(MODULESOURCEPATH) \
|
||||
$(subst /$(MODULE)/,/*/, $(filter-out %processor/src, \
|
||||
$(wildcard $(HOTSPOT_TOPDIR)/src/jdk.vm.ci/share/classes/*/src)))
|
||||
MODULESOURCEPATH := $(subst $(SPACE),$(PATH_SEP), $(JVMCI_MODULESOURCEPATH))
|
||||
MODULESOURCEPATH := $(call PathList, $(JVMCI_MODULESOURCEPATH))
|
||||
endif
|
||||
|
||||
# Make sure the generated source base dirs exist. Not all modules have generated
|
||||
# source in all of these directories and because of timing, all of them might not
|
||||
# exist at the time this makefile gets called. Javac will complain if there are
|
||||
# missing directories in the moduleclasspath.
|
||||
$(call MakeDir, $(GENERATED_SRC_DIRS))
|
||||
|
||||
$(eval $(call SetupJavaCompilation, $(MODULE), \
|
||||
SETUP := $(if $($(MODULE)_SETUP), $($(MODULE)_SETUP), GENERATE_JDKBYTECODE), \
|
||||
MODULE := $(MODULE), \
|
||||
@ -532,8 +500,8 @@ $(eval $(call SetupJavaCompilation, $(MODULE), \
|
||||
HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
|
||||
ADD_JAVAC_FLAGS := \
|
||||
$($(MODULE)_ADD_JAVAC_FLAGS) \
|
||||
-modulesourcepath "$(MODULESOURCEPATH)" \
|
||||
$(if $(MODULECLASSPATH), -modulepath "$(MODULECLASSPATH)") \
|
||||
-modulesourcepath $(MODULESOURCEPATH) \
|
||||
-modulepath $(MODULEPATH) \
|
||||
-system none, \
|
||||
))
|
||||
|
||||
|
@ -49,7 +49,6 @@ default: all
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include Modules.gmk
|
||||
#include TextFileProcessing.gmk
|
||||
|
||||
################################################################################
|
||||
# Define this here since jdk/make/Tools.gmk cannot be included from the top
|
||||
@ -64,25 +63,8 @@ TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) \
|
||||
# Name of data file. Keep module-info.java.ext until javafx has changed.
|
||||
MOD_FILENAME := module-info.java.extra module-info.java.ext
|
||||
|
||||
# List all the possible sub directories inside a module source directory where
|
||||
# data might be stored.
|
||||
CLASSES_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
|
||||
ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
|
||||
CLASSES_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
|
||||
endif
|
||||
CLASSES_SUBDIRS += share/classes
|
||||
|
||||
# TODO: When the deploy build is better integrated, this will get added globally
|
||||
# but for now need to add it here.
|
||||
ifeq ($(BUILD_DEPLOY), true)
|
||||
ALL_TOP_SRC_DIRS += $(DEPLOY_TOPDIR)/src
|
||||
endif
|
||||
|
||||
# Construct all possible src directories for the module.
|
||||
MODULE_CLASSES_DIRS := $(strip \
|
||||
$(foreach sub, $(CLASSES_SUBDIRS), \
|
||||
$(addsuffix /$(MODULE)/$(sub), $(ALL_TOP_SRC_DIRS))) \
|
||||
$(addsuffix /$(MODULE), $(IMPORT_MODULES_SRC)))
|
||||
MODULE_CLASSES_DIRS := $(call FindModuleSrcDirs, $(MODULE))
|
||||
|
||||
# Find all the .extra files in the src dirs.
|
||||
MOD_FILES := $(wildcard $(foreach f, $(MOD_FILENAME), $(addsuffix /$(f), \
|
||||
@ -125,20 +107,6 @@ ifneq ($(MOD_FILES), )
|
||||
TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java
|
||||
endif
|
||||
|
||||
# This doesn't work because javac only accepts one single exports line per
|
||||
# exported package.
|
||||
# Restore the modifications to separate lines with spaces
|
||||
# MODIFICATIONS := $(subst /,$(SPACE),$(MODIFICATIONS))
|
||||
|
||||
# ifneq ($(MODIFICATIONS), )
|
||||
# $(eval $(call SetupTextFileProcessing, PROCESS_MODULE_INFO, \
|
||||
# SOURCE_FILES := $(firstword $(call FindAllModuleInfos, $(MODULE))), \
|
||||
# OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java, \
|
||||
# REPLACEMENTS := } => $(MODIFICATIONS) }, \
|
||||
# ))
|
||||
|
||||
# TARGETS += $(PROCESS_MODULE_INFO)
|
||||
# endif
|
||||
endif
|
||||
|
||||
# If no modifications are found for this module, remove any module-info.java
|
||||
|
@ -723,12 +723,13 @@ else
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Return a string suitable for use after a -classpath option. It will correct and safe to use
|
||||
# on all platforms. Arguments are given as space separate classpath entries.
|
||||
# Return a string suitable for use after a -classpath or -modulepath option. It
|
||||
# will be correct and safe to use on all platforms. Arguments are given as space
|
||||
# separate classpath entries. Safe for multiple nested calls.
|
||||
# param 1 : A space separated list of classpath entries
|
||||
# The surrounding strip is needed to keep additional whitespace out
|
||||
PathList = \
|
||||
"$(subst $(SPACE),$(PATH_SEP),$(strip $1))"
|
||||
"$(subst $(SPACE),$(PATH_SEP),$(strip $(subst $(DQUOTE),,$1)))"
|
||||
|
||||
################################################################################
|
||||
|
||||
|
@ -138,26 +138,35 @@ endif
|
||||
################################################################################
|
||||
# Module list macros
|
||||
|
||||
# Use append so that the custom extension may add to this variable
|
||||
# Use append so that the custom extension may add to these variables
|
||||
|
||||
ALL_TOP_SRC_DIRS += \
|
||||
GENERATED_SRC_DIRS += \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc \
|
||||
#
|
||||
|
||||
TOP_SRC_DIRS += \
|
||||
$(CORBA_TOPDIR)/src \
|
||||
$(HOTSPOT_TOPDIR)/src \
|
||||
$(JDK_TOPDIR)/src \
|
||||
$(LANGTOOLS_TOPDIR)/src \
|
||||
$(CORBA_TOPDIR)/src \
|
||||
$(JAXP_TOPDIR)/src \
|
||||
$(JAXWS_TOPDIR)/src \
|
||||
$(NASHORN_TOPDIR)/src \
|
||||
#
|
||||
|
||||
SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
|
||||
ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
|
||||
SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
|
||||
endif
|
||||
SRC_SUBDIRS += share/classes
|
||||
|
||||
# Find all module-info.java files for the current build target platform and
|
||||
# configuration.
|
||||
# Param 1 - Module to find for, set to * for finding all
|
||||
FindAllModuleInfos = \
|
||||
$(wildcard \
|
||||
$(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
|
||||
$(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
|
||||
$(patsubst %,%/$(strip $1)/share/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
|
||||
$(foreach sub, $(SRC_SUBDIRS), \
|
||||
$(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \
|
||||
$(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC)))
|
||||
|
||||
# Extract the module names from the paths of module-info.java files. The
|
||||
@ -178,6 +187,19 @@ FindAllModules = \
|
||||
FindImportedModules = \
|
||||
$(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*)))
|
||||
|
||||
# Find all source dirs for a particular module
|
||||
# $1 - Module to find source dirs for
|
||||
FindModuleSrcDirs = \
|
||||
$(strip $(wildcard \
|
||||
$(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
|
||||
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
|
||||
|
||||
# Construct the complete module source path
|
||||
GetModuleSrcPath = \
|
||||
$(call PathList, \
|
||||
$(addsuffix /*, $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
|
||||
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
|
||||
|
||||
################################################################################
|
||||
# Extract module dependencies from module-info.java files.
|
||||
|
||||
|
@ -254,4 +254,14 @@ ifneq ($(call sequence, 5, 15), 5 6 7 8 9 10 11 12 13 14 15)
|
||||
but was $(call sequence, 5, 15))
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Test that PathList is safe when called multiple nested times.
|
||||
|
||||
PATHLIST_INPUT := foo bar baz
|
||||
|
||||
$(eval $(call assert-equals, \
|
||||
$(call PathList, $(call PathList, $(PATHLIST_INPUT))), \
|
||||
$(call PathList, $(PATHLIST_INPUT)), \
|
||||
PathList call not safe for calling twice))
|
||||
|
||||
all: $(TEST_TARGETS)
|
||||
|
Loading…
Reference in New Issue
Block a user