make/gensrc/GensrcLocaleDataMetaInfo.gmk

Print this page
rev 10560 : 8038436: Re-examine the mechanism to determine available localedata and cldrdata
Reviewed-by:


  41 # Then translate the locale files into for example: FormatData_sv
  42 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
  43 
  44 # Include the list of resources found during the previous compile.
  45 -include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
  46 
  47 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES))
  48 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES))
  49 
  50 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES))
  51   # There is a difference in the number of supported resources. Trigger a regeneration.
  52   $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java)
  53 endif
  54 
  55 # The EN locales
  56 EN_LOCALES := en%
  57 
  58 # Locales that don't have any resource files should be included here.
  59 ALL_NON_EN_LOCALES := ja-JP-JP nb-NO nn-NO th-TH-TH
  60 
  61 SED_ARGS := -e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'

  62 
  63 # This macro creates a sed expression that substitues for example:
  64 # #FormatData_ENLocales# with: en% locales.
  65 define CaptureLocale
  66   $1_LOCALES := $$(subst _,-,$$(filter-out $1, $$(subst $1_,,$$(filter $1_%, $(LOCALE_RESOURCES)))))
  67   $1_EN_LOCALES := $$(filter $(EN_LOCALES), $$($1_LOCALES))
  68   $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES), $$($1_LOCALES))
  69 
  70   # Special handling for Chinese locales to include implicit scripts
  71   $1_NON_EN_LOCALES := $$(subst zh-CN,zh-CN$$(SPACE)zh-Hans-CN, $$($1_NON_EN_LOCALES))
  72   $1_NON_EN_LOCALES := $$(subst zh-SG,zh-SG$$(SPACE)zh-Hans-SG, $$($1_NON_EN_LOCALES))
  73   $1_NON_EN_LOCALES := $$(subst zh-HK,zh-HK$$(SPACE)zh-Hant-HK, $$($1_NON_EN_LOCALES))
  74   $1_NON_EN_LOCALES := $$(subst zh-MO,zh-MO$$(SPACE)zh-Hant-MO, $$($1_NON_EN_LOCALES))
  75   $1_NON_EN_LOCALES := $$(subst zh-TW,zh-TW$$(SPACE)zh-Hant-TW, $$($1_NON_EN_LOCALES))
  76 
  77   ALL_EN_LOCALES += $$($1_EN_LOCALES)
  78   ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES)
  79 
  80   # Don't sed in a space if there are no locales.
  81   SED_ARGS += -e 's/$$(HASH)$1_ENLocales$$(HASH)/$$(if $$($1_EN_LOCALES),$$(SPACE)$$($1_EN_LOCALES),)/g'
  82   SED_ARGS += -e 's/$$(HASH)$1_NonENLocales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g'




  83 endef
  84 
  85 #sun.text.resources.FormatData
  86 $(eval $(call CaptureLocale,FormatData))
  87 
  88 #sun.text.resources.CollationData
  89 $(eval $(call CaptureLocale,CollationData))
  90 
  91 #sun.text.resources.BreakIteratorInfo
  92 $(eval $(call CaptureLocale,BreakIteratorInfo))
  93 
  94 #sun.text.resources.BreakIteratorRules
  95 $(eval $(call CaptureLocale,BreakIteratorRules))
  96 
  97 #sun.util.resources.TimeZoneNames
  98 $(eval $(call CaptureLocale,TimeZoneNames))
  99 
 100 #sun.util.resources.LocaleNames
 101 $(eval $(call CaptureLocale,LocaleNames))
 102 
 103 #sun.util.resources.CurrencyNames
 104 $(eval $(call CaptureLocale,CurrencyNames))
 105 
 106 #sun.util.resources.CalendarData
 107 $(eval $(call CaptureLocale,CalendarData))
 108 
 109 SED_ARGS += -e 's/$(HASH)AvailableLocales_ENLocales$(HASH)/$(sort $(ALL_EN_LOCALES))/g'
 110 SED_ARGS += -e 's/$(HASH)AvailableLocales_NonENLocales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g'
 111 
 112 $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/LocaleDataMetaInfo.java: \
 113     $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
 114         $(MKDIR) -p $(@D)
 115         $(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
 116         $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
 117         $(SED) $(SED_ARGS) $< > $@
 118 
 119 GENSRC_LOCALEDATAMETAINFO := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/LocaleDataMetaInfo.java








 120 
 121 ################################################################################
 122 
 123 GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java
 124 GENSRC_CRBC_CMD := $(JDK_TOPDIR)/make/scripts/localelist.sh
 125 
 126 JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
 127 
 128 $(GENSRC_CRBC_DST): $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template \
 129     $(GENSRC_CRBC_CMD)
 130         $(MKDIR) -p $(@D)
 131         NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@
 132 
 133 GENSRC_LOCALEDATAMETAINFO += $(GENSRC_CRBC_DST)
 134 GENSRC_JAVA_BASE += $(GENSRC_LOCALEDATAMETAINFO)
 135 
 136 ################################################################################


  41 # Then translate the locale files into for example: FormatData_sv
  42 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
  43 
  44 # Include the list of resources found during the previous compile.
  45 -include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
  46 
  47 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES))
  48 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES))
  49 
  50 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES))
  51   # There is a difference in the number of supported resources. Trigger a regeneration.
  52   $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java)
  53 endif
  54 
  55 # The EN locales
  56 EN_LOCALES := en%
  57 
  58 # Locales that don't have any resource files should be included here.
  59 ALL_NON_EN_LOCALES := ja-JP-JP nb-NO nn-NO th-TH-TH
  60 
  61 SED_ENARGS := -e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
  62 SED_NONENARGS := $(SED_ENARGS)
  63 
  64 # This macro creates a sed expression that substitues for example:
  65 # #FormatData_ENLocales# with: en% locales.
  66 define CaptureLocale
  67   $1_LOCALES := $$(subst _,-,$$(filter-out $1, $$(subst $1_,,$$(filter $1_%, $(LOCALE_RESOURCES)))))
  68   $1_EN_LOCALES := $$(filter $(EN_LOCALES), $$($1_LOCALES))
  69   $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES), $$($1_LOCALES))
  70 
  71   # Special handling for Chinese locales to include implicit scripts
  72   $1_NON_EN_LOCALES := $$(subst zh-CN,zh-CN$$(SPACE)zh-Hans-CN, $$($1_NON_EN_LOCALES))
  73   $1_NON_EN_LOCALES := $$(subst zh-SG,zh-SG$$(SPACE)zh-Hans-SG, $$($1_NON_EN_LOCALES))
  74   $1_NON_EN_LOCALES := $$(subst zh-HK,zh-HK$$(SPACE)zh-Hant-HK, $$($1_NON_EN_LOCALES))
  75   $1_NON_EN_LOCALES := $$(subst zh-MO,zh-MO$$(SPACE)zh-Hant-MO, $$($1_NON_EN_LOCALES))
  76   $1_NON_EN_LOCALES := $$(subst zh-TW,zh-TW$$(SPACE)zh-Hant-TW, $$($1_NON_EN_LOCALES))
  77 
  78   ALL_EN_LOCALES += $$($1_EN_LOCALES)
  79   ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES)
  80 
  81   # Don't sed in a space if there are no locales.
  82   SED_ENARGS += -e 's/$$(HASH)Lang$$(HASH)/En/' \
  83     -e 's/$$(HASH)Package$$(HASH)/sun.util.locale.provider/' \
  84     -e 's/$$(HASH)$1_Locales$$(HASH)/$$(if $$($1_EN_LOCALES),$$(SPACE)$$($1_EN_LOCALES),)/g'
  85   SED_NONENARGS += -e 's/$$(HASH)Lang$$(HASH)/NonEn/' \
  86     -e 's/$$(HASH)Package$$(HASH)/sun.util.resources.provider/' \
  87     -e 's/$$(HASH)$1_Locales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g'
  88 endef
  89 
  90 #sun.text.resources.FormatData
  91 $(eval $(call CaptureLocale,FormatData))
  92 
  93 #sun.text.resources.CollationData
  94 $(eval $(call CaptureLocale,CollationData))
  95 
  96 #sun.text.resources.BreakIteratorInfo
  97 $(eval $(call CaptureLocale,BreakIteratorInfo))
  98 
  99 #sun.text.resources.BreakIteratorRules
 100 $(eval $(call CaptureLocale,BreakIteratorRules))
 101 
 102 #sun.util.resources.TimeZoneNames
 103 $(eval $(call CaptureLocale,TimeZoneNames))
 104 
 105 #sun.util.resources.LocaleNames
 106 $(eval $(call CaptureLocale,LocaleNames))
 107 
 108 #sun.util.resources.CurrencyNames
 109 $(eval $(call CaptureLocale,CurrencyNames))
 110 
 111 #sun.util.resources.CalendarData
 112 $(eval $(call CaptureLocale,CalendarData))
 113 
 114 SED_ENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_EN_LOCALES))/g'
 115 SED_NONENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g'
 116 
 117 $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java: \
 118     $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
 119         $(MKDIR) -p $(@D)
 120         $(ECHO) Creating sun/util/locale/provider/EnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
 121         $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
 122         $(SED) $(SED_ENARGS) $< > $@
 123 
 124 $(JDK_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java: \
 125     $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
 126         $(MKDIR) -p $(@D)
 127         $(ECHO) Creating sun/util/resources/provider/NonEnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
 128         $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
 129         $(SED) $(SED_NONENARGS) $< > $@
 130 
 131 GENSRC_LOCALEDATAMETAINFO := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java \
 132     $(JDK_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java
 133 
 134 ################################################################################
 135 
 136 GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java
 137 GENSRC_CRBC_CMD := $(JDK_TOPDIR)/make/scripts/localelist.sh
 138 
 139 JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
 140 
 141 $(GENSRC_CRBC_DST): $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template \
 142     $(GENSRC_CRBC_CMD)
 143         $(MKDIR) -p $(@D)
 144         NAWK="$(NAWK)" SED="$(SED)" $(SH) $(GENSRC_CRBC_CMD) "$(JRE_NONEXIST_LOCALES)" $< $@
 145 
 146 GENSRC_LOCALEDATAMETAINFO += $(GENSRC_CRBC_DST)
 147 GENSRC_JAVA_BASE += $(GENSRC_LOCALEDATAMETAINFO)
 148 
 149 ################################################################################