8204973: Add build support for filtering translations
Reviewed-by: ihse, naoto, dfuchs
This commit is contained in:
parent
9b7a61eff1
commit
8e3570cfc2
@ -519,6 +519,7 @@ jdk.localedata_COPY += _dict _th
|
||||
# Exclude BreakIterator classes that are just used in compile process to generate
|
||||
# data files and shouldn't go in the product
|
||||
jdk.localedata_EXCLUDE_FILES += sun/text/resources/ext/BreakIteratorRules_th.java
|
||||
jdk.localedata_KEEP_ALL_TRANSLATIONS := true
|
||||
################################################################################
|
||||
|
||||
# There is an issue in sjavac that triggers a warning in jdk.jfr that isn't
|
||||
|
@ -68,6 +68,17 @@ TARGETS += $(SRC_ZIP_SRCS)
|
||||
# Only evaluate the creation of src.zip in a sub make call when the symlinked
|
||||
# src directory structure has been generated.
|
||||
ifeq ($(SRC_GENERATED), true)
|
||||
|
||||
# Rewrite the EXCLUDE_TRANSLATIONS locales as exclude patters for java files
|
||||
TRANSLATIONS_PATTERN := $(addprefix %_, $(addsuffix .java, $(EXCLUDE_TRANSLATIONS)))
|
||||
|
||||
# Add excludes for translations for all modules except jdk.localedata
|
||||
$(foreach s, $(SRC_ZIP_SRCS), \
|
||||
$(if $(filter $(notdir $s), jdk.localedata), , \
|
||||
$(eval BUILD_SRC_ZIP_EXCLUDE_PATTERNS_$(dir $s) := $$(TRANSLATIONS_PATTERN)) \
|
||||
) \
|
||||
)
|
||||
|
||||
$(eval $(call SetupZipArchive, BUILD_SRC_ZIP, \
|
||||
SRC := $(dir $(SRC_ZIP_SRCS)), \
|
||||
INCLUDES := $(SRC_ZIP_INCLUDES), \
|
||||
|
@ -232,6 +232,7 @@ HOTSPOT_SETUP_JVM_FEATURES
|
||||
JDKOPT_DETECT_INTREE_EC
|
||||
JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
|
||||
JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
|
||||
JDKOPT_EXCLUDE_TRANSLATIONS
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -582,3 +582,25 @@ AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST],
|
||||
|
||||
AC_SUBST(ENABLE_GENERATE_CLASSLIST)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Optionally filter resource translations
|
||||
#
|
||||
AC_DEFUN([JDKOPT_EXCLUDE_TRANSLATIONS],
|
||||
[
|
||||
AC_ARG_WITH([exclude-translations], [AS_HELP_STRING([--with-exclude-translations],
|
||||
[a comma separated list of locales to exclude translations for. Default is
|
||||
to include all translations present in the source.])])
|
||||
|
||||
EXCLUDE_TRANSLATIONS=""
|
||||
AC_MSG_CHECKING([if any translations should be excluded])
|
||||
if test "x$with_exclude_translations" != "x"; then
|
||||
EXCLUDE_TRANSLATIONS="${with_exclude_translations//,/ }"
|
||||
AC_MSG_RESULT([yes: $EXCLUDE_TRANSLATIONS])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_SUBST(EXCLUDE_TRANSLATIONS)
|
||||
])
|
||||
|
@ -303,6 +303,8 @@ BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
|
||||
|
||||
ENABLE_GENERATE_CLASSLIST := @ENABLE_GENERATE_CLASSLIST@
|
||||
|
||||
EXCLUDE_TRANSLATIONS := @EXCLUDE_TRANSLATIONS@
|
||||
|
||||
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
|
||||
# it in sync.
|
||||
BOOT_JDK:=@BOOT_JDK@
|
||||
|
@ -180,6 +180,7 @@ endef
|
||||
# CREATE_API_DIGEST:=Set to true to use a javac plugin to generate a public API
|
||||
# hash which can be used for down stream dependencies to only rebuild
|
||||
# when the API changes. Implicitly used in sjavac.
|
||||
# KEEP_ALL_TRANSLATIONS:=Set to true to skip translation filtering
|
||||
SetupJavaCompilation = $(NamedParamsMacroTemplate)
|
||||
define SetupJavaCompilationBody
|
||||
|
||||
@ -266,6 +267,11 @@ define SetupJavaCompilationBody
|
||||
$$(eval $1_$$(relative_src) := 1) $$(s))))
|
||||
endif
|
||||
|
||||
# Filter out any excluded translations
|
||||
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
|
||||
$1_SRCS := $$(call FilterExcludedTranslations, $$($1_SRCS), .java)
|
||||
endif
|
||||
|
||||
ifeq ($$(strip $$($1_SRCS)), )
|
||||
ifneq ($$($1_FAIL_NO_SRC), false)
|
||||
$$(error No source files found for $1)
|
||||
@ -290,6 +296,10 @@ define SetupJavaCompilationBody
|
||||
ifneq (,$$($1_EXCLUDE_PATTERN))
|
||||
$1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES))
|
||||
endif
|
||||
# Filter out any excluded translations
|
||||
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
|
||||
$1_ALL_COPIES := $$(call FilterExcludedTranslations, $$($1_ALL_COPIES), .properties)
|
||||
endif
|
||||
ifneq (,$$($1_ALL_COPIES))
|
||||
# Yep, there are files to be copied!
|
||||
$1_ALL_COPY_TARGETS:=
|
||||
@ -310,6 +320,10 @@ define SetupJavaCompilationBody
|
||||
ifneq (,$$($1_EXCLUDE_PATTERN))
|
||||
$1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_CLEANS))
|
||||
endif
|
||||
# Filter out any excluded translations
|
||||
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
|
||||
$1_ALL_CLEANS := $$(call FilterExcludedTranslations, $$($1_ALL_CLEANS), .properties)
|
||||
endif
|
||||
ifneq (,$$($1_ALL_CLEANS))
|
||||
# Yep, there are files to be copied and cleaned!
|
||||
$1_ALL_COPY_CLEAN_TARGETS:=
|
||||
|
@ -1074,6 +1074,22 @@ ColonList = \
|
||||
$(subst ::,:,$(subst $(SPACE),:,$(strip $1))) \
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Given a list of files, filters out locale specific files for translations
|
||||
# that should be excluded from this build.
|
||||
# $1 - The list of files to filter
|
||||
# $2 - The suffix of the files that should be considered (.java or .properties)
|
||||
FilterExcludedTranslations = \
|
||||
$(strip $(if $(EXCLUDE_TRANSLATIONS), \
|
||||
$(filter-out \
|
||||
$(foreach suffix, $2, \
|
||||
$(addprefix %_, $(addsuffix $(suffix), $(EXCLUDE_TRANSLATIONS))) \
|
||||
), \
|
||||
$1 \
|
||||
), \
|
||||
$1 \
|
||||
))
|
||||
|
||||
################################################################################
|
||||
|
||||
# Hook to include the corresponding custom file, if present.
|
||||
|
@ -42,6 +42,10 @@ endif
|
||||
# INCLUDE_FILES
|
||||
# EXCLUDES
|
||||
# EXCLUDE_FILES
|
||||
# EXCLUDE_PATTERNS - Patterns with at most one % wildcard matching filenames
|
||||
# and not directories.
|
||||
# EXCLUDE_PATTERNS_$dir - Exclude patterns just like above but specific to one
|
||||
# src dir
|
||||
# SUFFIXES
|
||||
# EXTRA_DEPS
|
||||
# ZIP_OPTIONS extra options to pass to zip
|
||||
@ -88,11 +92,26 @@ define SetupZipArchiveBody
|
||||
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
|
||||
endif
|
||||
ifneq ($$($1_EXCLUDE_FILES),)
|
||||
# Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
|
||||
# zipped at the moment.
|
||||
$1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
|
||||
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
|
||||
$$(foreach s, $$($1_SRC), \
|
||||
$$(eval $1_ZIP_EXCLUDES_$$s += \
|
||||
$$(addprefix -x$$(SPACE), $$(patsubst $$s/%,%, $$($1_EXCLUDE_FILES))) \
|
||||
) \
|
||||
)
|
||||
endif
|
||||
ifneq ($$($1_EXCLUDE_PATTERNS), )
|
||||
$1_ALL_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERNS), $$($1_ALL_SRCS))
|
||||
$1_ZIP_EXCLUDES += $$(addprefix -x$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS)))
|
||||
endif
|
||||
# Rewrite src dir specific exclude patterns to zip excludes
|
||||
$$(foreach s, $$($1_SRC), \
|
||||
$$(if $$($1_EXCLUDE_PATTERNS_$$s), \
|
||||
$$(eval $1_ZIP_EXCLUDES_$$s += \
|
||||
$$(addprefix -x$$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS_$$s))) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
# Use a slightly shorter name for logging, but with enough path to identify this zip.
|
||||
$1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_ZIP))
|
||||
@ -107,9 +126,9 @@ define SetupZipArchiveBody
|
||||
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
|
||||
$(MKDIR) -p $$(@D)
|
||||
$(ECHO) Updating $$($1_NAME)
|
||||
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . $$($1_ZIP_INCLUDES) \
|
||||
$$($1_ZIP_EXCLUDES) -x \*_the.\* \
|
||||
$$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \
|
||||
$$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \
|
||||
$$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \
|
||||
$$($1_ZIP_EXCLUDES_$$s) \
|
||||
|| test "$$$$?" = "12" )$$(NEWLINE)) true
|
||||
$(TOUCH) $$@
|
||||
|
||||
|
@ -242,6 +242,7 @@ var getJibProfilesCommon = function (input, data) {
|
||||
dependencies: ["boot_jdk", "gnumake", "jtreg", "jib"],
|
||||
default_make_targets: ["product-bundles", "test-bundles"],
|
||||
configure_args: concat(["--enable-jtreg-failure-handler"],
|
||||
"--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I",
|
||||
versionArgs(input, common))
|
||||
};
|
||||
// Extra settings for debug profiles
|
||||
|
@ -38,6 +38,7 @@ include GensrcProperties.gmk
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources, \
|
||||
CLASS := sun.util.resources.LocaleNamesBundle, \
|
||||
KEEP_ALL_TRANSLATIONS := true, \
|
||||
))
|
||||
|
||||
# Skip generating zh_HK from zh_TW for this module.
|
||||
|
@ -66,6 +66,9 @@ define SetupCompileProperties
|
||||
PROPSOURCES := $2 \
|
||||
$$(shell $(FIND) $(TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
|
||||
|
||||
# Filter out any excluded translations
|
||||
PROPSOURCES := $$(call FilterExcludedTranslations, $$(PROPSOURCES), .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
|
||||
# Strip away prefix and suffix, leaving for example only:
|
||||
@ -105,6 +108,7 @@ endef
|
||||
define SetupParseProperties
|
||||
# property files to process
|
||||
PARSEPROPSOURCES := $$(addprefix $(TOPDIR)/src/$(MODULE)/share/classes/, $2)
|
||||
PARSEPROPSOURCES := $$(call FilterExcludedTranslations, $$(PARSEPROPSOURCES), .properties)
|
||||
|
||||
PARSEPROPALLDIRS := $$(patsubst $(TOPDIR)/src/$(MODULE)/share/classes/%, \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -59,6 +59,7 @@ endef
|
||||
# EXCLUDE Exclude files matching this pattern.
|
||||
# CLASS The super class for the generated classes.
|
||||
# MODULE_PATH_ROOT Module path root, defaults to $(TOPDIR)/src.
|
||||
# KEEP_ALL_TRANSLATIONS Set to true to skip filtering of excluded translations.
|
||||
SetupCompileProperties = $(NamedParamsMacroTemplate)
|
||||
define SetupCompilePropertiesBody
|
||||
# Set default value unless overridden
|
||||
@ -73,10 +74,13 @@ define SetupCompilePropertiesBody
|
||||
$1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
|
||||
endif
|
||||
|
||||
# Filter out any excluded translations
|
||||
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
|
||||
$1_SRC_FILES := $$(call FilterExcludedTranslations, $$($1_SRC_FILES), .properties)
|
||||
endif
|
||||
|
||||
# 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
|
||||
# Strip away prefix and suffix, leaving for example only:
|
||||
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
|
||||
$1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/%, \
|
||||
$$(patsubst %.properties, %.java, \
|
||||
|
@ -40,7 +40,8 @@ requires.properties= \
|
||||
vm.gc.Z \
|
||||
vm.graal.enabled \
|
||||
vm.cds \
|
||||
docker.support
|
||||
docker.support \
|
||||
release.implementor
|
||||
|
||||
# Minimum jtreg version
|
||||
requiredVersion=4.2 b12
|
||||
|
@ -39,7 +39,6 @@ tier1_part2 = \
|
||||
-java/util/Arrays/TimSortStackSize2.java
|
||||
|
||||
tier1_part3 = \
|
||||
:build_sanity \
|
||||
:jdk_math \
|
||||
:jdk_svc_sanity \
|
||||
java/nio/Buffer \
|
||||
@ -76,6 +75,7 @@ tier2_part3 = \
|
||||
:jdk_net
|
||||
|
||||
tier3 = \
|
||||
:build \
|
||||
:jdk_rmi \
|
||||
:jdk_beans \
|
||||
:jdk_imageio \
|
||||
@ -88,8 +88,8 @@ tier3 = \
|
||||
#
|
||||
|
||||
# Build source checking
|
||||
build_sanity = \
|
||||
sanity/releaseFile
|
||||
build = \
|
||||
build
|
||||
|
||||
# java.lang package and VM runtime support
|
||||
jdk_lang = \
|
||||
|
114
test/jdk/build/translations/VerifyTranslations.java
Normal file
114
test/jdk/build/translations/VerifyTranslations.java
Normal file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires release.implementor == "Oracle Corporation"
|
||||
* @modules jdk.jlink/jdk.tools.jimage
|
||||
* @summary Oracle builds of OpenJDK should only contain english, chinese and
|
||||
* japanese translations
|
||||
*/
|
||||
public class VerifyTranslations {
|
||||
|
||||
/**
|
||||
* The set of translations we want to see in an Oracle built image
|
||||
*/
|
||||
private static final Set<String> VALID_TRANSLATION_SUFFIXES = Set.of(
|
||||
"_en", "_en_US", "_en_US_POSIX", "_ja", "_zh_CN", "_zh_TW", "_zh_HK"
|
||||
);
|
||||
|
||||
/**
|
||||
* This regexp will not match locales with 3 letter lang strings because
|
||||
* doing so would trigger a ton of false positives all over the source
|
||||
* tree. This is ok for now but is a potential future flaw in the test.
|
||||
*/
|
||||
private static final String BASE_LOCALE_REGEXP
|
||||
= "(_[a-z]{2}(_[A-Z][a-z]{3})?(_([A-Z]{2})|([0-9]{3}))?(_[a-zA-Z]+)?)";
|
||||
|
||||
public static void main(String[] args) {
|
||||
String jdkPath = System.getProperty("test.jdk");
|
||||
String modulesFile = jdkPath + "/lib/modules";
|
||||
|
||||
// Run jimage tool to extract list of all classes and resources in the jdk
|
||||
StringWriter output = new StringWriter();
|
||||
jdk.tools.jimage.Main.run(new String[] { "list", modulesFile }, new PrintWriter(output));
|
||||
|
||||
Pattern classesLocalePattern = Pattern.compile(BASE_LOCALE_REGEXP + "\\.(class|properties)");
|
||||
|
||||
boolean failed = false;
|
||||
String module = "";
|
||||
for (String line : output.toString().split("\n")) {
|
||||
if (line.startsWith("Module: ")) {
|
||||
module = line.substring(8).trim();
|
||||
}
|
||||
// We do not filter resources in jdk.localedata
|
||||
if (!module.equals("jdk.localedata")) {
|
||||
Matcher matcher = classesLocalePattern.matcher(line);
|
||||
if (matcher.find()) {
|
||||
if (!VALID_TRANSLATION_SUFFIXES.contains(matcher.group(1))) {
|
||||
System.out.println("Unsupported translation found in lib/modules: "
|
||||
+ module + "/" + line.trim());
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check all files in src.zip
|
||||
Pattern sourceLocalePattern = Pattern.compile(BASE_LOCALE_REGEXP + "\\.java");
|
||||
String srcZip = jdkPath + "/lib/src.zip";
|
||||
try (ZipInputStream srcZipInput = new ZipInputStream(
|
||||
new BufferedInputStream(new FileInputStream(srcZip)))) {
|
||||
ZipEntry entry;
|
||||
while ((entry = srcZipInput.getNextEntry()) != null) {
|
||||
String name = entry.getName();
|
||||
if (!name.startsWith("jdk.localedata")) {
|
||||
Matcher matcher = sourceLocalePattern.matcher(name);
|
||||
if (matcher.find()) {
|
||||
if (!VALID_TRANSLATION_SUFFIXES.contains(matcher.group(1))) {
|
||||
System.out.println("Unsupported translation found in lib/src.zip: " + name);
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
throw new RuntimeException("lib/modules contains unsupported translations");
|
||||
}
|
||||
}
|
||||
}
|
@ -35,10 +35,10 @@ import java.util.logging.*;
|
||||
public class LocalizedLevelName {
|
||||
private static Object[] namesMap = {
|
||||
"SEVERE", Locale.ENGLISH, "Severe", Level.SEVERE,
|
||||
"WARNING", Locale.FRENCH, "Avertissement", Level.WARNING,
|
||||
"INFO", Locale.ITALIAN, "Informazioni", Level.INFO,
|
||||
"SEVERE", Locale.FRENCH, "Grave", Level.SEVERE,
|
||||
"CONFIG", Locale.GERMAN, "Konfiguration", Level.CONFIG,
|
||||
"WARNING", Locale.JAPANESE, "\u8B66\u544A", Level.WARNING,
|
||||
"INFO", Locale.SIMPLIFIED_CHINESE, "\u4FE1\u606F", Level.INFO,
|
||||
"SEVERE", Locale.TRADITIONAL_CHINESE, "\u56B4\u91CD", Level.SEVERE,
|
||||
"CONFIG", Locale.forLanguageTag("zh-HK"), "\u7D44\u614B", Level.CONFIG,
|
||||
"ALL", Locale.ROOT, "All", Level.ALL,
|
||||
"SEVERE", Locale.ROOT, "Severe", Level.SEVERE,
|
||||
"WARNING", Locale.ROOT, "Warning", Level.WARNING,
|
||||
|
@ -22,7 +22,10 @@
|
||||
*/
|
||||
package requires;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -31,6 +34,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
@ -80,6 +84,7 @@ public class VMProps implements Callable<Map<String, String>> {
|
||||
// vm.graal.enabled is true if Graal is used as JIT
|
||||
map.put("vm.graal.enabled", isGraalEnabled());
|
||||
map.put("docker.support", dockerSupport());
|
||||
map.put("release.implementor", implementor());
|
||||
vmGC(map); // vm.gc.X = true/false
|
||||
vmOptFinalFlags(map);
|
||||
|
||||
@ -396,6 +401,18 @@ public class VMProps implements Callable<Map<String, String>> {
|
||||
}
|
||||
|
||||
|
||||
private String implementor() {
|
||||
try (InputStream in = new BufferedInputStream(new FileInputStream(
|
||||
System.getProperty("java.home") + "/release"))) {
|
||||
Properties properties = new Properties();
|
||||
properties.load(in);
|
||||
return properties.getProperty("IMPLEMENTOR").replace("\"", "");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dumps the map to the file if the file name is given as the property.
|
||||
|
Loading…
Reference in New Issue
Block a user