mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-23 03:48:13 +00:00
8065912: Better handling of classpath in build-infra
Reviewed-by: erikj
This commit is contained in:
parent
33994176ee
commit
54b0810371
@ -30,25 +30,6 @@
|
||||
# (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
|
||||
# using 'configure @CONFIGURE_COMMAND_LINE@'
|
||||
|
||||
# When calling macros, the spaces between arguments are
|
||||
# often semantically important! Sometimes we need to subst
|
||||
# spaces and commas, therefore we need the following macros.
|
||||
X:=
|
||||
SPACE:=$(X) $(X)
|
||||
COMMA:=,
|
||||
DOLLAR:=$$
|
||||
HASH:=\#
|
||||
LEFT_PAREN:=(
|
||||
RIGHT_PAREN:=)
|
||||
SQUOTE:='
|
||||
#'
|
||||
DQUOTE:="
|
||||
#"
|
||||
define NEWLINE
|
||||
|
||||
|
||||
endef
|
||||
|
||||
# The command line given to configure.
|
||||
CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
|
||||
|
||||
|
||||
@ -534,8 +534,7 @@ define SetupModuleCompilation
|
||||
## Service types are required in the classpath when compiing module-info
|
||||
$1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
|
||||
endif
|
||||
$1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
|
||||
$1_JAVAC_FLAGS := -bootclasspath $(EMPTY_DIR) -extdirs $(EMPTY_DIR) -endorseddirs $(EMPTY_DIR) -classpath "$$($1_CLASSPATH)" $$($1_ADD_JAVAC_FLAGS)
|
||||
$1_JAVAC_FLAGS := -bootclasspath $(EMPTY_DIR) -extdirs $(EMPTY_DIR) -endorseddirs $(EMPTY_DIR) $$($1_ADD_JAVAC_FLAGS)
|
||||
|
||||
$$(eval $$(call SetupJavaCompilation,$1, \
|
||||
SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
|
||||
@ -543,6 +542,7 @@ define SetupModuleCompilation
|
||||
INCLUDES := $(JDK_USER_DEFINED_FILTER),\
|
||||
BIN := $$(if $$($1_BIN), $$($1_BIN), $(JDK_OUTPUTDIR)/modules/$1), \
|
||||
HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
|
||||
CLASSPATH := $$($1_CLASSPATH), \
|
||||
ADD_JAVAC_FLAGS := $$($1_ADD_JAVAC_FLAGS) $$($1_JAVAC_FLAGS)))
|
||||
|
||||
$1: $$($1) $$($1_COPY_EXTRA)
|
||||
|
||||
@ -403,6 +403,7 @@ endef
|
||||
# SRC:=one or more directories to search for sources. The order of the source roots
|
||||
# is significant. The first found file of a certain name has priority.
|
||||
# BIN:=store classes here
|
||||
# CLASSPATH:=a list of additional entries to set as classpath to javac
|
||||
# INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
|
||||
# EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
|
||||
# COPY:=.prp means copy all prp files to the corresponding package in BIN.
|
||||
@ -428,6 +429,9 @@ define SetupJavaCompilationBody
|
||||
$1_JVM := $$($$($1_SETUP)_JVM)
|
||||
$1_JAVAC := $$($$($1_SETUP)_JAVAC)
|
||||
$1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
|
||||
ifneq ($$($1_CLASSPATH), )
|
||||
$1_FLAGS += -cp $$(call PathList, $$($1_CLASSPATH))
|
||||
endif
|
||||
ifeq ($$($1_JAVAC),)
|
||||
$$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
|
||||
endif
|
||||
@ -482,7 +486,7 @@ define SetupJavaCompilationBody
|
||||
$$(addprefix -i ,$$(addsuffix /*,$$($1_INCLUDES))) \
|
||||
$$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES) $$($1_SJAVAC_EXCLUDE_FILES))) \
|
||||
$$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \
|
||||
-src "$$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))"
|
||||
-src $$(call PathList, $$($1_SRC))
|
||||
|
||||
# All files below META-INF are always copied.
|
||||
$1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
|
||||
|
||||
@ -41,6 +41,29 @@ endif
|
||||
# next make invocation.
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
################################################################################
|
||||
# Definitions for special characters
|
||||
################################################################################
|
||||
|
||||
# When calling macros, the spaces between arguments are
|
||||
# often semantically important! Sometimes we need to subst
|
||||
# spaces and commas, therefore we need the following macros.
|
||||
X:=
|
||||
SPACE:=$(X) $(X)
|
||||
COMMA:=,
|
||||
DOLLAR:=$$
|
||||
HASH:=\#
|
||||
LEFT_PAREN:=(
|
||||
RIGHT_PAREN:=)
|
||||
SQUOTE:='
|
||||
#'
|
||||
DQUOTE:="
|
||||
#"
|
||||
define NEWLINE
|
||||
|
||||
|
||||
endef
|
||||
|
||||
##############################
|
||||
# Functions
|
||||
##############################
|
||||
@ -779,6 +802,14 @@ else
|
||||
$(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
|
||||
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.
|
||||
# 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))"
|
||||
|
||||
################################################################################
|
||||
|
||||
# Hook to include the corresponding custom file, if present.
|
||||
|
||||
@ -78,7 +78,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
|
||||
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
|
||||
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
|
||||
|
||||
JDK_BOOTCLASSPATH := $(subst $(SPACE),$(PATH_SEP),\
|
||||
JDK_BOOTCLASSPATH := $(call PathList, \
|
||||
$(filter-out $(JDK_OUTPUTDIR)/modules/_%, $(wildcard $(JDK_OUTPUTDIR)/modules/*)))
|
||||
|
||||
# After the jdk is built, we want to build demos using only the recently
|
||||
@ -88,7 +88,7 @@ JDK_BOOTCLASSPATH := $(subst $(SPACE),$(PATH_SEP),\
|
||||
$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
|
||||
JVM := $(JAVA_SMALL), \
|
||||
JAVAC := $(NEW_JAVAC), \
|
||||
FLAGS := -bootclasspath "$(JDK_BOOTCLASSPATH)" $(DISABLE_WARNINGS), \
|
||||
FLAGS := -bootclasspath $(JDK_BOOTCLASSPATH) $(DISABLE_WARNINGS), \
|
||||
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
|
||||
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user