61 # CompileProperties on them into the gensrc dir. |
61 # CompileProperties on them into the gensrc dir. |
62 # Param 1 - Variable to add targets to |
62 # Param 1 - Variable to add targets to |
63 # Param 2 - Extra properties files to process |
63 # Param 2 - Extra properties files to process |
64 define SetupCompileProperties |
64 define SetupCompileProperties |
65 # Lookup the properties that need to be compiled into resource bundles. |
65 # Lookup the properties that need to be compiled into resource bundles. |
66 PROPSOURCES := $2 $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") |
66 PROPSOURCES := $2 \ |
|
67 $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") |
67 |
68 |
68 # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties |
69 # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties |
69 # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java |
70 # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java |
70 # Strip away prefix and suffix, leaving for example only: |
71 # Strip away prefix and suffix, leaving for example only: |
71 # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" |
72 # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" |
72 PROPJAVAS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \ |
73 PROPJAVAS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \ |
73 $(SUPPORT_OUTPUTDIR)/gensrc/%, \ |
74 $(SUPPORT_OUTPUTDIR)/gensrc/%, \ |
74 $$(patsubst %.properties, %.java, \ |
75 $$(patsubst %.properties, %.java, \ |
75 $$(subst /share/classes,, $$(PROPSOURCES)))) |
76 $$(subst /share/classes,, $$(PROPSOURCES)))) |
76 |
77 |
77 # Generate the package dirs for the tobe generated java files. Sort to remove |
78 # Generate the package dirs for the to be generated java files. Sort to remove |
78 # duplicates. |
79 # duplicates. |
79 PROPDIRS := $$(sort $$(dir $$(PROPJAVAS))) |
80 PROPDIRS := $$(sort $$(dir $$(PROPJAVAS))) |
80 |
81 |
81 # Now generate a sequence of: |
82 # Now generate a sequence of: |
82 # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" |
83 # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" |
86 $$(addsuffix _SPACE_java.util.ListResourceBundle, \ |
87 $$(addsuffix _SPACE_java.util.ListResourceBundle, \ |
87 $$(addprefix _SPACE_, $$(PROPJAVAS))))) |
88 $$(addprefix _SPACE_, $$(PROPJAVAS))))) |
88 |
89 |
89 # Now setup the rule for the generation of the resource bundles. |
90 # Now setup the rule for the generation of the resource bundles. |
90 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES) |
91 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES) |
91 $(FIND) $$(@D) -name "*.java" $(FIND_DELETE) |
|
92 $(MKDIR) -p $$(@D) $$(PROPDIRS) |
92 $(MKDIR) -p $$(@D) $$(PROPDIRS) |
|
93 $(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE) |
93 $(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE) |
94 $(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE) |
94 $(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE) |
95 $(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE) |
95 $(TOUCH) $$@ |
96 $(TOUCH) $$@ |
96 |
97 |
97 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props |
98 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props |
100 ################################################################################ |
101 ################################################################################ |
101 # Parse property files in given location and generate a Java-like enum in the gensrc folder. |
102 # Parse property files in given location and generate a Java-like enum in the gensrc folder. |
102 # Param 1 - Variable to add targets to |
103 # Param 1 - Variable to add targets to |
103 # Param 2 - Extra properties files to process |
104 # Param 2 - Extra properties files to process |
104 define SetupParseProperties |
105 define SetupParseProperties |
105 #property file to generate |
106 # property files to process |
106 PARSEPROPSOURCES := $$(foreach var,$2,$$(addsuffix $$(var),$(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/)) |
107 PARSEPROPSOURCES := $$(addprefix $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/, $2) |
107 |
108 |
108 PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \ |
109 PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/%, \ |
109 $(SUPPORT_OUTPUTDIR)/gensrc/%, \ |
110 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \ |
110 $$(dir $$(PARSEPROPSOURCES))) |
111 $$(dir $$(PARSEPROPSOURCES))) |
111 |
112 |
112 PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS)) |
113 PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS)) |
113 |
114 |
114 PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \ |
115 PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \ |
115 $$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \ |
116 $$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \ |
116 $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS)))) |
117 $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS)))) |
117 |
118 |
118 # Now setup the rule for the generation of the resource bundles. |
119 # Now setup the rule for the generation of the resource bundles. |
119 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $(PARSEPROPSOURCES) |
120 $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $(PARSEPROPSOURCES) |
120 $(CP) -r $(LANGTOOLS_TOPDIR)/make/tools/propertiesparser/resources $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes/propertiesparser/resources |
|
121 $(MKDIR) -p $$(@D) $$(PARSEPROPDIRS) |
121 $(MKDIR) -p $$(@D) $$(PARSEPROPDIRS) |
|
122 $(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE) |
122 $(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE) |
123 $(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE) |
123 $(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE) |
124 $(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE) |
124 $(TOUCH) $$@ |
125 $(TOUCH) $$@ |
125 |
126 |
126 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props |
127 $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props |