Skip to content

Commit 9be9159

Browse files
authored
[bundletool] Remove com/sun/jna content (#9162)
Context: c89de29 Various symbol and signing checks have been failing after bumping bundletool.jar to version 1.17.0. We can fix these by stripping out the offending content from bundletool.jar.
1 parent d101851 commit 9be9159

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
**\*.xml,ignore unsigned xml
22
**\cab*.cab.cab,ignore unsigned .cab
3-
**\com\sun\jna\win32-*\jnidispatch.dll, ignore external bundletool.jar content

src/bundletool/bundletool.targets

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<_Destination>$(MicrosoftAndroidSdkOutDir)</_Destination>
55
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
66
<_BundleToolDownloadLocation>$(AndroidToolchainCacheDirectory)\bundletool-all-$(XABundleToolVersion).jar</_BundleToolDownloadLocation>
7-
<_BundleToolExtractLocation>$(AndroidToolchainCacheDirectory)\bundletool-unzip</_BundleToolExtractLocation>
7+
<_BundleToolCopyLocation>$(AndroidToolchainCacheDirectory)\bundletool-all-$(XABundleToolVersion)-copy.jar</_BundleToolCopyLocation>
8+
<_BundleToolExtractLocation>$(AndroidToolchainCacheDirectory)\bundletool-unzip-$(XABundleToolVersion)</_BundleToolExtractLocation>
89
<_JarPath Condition=" '$(JavaSdkDirectory)' != '' ">$(JavaSdkDirectory)/bin/jar</_JarPath>
910
<_JarPath Condition=" '$(_JarPath)' == '' ">jar</_JarPath>
1011
</PropertyGroup>
@@ -21,16 +22,23 @@
2122
DependsOnTargets="_DownloadBundleTool"
2223
Inputs="$(_BundleToolDownloadLocation)"
2324
Outputs="$(_Destination)bundletool.jar" >
24-
<!-- Strip aapt2 from bundletool.jar, as we pass it our own path to aapt2.
25-
This simplifies macOS signing/hardening and reduces our installation footprint slightly. -->
25+
<!-- Strip unused jna content and aapt2 from bundletool.jar, as we pass it our own path to aapt2.
26+
This simplifies signing/hardening and reduces our installation footprint slightly. -->
2627
<RemoveDir Directories="$(_BundleToolExtractLocation)" />
2728
<MakeDir Directories="$(_BundleToolExtractLocation)" />
28-
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -xf &quot;$(_BundleToolDownloadLocation)&quot;" />
29-
<Delete Files="$(_BundleToolDownloadLocation);$(_BundleToolExtractLocation)\linux\aapt2;$(_BundleToolExtractLocation)\macos\aapt2;$(_BundleToolExtractLocation)\windows\aapt2.exe" />
30-
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -cmf META-INF/MANIFEST.MF &quot;$(_BundleToolDownloadLocation)&quot; ." />
31-
<RemoveDir Directories="$(_BundleToolExtractLocation)" />
3229
<Copy
3330
SourceFiles="$(_BundleToolDownloadLocation)"
31+
DestinationFiles="$(_BundleToolCopyLocation)"
32+
SkipUnchangedFiles="True"
33+
/>
34+
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -xf &quot;$(_BundleToolCopyLocation)&quot;" />
35+
<Delete Files="$(_BundleToolCopyLocation)" />
36+
<Delete Files="$(_BundleToolExtractLocation)\linux\aapt2;$(_BundleToolExtractLocation)\macos\aapt2;$(_BundleToolExtractLocation)\windows\aapt2.exe" />
37+
<RemoveDir Directories="$(_BundleToolExtractLocation)\com\sun\jna" />
38+
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -cmf META-INF/MANIFEST.MF &quot;$(_BundleToolCopyLocation)&quot; ." />
39+
<RemoveDir Directories="$(_BundleToolExtractLocation)" />
40+
<Copy
41+
SourceFiles="$(_BundleToolCopyLocation)"
3442
DestinationFiles="$(_Destination)bundletool.jar"
3543
SkipUnchangedFiles="True"
3644
/>

0 commit comments

Comments
 (0)