From 09d92134888a7d23569c63987bddb74bb1ac2b32 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Fri, 16 Jan 2015 12:02:41 +0000 Subject: [PATCH] 8069164: Fix langtools make build so that diagnostic framework can be used Fix race condition between gensrc targets and output location of parseproperties task Reviewed-by: erikj, jlahoda --- langtools/make/Tools.gmk | 1 + langtools/make/gensrc/Gensrc-jdk.compiler.gmk | 10 +++++----- langtools/make/gensrc/GensrcCommon.gmk | 19 ++++++++++--------- .../sun/tools/javac/comp/DeferredAttr.java | 4 +++- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/langtools/make/Tools.gmk b/langtools/make/Tools.gmk index ea2452387cc..d6fae56280d 100644 --- a/langtools/make/Tools.gmk +++ b/langtools/make/Tools.gmk @@ -40,6 +40,7 @@ $(eval $(call SetupJavaCompilation,BUILD_TOOLS_LANGTOOLS, \ 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) diff --git a/langtools/make/gensrc/Gensrc-jdk.compiler.gmk b/langtools/make/gensrc/Gensrc-jdk.compiler.gmk index 04a0479fad7..0caef1da1ae 100644 --- a/langtools/make/gensrc/Gensrc-jdk.compiler.gmk +++ b/langtools/make/gensrc/Gensrc-jdk.compiler.gmk @@ -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) diff --git a/langtools/make/gensrc/GensrcCommon.gmk b/langtools/make/gensrc/GensrcCommon.gmk index 0b38117030c..adf934aae0f 100644 --- a/langtools/make/gensrc/GensrcCommon.gmk +++ b/langtools/make/gensrc/GensrcCommon.gmk @@ -63,7 +63,8 @@ endef # 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//share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties # to .../langtools/gensrc//com/sun/tools/javac/resources/javac_zh_CN.java @@ -74,7 +75,7 @@ define SetupCompileProperties $$(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 @@ define SetupCompileProperties # 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 @@ endef # 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 @@ define SetupParseProperties 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) $$@ diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index d2dc52167c4..2fb3b0fe757 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -28,6 +28,8 @@ package com.sun.tools.javac.comp; 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 @@ public class DeferredAttr extends JCTree.Visitor { 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: