author | gziemski |
Mon, 19 Mar 2018 13:57:08 -0500 | |
changeset 49461 | 6e9e88d82781 |
parent 47217 | 72e3ae9a25eb |
child 50590 | 5fa19bad622d |
permissions | -rw-r--r-- |
27579 | 1 |
# |
41515 | 2 |
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
27579 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
26 |
# This must be the first rule |
|
27 |
default: all |
|
28 |
||
29 |
include $(SPEC) |
|
30 |
include MakeBase.gmk |
|
31 |
include JavaCompilation.gmk |
|
32 |
||
33 |
################################################################################ |
|
34 |
# The compileprops tools compiles a properties file into a resource bundle. |
|
41253
7a2422a5b481
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
40233
diff
changeset
|
35 |
TOOL_COMPILEPROPS_CMD := $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes \ |
27579 | 36 |
compileproperties.CompileProperties -quiet |
37 |
||
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
38 |
################################################################################ |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
39 |
# The compileprops tools compiles a properties file into an enum-like class. |
41253
7a2422a5b481
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
40233
diff
changeset
|
40 |
TOOL_PARSEPROPS_CMD := $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes \ |
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
41 |
propertiesparser.PropertiesParser |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
42 |
|
27579 | 43 |
|
44 |
################################################################################ |
|
45 |
# Sets up a rule that creates a version.properties file in the gensrc output |
|
46 |
# directory. |
|
47 |
# Param 1 - Variable to add generated file name to |
|
48 |
# Param 2 - Name of version.properties file including packages from the src |
|
49 |
# root. |
|
50 |
define SetupVersionProperties |
|
51 |
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2): |
|
52 |
$(MKDIR) -p $$(@D) |
|
34070
792098bae87e
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
28458
diff
changeset
|
53 |
$(PRINTF) "jdk=$(VERSION_NUMBER)\nfull=$(VERSION_STRING)\nrelease=$(VERSION_SHORT)\n" \ |
27579 | 54 |
> $$@ |
55 |
||
56 |
$$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2) |
|
57 |
endef |
|
58 |
||
59 |
################################################################################ |
|
60 |
# Finds all properties files in the module source and creates a rule that runs |
|
61 |
# CompileProperties on them into the gensrc dir. |
|
62 |
# Param 1 - Variable to add targets to |
|
63 |
# Param 2 - Extra properties files to process |
|
64 |
define SetupCompileProperties |
|
65 |
# Lookup the properties that need to be compiled into resource bundles. |
|
28458
f20c5dd05e34
8069164: Fix langtools make build so that diagnostic framework can be used
mcimadamore
parents:
28334
diff
changeset
|
66 |
PROPSOURCES := $2 \ |
47217 | 67 |
$$(shell $(FIND) $(TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") |
27579 | 68 |
|
69 |
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties |
|
70 |
# to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java |
|
34070
792098bae87e
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
28458
diff
changeset
|
71 |
# Strip away prefix and suffix, leaving for example only: |
27579 | 72 |
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" |
47217 | 73 |
PROPJAVAS := $$(patsubst $(TOPDIR)/src/%, \ |
27579 | 74 |
$(SUPPORT_OUTPUTDIR)/gensrc/%, \ |
75 |
$$(patsubst %.properties, %.java, \ |
|
76 |
$$(subst /share/classes,, $$(PROPSOURCES)))) |
|
77 |
||
28458
f20c5dd05e34
8069164: Fix langtools make build so that diagnostic framework can be used
mcimadamore
parents:
28334
diff
changeset
|
78 |
# Generate the package dirs for the to be generated java files. Sort to remove |
27579 | 79 |
# duplicates. |
80 |
PROPDIRS := $$(sort $$(dir $$(PROPJAVAS))) |
|
81 |
||
82 |
# Now generate a sequence of: |
|
83 |
# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" |
|
84 |
# suitable to be fed into the CompileProperties command. |
|
85 |
PROPCMDLINE := $$(subst _SPACE_, $(SPACE), \ |
|
86 |
$$(join $$(addprefix -compile_SPACE_, $$(PROPSOURCES)), \ |
|
87 |
$$(addsuffix _SPACE_java.util.ListResourceBundle, \ |
|
88 |
$$(addprefix _SPACE_, $$(PROPJAVAS))))) |
|
89 |
||
90 |
# Now setup the rule for the generation of the resource bundles. |
|
91 |
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES) |
|
92 |
$(MKDIR) -p $$(@D) $$(PROPDIRS) |
|
28458
f20c5dd05e34
8069164: Fix langtools make build so that diagnostic framework can be used
mcimadamore
parents:
28334
diff
changeset
|
93 |
$(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE) |
27579 | 94 |
$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE) |
95 |
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE) |
|
96 |
$(TOUCH) $$@ |
|
97 |
||
98 |
$$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props |
|
99 |
endef |
|
100 |
||
101 |
################################################################################ |
|
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
102 |
# Parse property files in given location and generate a Java-like enum in the gensrc folder. |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
103 |
# Param 1 - Variable to add targets to |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
104 |
# Param 2 - Extra properties files to process |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
105 |
define SetupParseProperties |
28458
f20c5dd05e34
8069164: Fix langtools make build so that diagnostic framework can be used
mcimadamore
parents:
28334
diff
changeset
|
106 |
# property files to process |
47217 | 107 |
PARSEPROPSOURCES := $$(addprefix $(TOPDIR)/src/$(MODULE)/share/classes/, $2) |
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
108 |
|
47217 | 109 |
PARSEPROPALLDIRS := $$(patsubst $(TOPDIR)/src/$(MODULE)/share/classes/%, \ |
28458
f20c5dd05e34
8069164: Fix langtools make build so that diagnostic framework can be used
mcimadamore
parents:
28334
diff
changeset
|
110 |
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \ |
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
111 |
$$(dir $$(PARSEPROPSOURCES))) |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
112 |
|
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
113 |
PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS)) |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
114 |
|
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
115 |
PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \ |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
116 |
$$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \ |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
117 |
$$(addprefix _SPACE_, $$(PARSEPROPALLDIRS)))) |
28458
f20c5dd05e34
8069164: Fix langtools make build so that diagnostic framework can be used
mcimadamore
parents:
28334
diff
changeset
|
118 |
|
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
119 |
# Now setup the rule for the generation of the resource bundles. |
40233 | 120 |
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES) |
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
121 |
$(MKDIR) -p $$(@D) $$(PARSEPROPDIRS) |
28458
f20c5dd05e34
8069164: Fix langtools make build so that diagnostic framework can be used
mcimadamore
parents:
28334
diff
changeset
|
122 |
$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE) |
28334
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
123 |
$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE) |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
124 |
$(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE) |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
125 |
$(TOUCH) $$@ |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
126 |
|
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
127 |
$$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
128 |
endef |
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
129 |
|
1633de6070ae
8058542: Devise scheme for better diagnostic creation
mcimadamore
parents:
27579
diff
changeset
|
130 |
################################################################################ |