提交 011a74e0 编写于 作者: I ihse

8142383: Use named arguments for SetupCompileProperties in jdk

Reviewed-by: erikj
上级 6b43385c
# #
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -38,15 +38,15 @@ include GensrcExceptions.gmk ...@@ -38,15 +38,15 @@ include GensrcExceptions.gmk
include GensrcProperties.gmk include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,LIST_RESOURCE_BUNDLE, \ $(eval $(call SetupCompileProperties, LIST_RESOURCE_BUNDLE, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/classes/sun/launcher/resources, \
$(call CacheFind, $(JDK_TOPDIR)/src/java.base/share/classes/sun/launcher/resources)), \ CLASS := ListResourceBundle, \
ListResourceBundle)) ))
$(eval $(call SetupCompileProperties,SUN_UTIL, \ $(eval $(call SetupCompileProperties, SUN_UTIL, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources, \
$(call CacheFind, $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources)), \ CLASS := sun.util.resources.LocaleNamesBundle, \
sun.util.resources.LocaleNamesBundle)) ))
GENSRC_JAVA_BASE += $(LIST_RESOURCE_BUNDLE) $(SUN_UTIL) GENSRC_JAVA_BASE += $(LIST_RESOURCE_BUNDLE) $(SUN_UTIL)
......
# #
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -66,11 +66,11 @@ else ...@@ -66,11 +66,11 @@ else
PROP_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources PROP_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources
endif endif
PROP_SRC_FILES := $(filter-out %cursors.properties, \ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
$(filter %.properties, $(call CacheFind, $(PROP_SRC_DIRS)))) SRC_DIRS := $(PROP_SRC_DIRS), \
EXCLUDE := %cursors.properties, \
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \ CLASS := ListResourceBundle, \
$(PROP_SRC_FILES), ListResourceBundle)) ))
GENSRC_JAVA_DESKTOP += $(COMPILE_PROPERTIES) GENSRC_JAVA_DESKTOP += $(COMPILE_PROPERTIES)
......
# #
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -29,10 +29,10 @@ include GensrcCommon.gmk ...@@ -29,10 +29,10 @@ include GensrcCommon.gmk
include GensrcProperties.gmk include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/java.logging/share/classes/sun/util/logging/resources, \
$(call CacheFind, $(JDK_TOPDIR)/src/java.logging/share/classes/sun/util/logging/resources)), \ CLASS := ListResourceBundle, \
ListResourceBundle)) ))
TARGETS += $(COMPILE_PROPERTIES) TARGETS += $(COMPILE_PROPERTIES)
......
# #
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -32,10 +32,10 @@ $(eval $(call IncludeCustomExtension, jdk, gensrc/Gensrc-java.management.gmk)) ...@@ -32,10 +32,10 @@ $(eval $(call IncludeCustomExtension, jdk, gensrc/Gensrc-java.management.gmk))
include GensrcProperties.gmk include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources, \
$(call CacheFind, $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources)), \ CLASS := ListResourceBundle, \
ListResourceBundle)) ))
TARGETS += $(COMPILE_PROPERTIES) TARGETS += $(COMPILE_PROPERTIES)
......
# #
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -29,11 +29,10 @@ include GensrcCommon.gmk ...@@ -29,11 +29,10 @@ include GensrcCommon.gmk
include GensrcProperties.gmk include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources, \
$(call CacheFind, \ CLASS := ListResourceBundle, \
$(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources)), \ ))
ListResourceBundle))
TARGETS += $(COMPILE_PROPERTIES) TARGETS += $(COMPILE_PROPERTIES)
......
...@@ -29,11 +29,10 @@ include GensrcCommon.gmk ...@@ -29,11 +29,10 @@ include GensrcCommon.gmk
include GensrcProperties.gmk include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/jdk.jartool/share/classes/sun/tools/jar/resources, \
$(call CacheFind, \ CLASS := ListResourceBundle, \
$(JDK_TOPDIR)/src/jdk.jartool/share/classes/sun/tools/jar/resources)), \ ))
ListResourceBundle))
TARGETS += $(COMPILE_PROPERTIES) TARGETS += $(COMPILE_PROPERTIES)
......
# #
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -34,7 +34,7 @@ HEADER_FILE := $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h ...@@ -34,7 +34,7 @@ HEADER_FILE := $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
JAVA_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java JAVA_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java
# Both the header and java file are created using the same recipe. By declaring # Both the header and java file are created using the same recipe. By declaring
# this rule and adding header file to dependencies for java file, both are # this rule and adding header file to dependencies for java file, both are
# rebuilt if either is missing # rebuilt if either is missing
$(HEADER_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) $(HEADER_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
...@@ -90,10 +90,10 @@ endif ...@@ -90,10 +90,10 @@ endif
include GensrcProperties.gmk include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources, \
$(call CacheFind, $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources)), \ CLASS := ListResourceBundle, \
ListResourceBundle)) ))
GENSRC_JDK_JDI += $(COMPILE_PROPERTIES) GENSRC_JDK_JDI += $(COMPILE_PROPERTIES)
......
# #
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -35,10 +35,10 @@ include GensrcCLDR.gmk ...@@ -35,10 +35,10 @@ include GensrcCLDR.gmk
include GensrcProperties.gmk include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
$(filter %.properties, \ SRC_DIRS := $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources, \
$(call CacheFind, $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources)), \ CLASS := sun.util.resources.LocaleNamesBundle, \
sun.util.resources.LocaleNamesBundle)) ))
# Skip generating zh_HK from zh_TW for this module. # Skip generating zh_HK from zh_TW for this module.
GENSRC_JDK_LOCALEDATA += $(filter-out %_zh_HK.java, $(COMPILE_PROPERTIES)) GENSRC_JDK_LOCALEDATA += $(filter-out %_zh_HK.java, $(COMPILE_PROPERTIES))
......
# #
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -49,30 +49,40 @@ define SetupCopy-zh_HK ...@@ -49,30 +49,40 @@ define SetupCopy-zh_HK
endef endef
################################################################################ ################################################################################
# Creates a rule that runs CompileProperties on a set of properties files. # Setup make rules that runs CompileProperties on a set of properties files.
# Param 1 - Variable to add targets to, must not contain space #
# Param 2 - Properties files to process # Parameter 1 is the name of the rule. This name is used as variable prefix,
# Param 3 - The super class for the generated classes # and the targets generated are listed in a variable by that name.
# Param 4 - Module path root, defaults to $(JDK_TOPDIR)/src #
define SetupCompileProperties # Remaining parameters are named arguments. These include:
$1_SRCS := $2 # SRC_DIRS Directories containing properties files to process.
$1_CLASS := $3 # EXCLUDE Exclude files matching this pattern.
$1_MODULE_PATH_ROOT := $4 # CLASS The super class for the generated classes.
# MODULE_PATH_ROOT Module path root, defaults to $(JDK_TOPDIR)/src.
SetupCompileProperties = $(NamedParamsMacroTemplate)
define SetupCompilePropertiesBody
# Set default value unless overridden
ifeq ($$($1_MODULE_PATH_ROOT), ) ifeq ($$($1_MODULE_PATH_ROOT), )
$1_MODULE_PATH_ROOT := $(JDK_TOPDIR)/src $1_MODULE_PATH_ROOT := $(JDK_TOPDIR)/src
endif endif
# Locate all properties files in the given source dirs.
$1_SRC_FILES := $$(filter %.properties, $$(call CacheFind, $$($1_SRC_DIRS)))
ifneq ($$($1_EXCLUDE), )
$1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
endif
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
# to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
# Strip away prefix and suffix, leaving for example only: # Strip away prefix and suffix, leaving for example only:
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
$1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \ $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
$(SUPPORT_OUTPUTDIR)/gensrc/%, \ $(SUPPORT_OUTPUTDIR)/gensrc/%, \
$$(patsubst %.properties, %.java, \ $$(patsubst %.properties, %.java, \
$$(subst /$(OPENJDK_TARGET_OS)/classes,, \ $$(subst /$(OPENJDK_TARGET_OS)/classes,, \
$$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \ $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \
$$(subst /share/classes,, $$($1_SRCS)))))) $$(subst /share/classes,, $$($1_SRC_FILES))))))
# Generate the package dirs for the to be generated java files. Sort to remove # Generate the package dirs for the to be generated java files. Sort to remove
# duplicates. # duplicates.
...@@ -82,22 +92,22 @@ define SetupCompileProperties ...@@ -82,22 +92,22 @@ define SetupCompileProperties
# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
# suitable to be fed into the CompileProperties command. # suitable to be fed into the CompileProperties command.
$1_CMDLINE := $$(subst _SPACE_, $(SPACE), \ $1_CMDLINE := $$(subst _SPACE_, $(SPACE), \
$$(join $$(addprefix -compile_SPACE_, $$($1_SRCS)), \ $$(join $$(addprefix -compile_SPACE_, $$($1_SRC_FILES)), \
$$(addsuffix _SPACE_$$($1_CLASS), \ $$(addsuffix _SPACE_$$($1_CLASS), \
$$(addprefix _SPACE_, $$($1_JAVAS))))) $$(addprefix _SPACE_, $$($1_JAVAS)))))
$1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker
$1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
# Now setup the rule for the generation of the resource bundles. # Now setup the rule for the generation of the resource bundles.
$$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK) $$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $$(@D) $$($1_DIRS) $(MKDIR) -p $$(@D) $$($1_DIRS)
$(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE) $(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE))) $$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE) $(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
$(TOUCH) $$@ $(TOUCH) $$@
$$($1_JAVAS): $$($1_SRCS) $$($1_JAVAS): $$($1_SRC_FILES)
# Create zh_HK versions of all zh_TW files created above # Create zh_HK versions of all zh_TW files created above
$$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS)))) $$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS))))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册