AdoptOpenJDK makes use of these scripts to build binaries on the build farm at http://ci.adoptopenjdk.net which produces OpenJDK binaries for consumption via https://www.adoptopenjdk.net and https://api.adoptopenjdk.net
This repository contains several useful scripts in order to build OpenJDK personally or at build farm scale.
- The
dockerfolder contains a Docker file which can be used to create a Docker container for building OpenJDK - The
git-hgfolder contains scripts to clone an OpenJDK mercurial forest into a GitHub repo and regularly update it - The
mercurial-tags/java-toolfolder contains scripts for TODO - The
pipelinesfolder contains the Groovy pipeline scripts for Jenkins (e.g. build | test | checksum |release) - The
sbinfolder contains the scripts called by the main script. - The
securityfolder contains a script andcacertsfile that is bundled with the JDK and used when building OpenJDK: thecacertsfile is an important file that's used to enable SSL connections
The main script to build OpenJDK is makejdk-any-platform.sh
In order to build an OpenJDK variant on the build farm you need to follow the Adding-a-new-build-variant instructions.
WARN: As of 23rd March 2018 these instructions do not work, there are several issues that need resolving
Make sure you have started your Docker Daemon first! For help with getting docker follow the instructions here. Once you have Docker started you can then use the script below to build OpenJDK.
Usage: ./makejdk-any-platform.sh --version [version] [options]
Versions:
jdk8u - https://github.com/AdoptOpenJDK/openjdk-jdk8u
jdk9 - https://github.com/AdoptOpenJDK/openjdk-jdk9
jdk10 - https://github.com/AdoptOpenJDK/openjdk-jdk10
Options:
-s, --source <path> specify the location for the source and dependencies to be cloned, defaults to ./openjdk
-d, --destination <path> specify the location for the tarball (eg. /path/ or /path/here.tar.gz)
-r, --repository <repo> specify a custom repository (eg. username/openjdk-jdk8u)
-b, --branch <branch> specify a custom branch (eg. dev)
-k, --keep reuse docker container (prevents deleting)
-j, --jtreg run jtreg after building
-S, --ssh use ssh when cloning git
--variant <name> specify a build variant name, e.g. openj9
The simplest way to build OpenJDK using our scripts is to run makejdk-any-platform.sh and have your user be in the Docker group on the machine
(or prefix all of your Docker commands with sudo). This script will create a Docker container that will be configured with all of the required
dependencies and a base operating system in order to build OpenJDK. For example:
./makejdk-any-platform.sh --keep --version --ssh jdk8u
- NOTE: If you don't use SSH keys (if you do then pass
-ssh) to connect to GitHub then the script will challenge you for your GitHub username and password. - NOTE: The script will clone source code into the
--sourcedirectory (defaults toopenjdk). - NOTE: By default the docker container is removed each time and your build will be copied from the container to the host.
To override this behaviour, specify the
-kor--keepoption. - NOTE: The entire process will take some time, especially if you have not saved the Docker image from a previous run.
- NOTE: If you set the
-doption it will pass that through tomakejdk.sh, the resulting zipped tarball will be copied to the value for -d, for example:makejdk.sh /target/directorywill result in the JDK being built inside of your Docker container and then copied to/target/directoryon the host
To use the Docker commands without using the sudo prefix, you will need to be in the Docker group which can be achieved with the following three commands
(performed as root)
sudo groupadd docker: creates the Docker group if it doesn't already existsudo gpasswd -a yourusernamehere docker: adds a user to the Docker groupsudo service docker restart: restarts the Docker service so the above changes can take effect
Please note that your build host will need to have certain pre-requisites met. We provide Ansible scripts in the openjdk-infrastructure project for setting these pre-requisites.
You can use the makejdk-any-platform.sh script by providing two parameters:
- The working directory (which is where files will be downloaded to: this includes a number of libraries used with OpenJDK itself such as FreeType and ALSA)
- The target directory which will be used to store the final .tar.gz file containing the j2sdk-image
e.g ./makejdk-any-platform.sh -s /path/to/workspace -d /target/directory
NOTE: Usage can be found via makejdk-any-platform.sh --help, the exact usage is available for this script as well.
You can use the makejdk.sh script by providing two parameters:
- The working directory (which is where files will be downloaded to: this includes a number of libraries used with OpenJDK itself such as FreeType and ALSA)
- The target directory which will be used to store the final .tar.gz file containing the j2sdk-image
e.g ./makejdk.sh -s /path/to/workspace -d /target/directory