make/CreateJmods.gmk
changeset 41874 07c3c4f1eb63
parent 41532 76dffc133464
child 42517 d3485deb09eb
child 42505 11439b0c0792
equal deleted inserted replaced
41873:dc31fca4f71d 41874:07c3c4f1eb63
    34 endif
    34 endif
    35 
    35 
    36 ################################################################################
    36 ################################################################################
    37 
    37 
    38 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
    38 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
       
    39 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
    39 
    40 
    40 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    41 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    41     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
    42     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
    42 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    43 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    43     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
    44     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
    79 endif
    80 endif
    80 
    81 
    81 # Add dependencies on other jmod files. Only java.base needs access to other
    82 # Add dependencies on other jmod files. Only java.base needs access to other
    82 # jmods.
    83 # jmods.
    83 ifeq ($(MODULE), java.base)
    84 ifeq ($(MODULE), java.base)
    84   ALL_UPGRADEABLE_MODULES = $(call FindAllUpgradeableModules)
       
    85   # When creating a BUILDJDK, we don't need to add hashes to java.base
    85   # When creating a BUILDJDK, we don't need to add hashes to java.base
    86   ifneq ($(CREATING_BUILDJDK), true)
    86   ifneq ($(CREATING_BUILDJDK), true)
    87     DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
    87     # When creating interim versions of jmods, skip hashes
    88         $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
    88     ifneq ($(INTERIM_JMOD), true)
       
    89       ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
       
    90       DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
       
    91           $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
    89 
    92 
    90     EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES))))
    93       EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES))))
    91 
    94 
    92     JMOD_FLAGS += --module-path $(JMODS_DIR) \
    95       JMOD_FLAGS += --module-path $(JMODS_DIR) \
    93         --hash-modules '^(?!$(EXCLUDE_PATTERN))'
    96           --hash-modules '^(?!$(EXCLUDE_PATTERN))'
       
    97     endif
    94   endif
    98   endif
    95 endif
    99 endif
    96 
   100 
    97 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
   101 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
    98 # The variable JMOD_CMD could contain an environment variable assignment before
   102 # The variable JMOD_CMD could contain an environment variable assignment before
   100 DEPS += $(wildcard $(JMOD_CMD))
   104 DEPS += $(wildcard $(JMOD_CMD))
   101 ifeq ($(EXTERNAL_BUILDJDK), false)
   105 ifeq ($(EXTERNAL_BUILDJDK), false)
   102   DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
   106   DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
   103 endif
   107 endif
   104 
   108 
       
   109 # If creating interim versions of jmods, certain files need to be filtered out
       
   110 # to avoid false incremental rebuilds.
       
   111 ifeq ($(INTERIM_JMOD), true)
       
   112   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
       
   113 endif
       
   114 
   105 # TODO: What about headers?
   115 # TODO: What about headers?
   106 # Create jmods in a temp dir and then move them into place to keep the
   116 # Create jmods in a temp dir and then move them into place to keep the
   107 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
   117 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
   108 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
   118 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
   109 	$(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
   119 	$(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
   110 	$(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/jmods)
   120 	$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
   111 	$(RM) $@ $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
   121 	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
   112 	$(JMOD) create \
   122 	$(JMOD) create \
   113             --module-version $(VERSION_SHORT) \
   123             --module-version $(VERSION_SHORT) \
   114             --os-name $(REQUIRED_OS_NAME) \
   124             --os-name $(REQUIRED_OS_NAME) \
   115             --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
   125             --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
   116             --os-version $(REQUIRED_OS_VERSION) \
   126             --os-version $(REQUIRED_OS_VERSION) \
   117             --module-path $(JMODS_DIR) \
   127             --module-path $(JMODS_DIR) \
   118 	    --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
   128 	    --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
   119 	    $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
   129 	    $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@)
   120 	$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
   130 	$(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
   121 
   131 
   122 TARGETS += $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod
   132 TARGETS += $(JMODS_DIR)/$(MODULE).jmod
   123 
   133 
   124 ################################################################################
   134 ################################################################################
   125 
   135 
   126 all: $(TARGETS)
   136 all: $(TARGETS)
   127 
   137