8069164: Fix langtools make build so that diagnostic framework can be used
Summary: Fix race condition between gensrc targets and output location of parseproperties task
Reviewed-by: erikj, jlahoda
Contributed-by: erik.joelsson@oracle.com
--- a/langtools/make/Tools.gmk Thu Jan 15 16:24:25 2015 +0000
+++ b/langtools/make/Tools.gmk Fri Jan 16 12:02:41 2015 +0000
@@ -40,6 +40,7 @@
ADD_JAVAC_FLAGS := -Xprefer:source, \
SRC := $(LANGTOOLS_TOPDIR)/make/tools, \
INCLUDES := compileproperties propertiesparser, \
+ COPY := .properties, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes))
all: $(BUILD_TOOLS_LANGTOOLS)
--- a/langtools/make/gensrc/Gensrc-jdk.compiler.gmk Thu Jan 15 16:24:25 2015 +0000
+++ b/langtools/make/gensrc/Gensrc-jdk.compiler.gmk Fri Jan 16 12:02:41 2015 +0000
@@ -25,19 +25,19 @@
include GensrcCommon.gmk
-$(eval $(call SetupVersionProperties,JAVAC_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAC_VERSION, \
com/sun/tools/javac/resources/version.properties))
-$(eval $(call SetupVersionProperties,JAVAH_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAH_VERSION, \
com/sun/tools/javah/resources/version.properties))
-$(eval $(call SetupVersionProperties,JAVAP_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAP_VERSION, \
com/sun/tools/javap/resources/version.properties))
-$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES,\
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
$(JAVAC_VERSION) $(JAVAH_VERSION) $(JAVAP_VERSION)))
-$(eval $(call SetupParseProperties,PARSE_PROPERTIES,\
+$(eval $(call SetupParseProperties,PARSE_PROPERTIES, \
com/sun/tools/javac/resources/compiler.properties))
all: $(COMPILE_PROPERTIES) $(PARSE_PROPERTIES)
--- a/langtools/make/gensrc/GensrcCommon.gmk Thu Jan 15 16:24:25 2015 +0000
+++ b/langtools/make/gensrc/GensrcCommon.gmk Fri Jan 16 12:02:41 2015 +0000
@@ -63,7 +63,8 @@
# Param 2 - Extra properties files to process
define SetupCompileProperties
# Lookup the properties that need to be compiled into resource bundles.
- PROPSOURCES := $2 $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
+ PROPSOURCES := $2 \
+ $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
# to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
@@ -74,7 +75,7 @@
$$(patsubst %.properties, %.java, \
$$(subst /share/classes,, $$(PROPSOURCES))))
- # Generate the package dirs for the tobe generated java files. Sort to remove
+ # Generate the package dirs for the to be generated java files. Sort to remove
# duplicates.
PROPDIRS := $$(sort $$(dir $$(PROPJAVAS)))
@@ -88,8 +89,8 @@
# Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
- $(FIND) $$(@D) -name "*.java" $(FIND_DELETE)
$(MKDIR) -p $$(@D) $$(PROPDIRS)
+ $(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
$(TOUCH) $$@
@@ -102,11 +103,11 @@
# Param 1 - Variable to add targets to
# Param 2 - Extra properties files to process
define SetupParseProperties
- #property file to generate
- PARSEPROPSOURCES := $$(foreach var,$2,$$(addsuffix $$(var),$(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/))
+ # property files to process
+ PARSEPROPSOURCES := $$(addprefix $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/, $2)
- PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \
- $(SUPPORT_OUTPUTDIR)/gensrc/%, \
+ PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/%, \
+ $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \
$$(dir $$(PARSEPROPSOURCES)))
PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS))
@@ -114,11 +115,11 @@
PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \
$$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \
$$(addprefix _SPACE_, $$(PARSEPROPALLDIRS))))
-
+
# Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $(PARSEPROPSOURCES)
- $(CP) -r $(LANGTOOLS_TOPDIR)/make/tools/propertiesparser/resources $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes/propertiesparser/resources
$(MKDIR) -p $$(@D) $$(PARSEPROPDIRS)
+ $(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)
$(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE)
$(TOUCH) $$@
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Jan 15 16:24:25 2015 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Fri Jan 16 12:02:41 2015 +0000
@@ -28,6 +28,8 @@
import com.sun.source.tree.LambdaExpressionTree.BodyKind;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.comp.Resolve.ResolveError;
+import com.sun.tools.javac.resources.CompilerProperties;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.DefinedBy.Api;
@@ -796,7 +798,7 @@
case WRONG_MTHS:
//note: as argtypes are erroneous types, type-errors must
//have been caused by arity mismatch
- checkContext.report(tree, diags.fragment("incompatible.arg.types.in.mref"));
+ checkContext.report(tree, diags.fragment(Fragments.IncompatibleArgTypesInMref));
break;
case ABSENT_MTH:
case STATICERR: