< prev index next >

make/GensrcModuleInfo.gmk

Print this page




  32 # declarations added to them. These optional extras are defined in .extra files:
  33 #
  34 # src/<module>/<share,platform>/classes/module-info.java.extra
  35 #
  36 # The contents of the .extra files are simply extra lines that could fit into
  37 # the module-info file.
  38 #
  39 # This makefile is called once for each from-module with the variable
  40 # MODULE naming the from-module.
  41 #
  42 # The modified module-info.java files are put in the gensrc directory where
  43 # they will automatically override the static versions in the src tree.
  44 #
  45 ################################################################################
  46 
  47 default: all
  48 
  49 include $(SPEC)
  50 include MakeBase.gmk
  51 include Modules.gmk
  52 #include TextFileProcessing.gmk
  53 
  54 ################################################################################
  55 # Define this here since jdk/make/Tools.gmk cannot be included from the top
  56 # make directory. Should probably move some tools away from the jdk repo.
  57 TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) \
  58     $(INTERIM_LANGTOOLS_ARGS) \
  59     -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes" \
  60     build.tools.module.GenModuleInfoSource
  61 
  62 ################################################################################
  63 
  64 # Name of data file. Keep module-info.java.ext until javafx has changed.
  65 MOD_FILENAME := module-info.java.extra module-info.java.ext
  66 
  67 # List all the possible sub directories inside a module source directory where
  68 # data might be stored.
  69 CLASSES_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
  70 ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
  71   CLASSES_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
  72 endif
  73 CLASSES_SUBDIRS += share/classes
  74 
  75 # TODO: When the deploy build is better integrated, this will get added globally
  76 # but for now need to add it here.
  77 ifeq ($(BUILD_DEPLOY), true)
  78   ALL_TOP_SRC_DIRS += $(DEPLOY_TOPDIR)/src
  79 endif
  80 
  81 # Construct all possible src directories for the module.
  82 MODULE_CLASSES_DIRS := $(strip \
  83     $(foreach sub, $(CLASSES_SUBDIRS), \
  84         $(addsuffix /$(MODULE)/$(sub), $(ALL_TOP_SRC_DIRS))) \
  85     $(addsuffix /$(MODULE), $(IMPORT_MODULES_SRC)))
  86 
  87 # Find all the .extra files in the src dirs.
  88 MOD_FILES := $(wildcard $(foreach f, $(MOD_FILENAME), $(addsuffix /$(f), \
  89     $(MODULE_CLASSES_DIRS))))
  90 
  91 ifneq ($(MOD_FILES), )
  92   # Only make this call if modification files are found for this module
  93   ALL_MODULES := $(call FindAllModules)
  94 
  95   # Read the contents of all the files into a variable. Replace space with / to
  96   # let space represent new lines in the variable as $(shell) normalizes all
  97   # whitespace.
  98   $(foreach f, $(MOD_FILES), \
  99     $(eval MOD_FILE_CONTENTS += $(shell $(GREP) -v ".\*" $f | $(TR) ' ' '/')))
 100 
 101   # Filter the contents for modules that are actually being built
 102   MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES)))
 103   MODULES_FILTER += provides%
 104   MODIFICATIONS := $(filter $(MODULES_FILTER), $(MOD_FILE_CONTENTS))
 105 


 108   $(foreach line, $(MODIFICATIONS), \
 109     $(eval split_line := $(subst /,$(SPACE),$(line))) \
 110     $(eval command := $(word 1, $(split_line))) \
 111     $(eval package := $(word 2, $(split_line))) \
 112     $(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \
 113     $(eval ARGS += -$(command) $(package)/$(to_module)))
 114 
 115   ifneq ($(ARGS), )
 116     $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java: \
 117         $(firstword $(call FindAllModuleInfos, $(MODULE))) \
 118         $(BUILD_TOOLS_JDK) \
 119         $(call DependOnVariable, ARGS)
 120                 $(MKDIR) -p $(@D)
 121                 $(RM) $@ $@.tmp
 122                 $(TOOL_GENMODULEINFOSOURCE) $(ARGS) -o $@.tmp $<
 123                 $(MV) $@.tmp $@
 124 
 125     TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java
 126   endif
 127 
 128 # This doesn't work because javac only accepts one single exports line per
 129 # exported package.
 130   # Restore the modifications to separate lines with spaces
 131 #  MODIFICATIONS := $(subst /,$(SPACE),$(MODIFICATIONS))
 132 
 133 #  ifneq ($(MODIFICATIONS), )
 134 #    $(eval $(call SetupTextFileProcessing, PROCESS_MODULE_INFO, \
 135 #        SOURCE_FILES := $(firstword $(call FindAllModuleInfos, $(MODULE))), \
 136 #        OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java, \
 137 #        REPLACEMENTS := } => $(MODIFICATIONS) }, \
 138 #    ))
 139 
 140 #    TARGETS += $(PROCESS_MODULE_INFO)
 141 #  endif
 142 endif
 143 
 144 # If no modifications are found for this module, remove any module-info.java
 145 # created by a previous build since that is no longer valid.
 146 ifeq ($(MODIFICATIONS), )
 147   ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java), )
 148     $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java)
 149   endif
 150 endif
 151 
 152 ################################################################################
 153 
 154 all: $(TARGETS)


  32 # declarations added to them. These optional extras are defined in .extra files:
  33 #
  34 # src/<module>/<share,platform>/classes/module-info.java.extra
  35 #
  36 # The contents of the .extra files are simply extra lines that could fit into
  37 # the module-info file.
  38 #
  39 # This makefile is called once for each from-module with the variable
  40 # MODULE naming the from-module.
  41 #
  42 # The modified module-info.java files are put in the gensrc directory where
  43 # they will automatically override the static versions in the src tree.
  44 #
  45 ################################################################################
  46 
  47 default: all
  48 
  49 include $(SPEC)
  50 include MakeBase.gmk
  51 include Modules.gmk

  52 
  53 ################################################################################
  54 # Define this here since jdk/make/Tools.gmk cannot be included from the top
  55 # make directory. Should probably move some tools away from the jdk repo.
  56 TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) \
  57     $(INTERIM_LANGTOOLS_ARGS) \
  58     -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes" \
  59     build.tools.module.GenModuleInfoSource
  60 
  61 ################################################################################
  62 
  63 # Name of data file. Keep module-info.java.ext until javafx has changed.
  64 MOD_FILENAME := module-info.java.extra module-info.java.ext
  65 














  66 # Construct all possible src directories for the module.
  67 MODULE_CLASSES_DIRS := $(call FindModuleSrcDirs, $(MODULE))



  68 
  69 # Find all the .extra files in the src dirs.
  70 MOD_FILES := $(wildcard $(foreach f, $(MOD_FILENAME), $(addsuffix /$(f), \
  71     $(MODULE_CLASSES_DIRS))))
  72 
  73 ifneq ($(MOD_FILES), )
  74   # Only make this call if modification files are found for this module
  75   ALL_MODULES := $(call FindAllModules)
  76 
  77   # Read the contents of all the files into a variable. Replace space with / to
  78   # let space represent new lines in the variable as $(shell) normalizes all
  79   # whitespace.
  80   $(foreach f, $(MOD_FILES), \
  81     $(eval MOD_FILE_CONTENTS += $(shell $(GREP) -v ".\*" $f | $(TR) ' ' '/')))
  82 
  83   # Filter the contents for modules that are actually being built
  84   MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES)))
  85   MODULES_FILTER += provides%
  86   MODIFICATIONS := $(filter $(MODULES_FILTER), $(MOD_FILE_CONTENTS))
  87 


  90   $(foreach line, $(MODIFICATIONS), \
  91     $(eval split_line := $(subst /,$(SPACE),$(line))) \
  92     $(eval command := $(word 1, $(split_line))) \
  93     $(eval package := $(word 2, $(split_line))) \
  94     $(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \
  95     $(eval ARGS += -$(command) $(package)/$(to_module)))
  96 
  97   ifneq ($(ARGS), )
  98     $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java: \
  99         $(firstword $(call FindAllModuleInfos, $(MODULE))) \
 100         $(BUILD_TOOLS_JDK) \
 101         $(call DependOnVariable, ARGS)
 102                 $(MKDIR) -p $(@D)
 103                 $(RM) $@ $@.tmp
 104                 $(TOOL_GENMODULEINFOSOURCE) $(ARGS) -o $@.tmp $<
 105                 $(MV) $@.tmp $@
 106 
 107     TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java
 108   endif
 109 














 110 endif
 111 
 112 # If no modifications are found for this module, remove any module-info.java
 113 # created by a previous build since that is no longer valid.
 114 ifeq ($(MODIFICATIONS), )
 115   ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java), )
 116     $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java)
 117   endif
 118 endif
 119 
 120 ################################################################################
 121 
 122 all: $(TARGETS)
< prev index next >