Skip to content

Commit

Permalink
[GR-52729] Compress ICU4J resources.
Browse files Browse the repository at this point in the history
PullRequest: graal/17740
  • Loading branch information
woess committed Jul 16, 2024
2 parents cc12aed + 7f4a285 commit 71e6492
Show file tree
Hide file tree
Showing 8 changed files with 368 additions and 154 deletions.
2 changes: 1 addition & 1 deletion espresso/mx.espresso/mx_espresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def register_espresso_envs(suite):
# pylint: disable=bad-whitespace
# pylint: disable=line-too-long
tools = ['cov', 'dap', 'ins', 'insight', 'insightheap', 'lsp', 'pro', 'truffle-json']
tregex = ['icu4j', 'rgx']
tregex = ['icu4j', 'rgx', 'xz']
_llvm_toolchain_wrappers = ['bgraalvm-native-clang', 'bgraalvm-native-clang-cl', 'bgraalvm-native-clang++', 'bgraalvm-native-flang', 'bgraalvm-native-ld', 'bgraalvm-native-binutil']
if espresso_llvm_java_home:
mx_sdk_vm.register_vm_config('espresso-jvm', ['java', 'ejvm' , 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp', 'antlr4', 'llrc', 'llrlf', 'llrn' , 'elau' ] + tools + tregex, suite, env_file='jvm-llvm')
Expand Down
1 change: 1 addition & 0 deletions truffle/mx.truffle/language-icu4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

ImageClasspath = ${.}/truffle-icu4j.jar
#ImageModulePath = ${.}/truffle-icu4j.jar
Args = --language:xz
2 changes: 1 addition & 1 deletion truffle/mx.truffle/mx_truffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,7 @@ def clean(self, forBuild=False):
dir_name='icu4j',
license_files=[],
third_party_license_files=[],
dependencies=['Truffle'],
dependencies=['Truffle', 'XZ'],
truffle_jars=[
'truffle:TRUFFLE_ICU4J',
],
Expand Down
36 changes: 25 additions & 11 deletions truffle/mx.truffle/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,8 @@
"java.desktop",
],
"dependencies" : [
"sdk:NATIVEIMAGE",
"truffle:TRUFFLE_XZ",
],
"shadedDependencies" : [
"truffle:ICU4J",
Expand Down Expand Up @@ -1200,20 +1202,31 @@
"com/ibm/icu/ICUConfig.properties" : {
"com\\.ibm\\.icu\\." : "org.graalvm.shadowed.com.ibm.icu.",
},
"com/ibm/icu/util/VTimeZone.java" : {
# confuses the codesnippet doclet
" (BEGIN|END):(\\w+)\\b" : " \'\\1:\\2\'",
},
"com/ibm/icu/impl/ICUBinary.java" : {
# we want to make this code unreachable in native image builds
"addDataFilesFromPath\\(dataPath, icuDataFiles\\);" : "// \\g<0>",
},
"com/ibm/icu/impl/ICUData.java" : {
# [GR-47166] we load an absolute path from ICUData.class, to
# workaround an issue we don't understand when this is on the
# module path
# workaround an issue we don't understand when on the module path
"ICU_DATA_PATH = \"(?!/)" : "\\g<0>/",
"loader.getResourceAsStream\\(resourceName\\)": "(loader == ICUData.class.getClassLoader() ? ICUData.class.getResourceAsStream(resourceName) : \\g<0>)",
"root.getResourceAsStream\\(resourceName\\)": "getResourceStream(null, root, resourceName)",
"loader.getResourceAsStream\\(resourceName\\)": "getResourceStream(loader, null, resourceName)",
"private static InputStream getStream": """
private static InputStream getResourceStream(ClassLoader loader, Class<?> root, String resourceName) {
Class<?> refClass = root;
if (refClass == null && loader == ICUData.class.getClassLoader()) {
refClass = ICUData.class;
}
InputStream inputStream;
if (refClass != null) {
inputStream = refClass.getResourceAsStream(resourceName);
} else {
inputStream = loader.getResourceAsStream(resourceName);
}
return inputStream;
}
\\g<0>""",
},
"com/ibm/icu/impl/URLHandler.java" : {
# we want to make this code unreachable in native image builds
Expand Down Expand Up @@ -2309,6 +2322,7 @@
"requires" : [
"static java.xml",
"static java.desktop",
"static org.graalvm.shadowed.xz",
],
"exports" : [
# Qualified exports.
Expand All @@ -2328,8 +2342,8 @@
"org.graalvm.shadowed.com.ibm.icu",
],
"distDependencies" : [
],
"exclude" : [
"sdk:NATIVEIMAGE",
"truffle:TRUFFLE_XZ",
],
"description" : "ICU4J shaded module.",
"allowsJavadocWarnings" : True,
Expand All @@ -2351,8 +2365,8 @@
],
"exports" : [
# Qualified exports.
"org.graalvm.shadowed.org.tukaani.xz to org.graalvm.py, org.graalvm.r",
"org.graalvm.shadowed.org.tukaani.xz.* to org.graalvm.py, org.graalvm.r",
"org.graalvm.shadowed.org.tukaani.xz to org.graalvm.py, org.graalvm.r, org.graalvm.shadowed.icu4j",
"org.graalvm.shadowed.org.tukaani.xz.* to org.graalvm.py, org.graalvm.r, org.graalvm.shadowed.icu4j",
],
},
"subDir" : "src",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Args=--initialize-at-run-time=org.graalvm.shadowed.com.ibm.icu
Args=--initialize-at-run-time=org.graalvm.shadowed.com.ibm.icu --features=org.graalvm.shadowed.com.ibm.icu.ICU4JFeature
Original file line number Diff line number Diff line change
@@ -1,141 +1,5 @@
{
"resources":[
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.util.UResourceBundle" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/[^/]*\\.(res|lst)$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.charset.CharsetMBCS" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/.*\\.cnv$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.UCaseProps" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/ucase\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.UCharacterName" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/unames\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.UCharacterProperty" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/uprops\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.UCharacterProperty$LayoutProps" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/ulayout\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.UPropertyAliases" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/pnames\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.EmojiProps" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/uemoji\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.UBiDiProps" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/ubidi\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.coll.CollationRoot" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/coll/ucadata\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.coll.CollationLoader" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/coll/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.Collator" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/coll/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.charset.UConverterAlias" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/cnvalias\\.icu$"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.TimeZoneNames" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/zone/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.TimeZoneGenericNames" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/zone/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.TimeZoneFormat" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/zone/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.ICURegionDataTables" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/region/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.ICULangDataTables" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/lang/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.util.LocaleData" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/lang/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.ICUCurrencyDisplayInfoProvider" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/curr/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.ICUCurrencyMetaInfo" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/curr/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.util.MeasureUnit" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/unit/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.MeasureFormat" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/unit/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.TimeUnitFormat" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/unit/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.number.LongNameHandler" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/unit/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.TransliteratorRegistry" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/translit/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.Transliterator" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/translit/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.RuleBasedNumberFormat" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/rbnf/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.BreakIteratorFactory" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/brkitr/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.breakiter.DictionaryBreakEngine" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/brkitr/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.SimpleFilteredSentenceBreakIterator$Builder" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/brkitr/.*"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.SpoofChecker.SpoofData.DefaultData" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/confusables\\.cfu"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.text.StringPrep" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/[^/]*\\.spp"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.Normalizer2Impl" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/data/icudt[^/]*/[^/]*\\.nrm"
},
{
"condition" : { "typeReachable" : "org.graalvm.shadowed.com.ibm.icu.impl.duration.impl.ResourceBasedPeriodFormatterDataService" },
"pattern":"org/graalvm/shadowed/com/ibm/icu/impl/duration/impl/data/.*"
Expand Down
Loading

0 comments on commit 71e6492

Please sign in to comment.