Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit 149c6de

Browse files
Merge pull request #318 from google/smaller-native-images
Use more specific patterns for matching included resources
2 parents c8be070 + 9e9d69a commit 149c6de

File tree

2 files changed

+6
-30
lines changed

2 files changed

+6
-30
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ jobs:
109109
distribution: 'graalvm-community'
110110
github-token: ${{ secrets.GITHUB_TOKEN }}
111111
native-image-job-reports: 'true'
112-
- name: Setup upx
113-
run: |
114-
UPX_VERSION=5.0.0
115-
curl --fail --show-error --location --remote-name "https://github.com/upx/upx/releases/download/v$UPX_VERSION/upx-$UPX_VERSION-amd64_linux.tar.xz"
116-
tar -xf upx-$UPX_VERSION-amd64_linux.tar.xz
117-
mv ./upx-$UPX_VERSION-amd64_linux/upx /usr/local/bin/upx
118112
- name: Download compiler jar
119113
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
120114
with:
@@ -147,7 +141,6 @@ jobs:
147141
run: |
148142
cp ../google-closure-compiler-java/compiler.jar compiler.jar
149143
yarn run build
150-
upx compiler
151144
- name: Tests
152145
run: yarn workspaces run test --color
153146
- name: Upload artifacts
@@ -187,12 +180,6 @@ jobs:
187180
distribution: 'graalvm-community'
188181
github-token: ${{ secrets.GITHUB_TOKEN }}
189182
native-image-job-reports: 'true'
190-
- name: Setup upx
191-
run: |
192-
UPX_VERSION=5.0.0
193-
curl --fail --show-error --location --remote-name "https://github.com/upx/upx/releases/download/v$UPX_VERSION/upx-$UPX_VERSION-arm64_linux.tar.xz"
194-
tar -xf upx-$UPX_VERSION-arm64_linux.tar.xz
195-
mv ./upx-$UPX_VERSION-arm64_linux/upx /usr/local/bin/upx
196183
- name: Download compiler jar
197184
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
198185
with:
@@ -225,7 +212,6 @@ jobs:
225212
run: |
226213
cp ../google-closure-compiler-java/compiler.jar compiler.jar
227214
yarn run build
228-
upx compiler
229215
- name: Tests
230216
run: yarn workspaces run test --color
231217
- name: Upload artifacts
@@ -263,9 +249,6 @@ jobs:
263249
distribution: 'graalvm-community'
264250
github-token: ${{ secrets.GITHUB_TOKEN }}
265251
native-image-job-reports: 'true'
266-
# # See https://github.com/google/closure-compiler-npm/issues/265
267-
# - name: Install upx
268-
# run: brew install upx
269252
- name: Download compiler jar
270253
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # 4.3.0
271254
with:
@@ -298,7 +281,6 @@ jobs:
298281
run: |
299282
cp ../google-closure-compiler-java/compiler.jar compiler.jar
300283
yarn run build
301-
# upx compiler
302284
- name: Tests
303285
run: yarn workspaces run test --color
304286
- name: Upload artifacts

build-scripts/graal.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,18 @@ process.on('unhandledRejection', error => {
3535
});
3636

3737
const NATIVE_IMAGE_BUILD_ARGS = [
38-
'-H:+ReportUnsupportedElementsAtRuntime',
38+
'-H:+UnlockExperimentalVMOptions',
3939
'-H:IncludeResourceBundles=org.kohsuke.args4j.Messages',
4040
'-H:IncludeResourceBundles=org.kohsuke.args4j.spi.Messages',
4141
'-H:IncludeResourceBundles=com.google.javascript.jscomp.parsing.ParserConfig',
4242
'-H:+AllowIncompleteClasspath',
4343
`-H:ReflectionConfigurationFiles=${path.resolve(__dirname, 'reflection-config.json')}`,
44-
'-H:IncludeResources=(externs.zip)|(.*(js|txt|typedast))'.replace(/[\|\(\)]/g, (match) => {
45-
if (process.platform === 'win32') {
46-
// Escape the '|' character in a windows batch command
47-
// See https://stackoverflow.com/a/16018942/1211524
48-
if (match === '|') {
49-
return '^^^|';
50-
}
51-
return `^${match}`;
52-
}
53-
return '|';
54-
}),
44+
'-H:IncludeResources=externs\.zip',
45+
'-H:IncludeResources=com\/google\/javascript\/.*\.js',
46+
'-H:IncludeResources=com\/google\/javascript\/.*\.txt',
47+
'-H:IncludeResources=com\/google\/javascript\/.*\.typedast',
5548
'-H:+ReportExceptionStackTraces',
49+
'--report-unsupported-elements-at-runtime',
5650
'--initialize-at-build-time',
5751
'--color=always',
5852
'-jar',

0 commit comments

Comments
 (0)