diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh index bb3d460..382333f 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh @@ -41,6 +41,12 @@ apt-get install -y python${python_version} python3-pip python3-venv # devcontainer feature "python" (cf. https://github.com/devcontainers/features/tree/main/src/python ) apt-get install -y flake8 python3-autopep8 black python3-yapf mypy pydocstyle pycodestyle bandit pipenv virtualenv python3-pytest pylint +# OpenJDK 21, via APT +# Set JAVA_HOME environment variable system-wide, since some tools rely on it (e.g., Bazel's rules_java) +apt-get install -y openjdk-21-jdk-headless="${openjdk_21_version}*" +export JAVA_HOME="$(dirname $(dirname $(realpath $(which javac))))" +echo "export JAVA_HOME=\"$(dirname $(dirname $(realpath $(which javac))))\"" > /etc/profile.d/java_home.sh + # Bazelisk, directly from GitHub # Using the existing devcontainer feature is not optimal: # - it does not check the SHA256 checksum of the downloaded file diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh index e135541..162b117 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh @@ -41,6 +41,10 @@ check "validate buildifier is working and has the correct version" bash -c "buil check "validate starpls is working and has the correct version" bash -c "starpls version | grep '${starpls_version}'" check "validate bazel-compile-commands is working and has the correct version" bash -c "bazel-compile-commands --version 2>&1 | grep '${bazel_compile_commands_version}'" +# OpenJDK +check "validate java is working and has the correct version" bash -c "java -version 2>&1 | grep '${openjdk_21_version}'" +check "validate JAVA_HOME is set correctly" bash -c 'echo $JAVA_HOME | xargs readlink -f | grep "java-21-openjdk"' + # additional developer tools check "validate gdb is working and has the correct version" bash -c "gdb --version | grep '${gdb_version}'" check "validate gh is working and has the correct version" bash -c "gh --version | grep '${gh_version}'" diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml b/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml index 7c8cb85..d06a163 100644 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml @@ -25,6 +25,9 @@ gdb: gh: version: "2.45.0" +openjdk_21: + version: "21.0.9" + bazel: # https://github.com/bazelbuild/bazel/releases -- latest version as of 2025-09-24 version: 8.4.1 diff --git a/scripts/test-utils.sh b/src/s-core-devcontainer/test-project/test-utils.sh similarity index 100% rename from scripts/test-utils.sh rename to src/s-core-devcontainer/test-project/test-utils.sh diff --git a/src/s-core-devcontainer/test-project/test.sh b/src/s-core-devcontainer/test-project/test.sh index 1afeb65..be6e55f 100755 --- a/src/s-core-devcontainer/test-project/test.sh +++ b/src/s-core-devcontainer/test-project/test.sh @@ -3,7 +3,8 @@ set -euo pipefail SCRIPT_PATH=$(readlink -f "$0") SCRIPT_DIR=$(dirname -- "${SCRIPT_PATH}") -source "${SCRIPT_DIR}/../../../scripts/test-utils.sh" vscode + +source "test-utils.sh" vscode # C++ tooling check "validate clangd is working and has the correct version" bash -c "clangd --version | grep '20.1.8'"