< prev index next > make/CompileJavaModules.gmk
Print this page
################################################################################
include JavaCompilation.gmk
include Modules.gmk
+ include CopyFiles.gmk
+
################################################################################
# If this is an imported module that has prebuilt classes, only compile
# module-info.java.
ifneq ($(IMPORT_MODULES_CLASSES), )
IMPORT_MODULE_DIR := $(IMPORT_MODULES_CLASSES)/$(MODULE)
endif
################################################################################
# Setup the main compilation
+ COMPILATION_OUTPUTDIR := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules)
+
$(eval $(call SetupJavaCompilation, $(MODULE), \
SMALL_JAVA := false, \
MODULE := $(MODULE), \
SRC := $(wildcard $(MODULE_SRC_DIRS)), \
INCLUDES := $(JDK_USER_DEFINED_FILTER), \
FAIL_NO_SRC := $(FAIL_NO_SRC), \
- BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
+ BIN := $(COMPILATION_OUTPUTDIR), \
HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
CREATE_API_DIGEST := true, \
CLEAN := $(CLEAN), \
CLEAN_FILES := $(CLEAN_FILES), \
COPY := $(COPY), \
--system none, \
))
TARGETS += $($(MODULE))
+ ################################################################################
+ # Setup compilation for value classes in the module
+ # TBD: When $(DOCLINT) was included there was an NPE in JavacTypes.getOverriddenMethods
+
+ # Directory and file name suffix for jar file containing value classes
+ VALUECLASSES_STR := valueclasses
+
+ ifneq ($(COMPILER), bootjdk)
+ MODULE_VALUECLASS_SRC_DIRS := $(call FindModuleValueClassSrcDirs, $(MODULE))
+ MODULE_VALUECLASS_SOURCEPATH := $(call GetModuleValueClassSrcPath)
+
+ # Temporarily compile valueclasses into a separate directory with the form:
+ # <tempdir>/<module>/<classpath>
+ # and then copy the class files into:
+ # <outdir>/<module>/META-INF/preview/<classpath>
+ # We cannot compile directly into the desired directory because it's the
+ # compiler which creates the original '<module>/<classpath>/...' hierarchy.
+ VALUECLASS_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/$(VALUECLASSES_STR)
+ PREVIEW_OUTPUTDIR := $(COMPILATION_OUTPUTDIR)/$(MODULE)/META-INF/preview
+
+ ifneq ($(MODULE_VALUECLASS_SRC_DIRS),)
+ $(eval $(call SetupJavaCompilation, $(MODULE)-$(VALUECLASSES_STR), \
+ SMALL_JAVA := false, \
+ MODULE := $(MODULE), \
+ SRC := $(wildcard $(MODULE_VALUECLASS_SRC_DIRS)), \
+ INCLUDES := $(JDK_USER_DEFINED_FILTER), \
+ FAIL_NO_SRC := $(FAIL_NO_SRC), \
+ BIN := $(VALUECLASS_OUTPUTDIR)/, \
+ JAR := $(JDK_OUTPUTDIR)/lib/$(VALUECLASSES_STR)/$(MODULE)-$(VALUECLASSES_STR).jar, \
+ HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
+ DISABLED_WARNINGS := $(DISABLED_WARNINGS_java) preview, \
+ EXCLUDES := $(EXCLUDES), \
+ EXCLUDE_FILES := $(EXCLUDE_FILES) \
+ KEEP_ALL_TRANSLATIONS := $(KEEP_ALL_TRANSLATIONS), \
+ DEPENDS := $($(MODULE)), \
+ JAVAC_FLAGS := \
+ $(JAVAC_FLAGS) \
+ --module-source-path $(MODULE_VALUECLASS_SOURCEPATH) \
+ --module-path $(JDK_OUTPUTDIR)/modules \
+ --system none \
+ --enable-preview -source $(JDK_SOURCE_TARGET_VERSION), \
+ ))
+
+ TARGETS += $($(MODULE)-$(VALUECLASSES_STR))
+
+ # Restructure the value class hierarchy from "<module>/<classpath>/..."
+ # to "<module>/META-INF/preview/<classpath>/..."
+ # When module patching is removed, this could probably be a move rather than a copy.
+
+ # FIXME: The marker file should probably go in modules root dir.
+ # FIXME: Copying value classes should not also copy marker files.
+ $(PREVIEW_OUTPUTDIR)/_the.copy_valueclasses.marker: $($(MODULE)-$(VALUECLASSES_STR))
+ $(call MakeTargetDir)
+ $(CP) -R $(VALUECLASS_OUTPUTDIR)/$(MODULE)/. $(@D)/
+ $(TOUCH) $@
+
+ TARGETS += $(PREVIEW_OUTPUTDIR)/_the.copy_valueclasses.marker
+
+ $(eval $(call SetupCopyFiles, $(MODULE)-copy-valueclass-jar, \
+ FILES := $(JDK_OUTPUTDIR)/lib/$(VALUECLASSES_STR)/$(MODULE)-$(VALUECLASSES_STR).jar, \
+ DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/$(VALUECLASSES_STR), \
+ ))
+
+ TARGETS += $($(MODULE)-copy-valueclass-jar)
+ endif
+ endif
+
# Declare dependencies between java compilations of different modules.
# Since the other modules are declared in different invocations of this file,
# use the macro to find the correct target file to depend on.
# Only the javac compilation actually depends on other modules so limit
# dependency declaration to that by using the *_MODFILELIST variable.
< prev index next >