Keep symlinks in legal subdirectories in linux/macos packages. Remove root legal files that already exist in legal/java.base #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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=trueflag, 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:
... 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