Skip to content

Commit 6ecb694

Browse files
committed
Rmove charsets only for OpenJ9 as hotspot needs code changes.
Remove unnecessary tools in the bin and lib folders.
1 parent e3b4dbc commit 6ecb694

File tree

2 files changed

+93
-4
lines changed

2 files changed

+93
-4
lines changed

config/slim-java_bin_del.list

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
#
14+
appletviewer
15+
extcheck
16+
idlj
17+
jarsigner
18+
javah
19+
javap
20+
jcmd
21+
jconsole
22+
jdmpview
23+
jdb
24+
jhat
25+
jjs
26+
jmap
27+
jrunscript
28+
jstack
29+
jstat
30+
jstatd
31+
native2ascii
32+
orbd
33+
policytool
34+
rmic
35+
tnameserv
36+
schemagen
37+
serialver
38+
servertool
39+
tnameserv
40+
traceformat
41+
wsgen
42+
wsimport
43+
xjc

slim-java.sh

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ keep_list="${scriptdir}/slim-java_rtjar_keep.list"
4343
del_list="${scriptdir}/slim-java_rtjar_del.list"
4444
# jmod files to be deleted
4545
del_jmod_list="${scriptdir}/slim-java_jmod_del.list"
46+
# bin files to be deleted
47+
del_bin_list="${scriptdir}/slim-java_bin_del.list"
4648

4749
# We only support 64 bit builds now
4850
proc_type="64bit"
@@ -71,6 +73,16 @@ function parse_platform_specific() {
7173
esac
7274
}
7375

76+
# Which vm implementation are we running on at the moment.
77+
function get_vm_impl() {
78+
impl="$(java -version | grep "OpenJ9")";
79+
if [ ! -z "${impl}" ]; then
80+
echo "OpenJ9";
81+
else
82+
echo "Hotspot";
83+
fi
84+
}
85+
7486
# Strip debug symbols from the given jar file.
7587
function strip_debug_from_jar() {
7688
jar=$1
@@ -119,15 +131,22 @@ function jre_files() {
119131

120132
# Exclude the zOS specific charsets
121133
function charset_files() {
134+
135+
# This optimization is only for Eclipse OpenJ9 at this time.
136+
vm_impl=$(get_vm_impl);
137+
if [ "${vm_impl}" != "OpenJ9" ]; then
138+
return;
139+
fi
140+
122141
# 2.3 Special treat for removing ZOS specific charsets
123142
echo -n "INFO: Trimming charsets..."
124143
mkdir -p ${root}/charsets_class
125144
pushd ${root}/charsets_class >/dev/null
126145
jar -xf ${root}/jre/lib/charsets.jar
127146
ibmEbcdic="290 300 833 834 838 918 930 933 935 937 939 1025 1026 1046 1047 1097 1112 1122 1123 1364"
128147

129-
# Generate slim-excludes-charsets list as well
130-
[ ! -e ${root}/jre/lib/slim/sun/nio/cs/ext/slim-excludes-charsets ] || rm -rf ${root}/jre/lib/slim/sun/nio/cs/ext/slim-excludes-charsets
148+
# Generate sfj-excludes-charsets list as well. (OpenJ9 expects the file to be named sfj-excludes-charsets).
149+
[ ! -e ${root}/jre/lib/slim/sun/nio/cs/ext/sfj-excludes-charsets ] || rm -rf ${root}/jre/lib/sfj/sun/nio/cs/ext/sfj-excludes-charsets
131150
exclude_charsets=""
132151

133152
for charset in ${ibmEbcdic};
@@ -138,8 +157,8 @@ function charset_files() {
138157
exclude_charsets="${exclude_charsets} IBM${charset}"
139158
done
140159
mkdir -p $root/jre/lib/slim/sun/nio/cs/ext
141-
echo ${exclude_charsets} > ${root}/jre/lib/slim/sun/nio/cs/ext/slim-excludes-charsets
142-
cp ${root}/jre/lib/slim/sun/nio/cs/ext/slim-excludes-charsets sun/nio/cs/ext/
160+
echo ${exclude_charsets} > ${root}/jre/lib/slim/sun/nio/cs/ext/sfj-excludes-charsets
161+
cp ${root}/jre/lib/slim/sun/nio/cs/ext/sfj-excludes-charsets sun/nio/cs/ext/
143162

144163
jar -cfm ${root}/jre/lib/charsets.jar META-INF/MANIFEST.MF *
145164
popd >/dev/null
@@ -230,6 +249,27 @@ function jmod_files() {
230249
popd >/dev/null
231250
}
232251

252+
# Remove unnecessary tools
253+
function bin_files() {
254+
echo -n "INFO: Trimming bin dir..."
255+
pushd ${target}/bin >/dev/null
256+
for binfile in $(cat ${del_bin_list} | grep -v "^#");
257+
do
258+
rm -rf ${binfile}
259+
done
260+
popd >/dev/null
261+
}
262+
263+
# Remove unnecessary tools and jars from lib dir
264+
function lib_files() {
265+
echo -n "INFO: Trimming bin dir..."
266+
pushd ${target}/lib >/dev/null
267+
rm -f ct.sym
268+
rm -f jexec
269+
rm -f tools.jar
270+
popd >/dev/null
271+
}
272+
233273
# Create a new target directory and copy over the source contents.
234274
cd ${basedir}
235275
mkdir -p ${target}
@@ -273,6 +313,12 @@ pushd ${target} >/dev/null
273313
# Remove unnecessary jmod files
274314
jmod_files
275315

316+
# Remove unnecessary tools and jars from lib dir
317+
lib_files
318+
319+
# Remove unnecessary tools
320+
bin_files
321+
276322
# Remove temp folders
277323
rm -rf ${root}/jre/lib/slim ${src}
278324
popd >/dev/null

0 commit comments

Comments
 (0)