Skip to content

Conversation

@kirill-shirokov
Copy link
Contributor

Description

Symlinks in OpenJDK legal/ subtree are not respected by gradle build files and were replaced by files themselves, which accounted to around extra 2Mb in unarchived distribution. Also, duplicate legal files exist in the root of the package (LICENSE, ASSEMBLY_EXCEPTION, ADDITIONAL_LICENSE_INFO).

For all Linux and MacOS targets, the Gradle build files were modified to allow keeping symlinks already created by OpenJDK jlink during the build process.

By default, symlinks are dereferenced as they used to be. However, when Gradle is invoked with -Pcorretto.keepSymlinks=true flag, the symlinks are kept as symlinks in the produced *.tar.gz, *.deb, *.rpm, *.pkg distribution files.

Note that due to a bug/misfeature with -h option in GNU tar, I had to use bsdtar for creating archives either with or without symlinks, so the Docker images now require bsdtar to be installed. Its package can be named 'bsdtar' or 'libarchive-tools' in different OS.

Motivation and context

Trying to reduce unpacked bundle size

How has this been tested?

By building the following targets:

  • installers:linux:apline:tar:build
  • installers:linux:universal:tar:build
  • installers:linux:universal:deb:build
  • installers:linux:universal:rpm:build
  • installers:mac:tar:build
  • installers:mac:pkg:build

... and verifying that previously regular licence files are replaced with symlinks as in OpenJDK in the each type of packaging

Platform information

Works on OS: Linux (universal), Alpine Linux, MacOS
Applies to version: 21, 25, tip

… root legal files that already exist in legal/java.base. Add -Pcorretto.keepSymlinks flag to Gradle to trigger old/new behavior. Use bsdtar to correctly dereference symlinks
…dd 'BuildRequires bsdtar' into AL2 SRPM spec.
@kirill-shirokov kirill-shirokov merged commit d2cc7ff into corretto:develop Jan 13, 2026
71 of 72 checks passed
@kirill-shirokov kirill-shirokov deleted the keep-legal-symlinks-in-packages branch January 13, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants