49 # root. 50 define SetupVersionProperties 51 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2): 52 $(MKDIR) -p $$(@D) 53 $(PRINTF) "jdk=$(VERSION_NUMBER)\nfull=$(VERSION_STRING)\nrelease=$(VERSION_SHORT)\n" \ 54 > $$@ 55 56 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2) 57 endef 58 59 ################################################################################ 60 # Finds all properties files in the module source and creates a rule that runs 61 # CompileProperties on them into the gensrc dir. 62 # Param 1 - Variable to add targets to 63 # Param 2 - Extra properties files to process 64 define SetupCompileProperties 65 # Lookup the properties that need to be compiled into resource bundles. 66 PROPSOURCES := $2 \ 67 $$(shell $(FIND) $(TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") 68 69 # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties 70 # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java 71 # Strip away prefix and suffix, leaving for example only: 72 # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" 73 PROPJAVAS := $$(patsubst $(TOPDIR)/src/%, \ 74 $(SUPPORT_OUTPUTDIR)/gensrc/%, \ 75 $$(patsubst %.properties, %.java, \ 76 $$(subst /share/classes,, $$(PROPSOURCES)))) 77 78 # Generate the package dirs for the to be generated java files. Sort to remove 79 # duplicates. 80 PROPDIRS := $$(sort $$(dir $$(PROPJAVAS))) 81 82 # Now generate a sequence of: 83 # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" 84 # suitable to be fed into the CompileProperties command. 85 PROPCMDLINE := $$(subst _SPACE_, $(SPACE), \ 86 $$(join $$(addprefix -compile_SPACE_, $$(PROPSOURCES)), \ 87 $$(addsuffix _SPACE_java.util.ListResourceBundle, \ 88 $$(addprefix _SPACE_, $$(PROPJAVAS))))) 89 90 # Now setup the rule for the generation of the resource bundles. 91 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES) 92 $(MKDIR) -p $$(@D) $$(PROPDIRS) 93 $(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE) 94 $(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE) 95 $(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE) 96 $(TOUCH) $$@ 97 98 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props 99 endef 100 101 ################################################################################ 102 # Parse property files in given location and generate a Java-like enum in the gensrc folder. 103 # Param 1 - Variable to add targets to 104 # Param 2 - Extra properties files to process 105 define SetupParseProperties 106 # property files to process 107 PARSEPROPSOURCES := $$(addprefix $(TOPDIR)/src/$(MODULE)/share/classes/, $2) 108 109 PARSEPROPALLDIRS := $$(patsubst $(TOPDIR)/src/$(MODULE)/share/classes/%, \ 110 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \ 111 $$(dir $$(PARSEPROPSOURCES))) 112 113 PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS)) 114 115 PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \ 116 $$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \ 117 $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS)))) 118 119 # Now setup the rule for the generation of the resource bundles. 120 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES) 121 $(MKDIR) -p $$(@D) $$(PARSEPROPDIRS) 122 $(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE) 123 $(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE) 124 $(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE) 125 $(TOUCH) $$@ 126 127 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props | 49 # root. 50 define SetupVersionProperties 51 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2): 52 $(MKDIR) -p $$(@D) 53 $(PRINTF) "jdk=$(VERSION_NUMBER)\nfull=$(VERSION_STRING)\nrelease=$(VERSION_SHORT)\n" \ 54 > $$@ 55 56 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2) 57 endef 58 59 ################################################################################ 60 # Finds all properties files in the module source and creates a rule that runs 61 # CompileProperties on them into the gensrc dir. 62 # Param 1 - Variable to add targets to 63 # Param 2 - Extra properties files to process 64 define SetupCompileProperties 65 # Lookup the properties that need to be compiled into resource bundles. 66 PROPSOURCES := $2 \ 67 $$(shell $(FIND) $(TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") 68 69 # Filter out any excluded translations 70 PROPSOURCES := $$(call FilterExcludedTranslations, $$(PROPSOURCES), .properties) 71 72 # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties 73 # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java 74 # Strip away prefix and suffix, leaving for example only: 75 # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" 76 PROPJAVAS := $$(patsubst $(TOPDIR)/src/%, \ 77 $(SUPPORT_OUTPUTDIR)/gensrc/%, \ 78 $$(patsubst %.properties, %.java, \ 79 $$(subst /share/classes,, $$(PROPSOURCES)))) 80 81 # Generate the package dirs for the to be generated java files. Sort to remove 82 # duplicates. 83 PROPDIRS := $$(sort $$(dir $$(PROPJAVAS))) 84 85 # Now generate a sequence of: 86 # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" 87 # suitable to be fed into the CompileProperties command. 88 PROPCMDLINE := $$(subst _SPACE_, $(SPACE), \ 89 $$(join $$(addprefix -compile_SPACE_, $$(PROPSOURCES)), \ 90 $$(addsuffix _SPACE_java.util.ListResourceBundle, \ 91 $$(addprefix _SPACE_, $$(PROPJAVAS))))) 92 93 # Now setup the rule for the generation of the resource bundles. 94 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES) 95 $(MKDIR) -p $$(@D) $$(PROPDIRS) 96 $(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE) 97 $(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE) 98 $(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE) 99 $(TOUCH) $$@ 100 101 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props 102 endef 103 104 ################################################################################ 105 # Parse property files in given location and generate a Java-like enum in the gensrc folder. 106 # Param 1 - Variable to add targets to 107 # Param 2 - Extra properties files to process 108 define SetupParseProperties 109 # property files to process 110 PARSEPROPSOURCES := $$(addprefix $(TOPDIR)/src/$(MODULE)/share/classes/, $2) 111 PARSEPROPSOURCES := $$(call FilterExcludedTranslations, $$(PARSEPROPSOURCES), .properties) 112 113 PARSEPROPALLDIRS := $$(patsubst $(TOPDIR)/src/$(MODULE)/share/classes/%, \ 114 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \ 115 $$(dir $$(PARSEPROPSOURCES))) 116 117 PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS)) 118 119 PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \ 120 $$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \ 121 $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS)))) 122 123 # Now setup the rule for the generation of the resource bundles. 124 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES) 125 $(MKDIR) -p $$(@D) $$(PARSEPROPDIRS) 126 $(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE) 127 $(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE) 128 $(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE) 129 $(TOUCH) $$@ 130 131 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props |