Home

Awesome

codeql-jdk-docker

Unofficial scripts and Docker configuration for building CodeQL databases for the OpenJDK.
The created databases can then for example be loaded and analyzed using the Visual Studio Code CodeQL extension.

:warning: Your usage of CodeQL and the created databases has to adhere to the GitHub CodeQL Terms and Conditions.

Requirements

See also OpenJDK Build Hardware Requirements.

Usage

This project provides convenience scripts for creating a CodeQL database for the Java code of the OpenJDK:

At the moment they use CodeQL CLI 2.15.5 and build a Java database for the latest https://github.com/openjdk/jdk21u commit.

The scripts only build the Linux variant of the JDK, building the Windows variant is currently not supported.

These scripts can be executed as is (assuming that Docker has already been started). They perform the following tasks:

  1. Build the Docker image (named codeql-jdk)
  2. Clone the JDK source code
  3. Build the CodeQL database and copy it to the databases folder of the current directory

The jdk-versions folder contains scripts for building databases for specific JDK versions.

Note: Building the Docker image, the JDK and the CodeQL database are all resource and time intensive tasks. In total they might take up to an hour (depends on your network connection and hardware).

:information_source: 3 to 4GB of memory might suffice for the Docker container, however a memory limit should be specified for the JDK build using --memory-limit (see "Build configuration" section), otherwise the build can get stuck and fail.

Docker image configuration

The Dockerfile uses build-time variables for configuration.

Build configuration

The Docker image has a build script as entry point which allows customizing how the JDK and the CodeQL database is built. The arguments are passed as additional arguments to docker container run. Additionally the arguments can be used with the convenience scripts mentioned in the "Usage" section.

Arguments have the format <code>--<i>param</i> <i>value</i></code>