Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[bundletool] Remove com/sun/jna content #9162

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build-tools/create-packs/SignVerifyIgnore.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
**\*.xml,ignore unsigned xml
**\cab*.cab.cab,ignore unsigned .cab
**\com\sun\jna\win32-*\jnidispatch.dll, ignore external bundletool.jar content
22 changes: 15 additions & 7 deletions src/bundletool/bundletool.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<_Destination>$(MicrosoftAndroidSdkOutDir)</_Destination>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<_BundleToolDownloadLocation>$(AndroidToolchainCacheDirectory)\bundletool-all-$(XABundleToolVersion).jar</_BundleToolDownloadLocation>
<_BundleToolExtractLocation>$(AndroidToolchainCacheDirectory)\bundletool-unzip</_BundleToolExtractLocation>
<_BundleToolCopyLocation>$(AndroidToolchainCacheDirectory)\bundletool-all-$(XABundleToolVersion)-copy.jar</_BundleToolCopyLocation>
<_BundleToolExtractLocation>$(AndroidToolchainCacheDirectory)\bundletool-unzip-$(XABundleToolVersion)</_BundleToolExtractLocation>
<_JarPath Condition=" '$(JavaSdkDirectory)' != '' ">$(JavaSdkDirectory)/bin/jar</_JarPath>
<_JarPath Condition=" '$(_JarPath)' == '' ">jar</_JarPath>
</PropertyGroup>
Expand All @@ -21,16 +22,23 @@
DependsOnTargets="_DownloadBundleTool"
Inputs="$(_BundleToolDownloadLocation)"
Outputs="$(_Destination)bundletool.jar" >
<!-- Strip aapt2 from bundletool.jar, as we pass it our own path to aapt2.
This simplifies macOS signing/hardening and reduces our installation footprint slightly. -->
<!-- Strip unused jna content and aapt2 from bundletool.jar, as we pass it our own path to aapt2.
This simplifies signing/hardening and reduces our installation footprint slightly. -->
<RemoveDir Directories="$(_BundleToolExtractLocation)" />
<MakeDir Directories="$(_BundleToolExtractLocation)" />
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -xf &quot;$(_BundleToolDownloadLocation)&quot;" />
<Delete Files="$(_BundleToolDownloadLocation);$(_BundleToolExtractLocation)\linux\aapt2;$(_BundleToolExtractLocation)\macos\aapt2;$(_BundleToolExtractLocation)\windows\aapt2.exe" />
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -cmf META-INF/MANIFEST.MF &quot;$(_BundleToolDownloadLocation)&quot; ." />
<RemoveDir Directories="$(_BundleToolExtractLocation)" />
<Copy
SourceFiles="$(_BundleToolDownloadLocation)"
DestinationFiles="$(_BundleToolCopyLocation)"
SkipUnchangedFiles="True"
/>
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -xf &quot;$(_BundleToolCopyLocation)&quot;" />
<Delete Files="$(_BundleToolCopyLocation)" />
<Delete Files="$(_BundleToolExtractLocation)\linux\aapt2;$(_BundleToolExtractLocation)\macos\aapt2;$(_BundleToolExtractLocation)\windows\aapt2.exe" />
<RemoveDir Directories="$(_BundleToolExtractLocation)\com\sun\jna" />
<Exec WorkingDirectory="$(_BundleToolExtractLocation)" Command="$(_JarPath) -cmf META-INF/MANIFEST.MF &quot;$(_BundleToolCopyLocation)&quot; ." />
<RemoveDir Directories="$(_BundleToolExtractLocation)" />
<Copy
SourceFiles="$(_BundleToolCopyLocation)"
DestinationFiles="$(_Destination)bundletool.jar"
SkipUnchangedFiles="True"
/>
Expand Down
Loading