From 25274b9803add5c8bf2146e108c2dc8abe213963 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Mon, 8 Jun 2026 13:53:01 +0200 Subject: [PATCH 1/3] Update devcontainer to use maven facades --- .devcontainer/Dockerfile | 14 ------- .devcontainer/devcontainer.json | 15 ++++--- .devcontainer/setup-jdtls.sh | 52 +++++++++++++++++++++++++ .devcontainer/setup-mx.sh | 67 ++++++++++++++++++++++++++++++++ .gitignore | 4 ++ docs/contributor/CONTRIBUTING.md | 10 ++--- mx.graalpython/mx_pominit.py | 2 +- pom.xml | 2 +- 8 files changed, 140 insertions(+), 26 deletions(-) delete mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/setup-jdtls.sh create mode 100644 .devcontainer/setup-mx.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 3662a64ec1..0000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM mcr.microsoft.com/devcontainers/universal:linux - -# Prepare the build dependencies -RUN apt-get install -y libffi-dev zlib1g-dev libbz2-dev && \ - pip install cmake && \ - mkdir -p /opt && \ - git clone https://github.com/graalvm/mx /opt/mx && \ - MX_CACHE_DIR=/opt/mxcache /opt/mx/mx -p /opt/mx -y fetch-jdk -A --to /opt --jdk-id labsjdk-ce-latest && \ - rm -rf /opt/mxcache && \ - chmod -R a+w /opt/mx && \ - echo JAVA_HOME=/opt/labsjdk-ce-latest > /opt/mx/env && \ - echo MX_GLOBAL_ENV="/opt/mx/env" >> /etc/profile && \ - echo MX_CACHE_DIR="/opt/mx/cache" >> /etc/profile && \ - echo PATH="/opt/mx:/opt/labsjdk-ce-latest/bin/:\$PATH" >> /etc/profile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index acf98e2a25..457aeccc78 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,8 +1,15 @@ { "name": "GraalPy", - "build": { "dockerfile": "Dockerfile" }, + "image": "mcr.microsoft.com/devcontainers/universal:linux", + "remoteEnv": { + "MX_GLOBAL_ENV": "${containerWorkspaceFolder}/.mxenv", + "MX_CACHE_DIR": "${containerWorkspaceFolder}/.mxcache", + "PATH": "${containerWorkspaceFolder}/.mx:${containerWorkspaceFolder}/.mx/labsjdk-ce-latest/bin:${containerEnv:PATH}" + }, "postCreateCommand": { - "hint": "echo 'GraalPy devcontainer ready. Run mx python-jvm if you need to build GraalPy for testing.'" + "install_packages": "sudo apt-get update && sudo apt-get install -y build-essential libffi-dev zlib1g-dev libbz2-dev cmake ninja-build", + "setup_mx": "bash \"${containerWorkspaceFolder}/.devcontainer/setup-mx.sh\" \"${containerWorkspaceFolder}\"", + "setup_jdtls": "bash \"${containerWorkspaceFolder}/.devcontainer/setup-jdtls.sh\" \"${containerWorkspaceFolder}\"" }, "hostRequirements": { "cpus": 2, @@ -11,11 +18,9 @@ "customizations": { "vscode": { "extensions": [ - "vscjava.vscode-java-pack", - "zoma.vscode-auto-open-workspace" + "vscjava.vscode-java-pack" ], "settings": { - "autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true, "java.autobuild.enabled": false } }, diff --git a/.devcontainer/setup-jdtls.sh b/.devcontainer/setup-jdtls.sh new file mode 100644 index 0000000000..0f9ec2e750 --- /dev/null +++ b/.devcontainer/setup-jdtls.sh @@ -0,0 +1,52 @@ +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# The Universal Permissive License (UPL), Version 1.0 +# +# Subject to the condition set forth below, permission is hereby granted to any +# person obtaining a copy of this software, associated documentation and/or +# data (collectively the "Software"), free of charge and under any and all +# copyright rights in the Software, and any and all patent rights owned or +# freely licensable by each licensor hereunder covering either (i) the +# unmodified Software as contributed to or provided by such licensor, or (ii) +# the Larger Works (as defined below), to deal in both +# +# (a) the Software, and +# +# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +# one is included with the Software each a "Larger Work" to which the Software +# is contributed by such licensors), +# +# without restriction, including without limitation the rights to copy, create +# derivative works of, display, perform, and distribute the Software and make, +# use, sell, offer for sale, import, export, have made, and have sold the +# Software and the Larger Work(s), and to sublicense the foregoing rights on +# either these or other terms. +# +# This license is subject to the following condition: +# +# The above copyright notice and either this complete permission notice or at a +# minimum a reference to the UPL must be included in all copies or substantial +# portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +#!/usr/bin/env bash + +set -euo pipefail + +JDTLS_SNAPSHOT_URL="https://download.eclipse.org/jdtls/snapshots" +DOWNLOAD_FILE=$(curl -s -L "${JDTLS_SNAPSHOT_URL}/latest.txt") +mkdir -p "/tmp/jdtls" +curl -s -L -o "/tmp/jdtls/${DOWNLOAD_FILE}" "${JDTLS_SNAPSHOT_URL}/${DOWNLOAD_FILE}" +cd /tmp/jdtls +tar xfz "/tmp/jdtls/${DOWNLOAD_FILE}" +rm "/tmp/jdtls/${DOWNLOAD_FILE}" +sudo mv "/tmp/jdtls" /opt +sudo ln -s /opt/jdtls/bin/jdtls /usr/local/bin/jdtls diff --git a/.devcontainer/setup-mx.sh b/.devcontainer/setup-mx.sh new file mode 100644 index 0000000000..7195e36102 --- /dev/null +++ b/.devcontainer/setup-mx.sh @@ -0,0 +1,67 @@ +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# The Universal Permissive License (UPL), Version 1.0 +# +# Subject to the condition set forth below, permission is hereby granted to any +# person obtaining a copy of this software, associated documentation and/or +# data (collectively the "Software"), free of charge and under any and all +# copyright rights in the Software, and any and all patent rights owned or +# freely licensable by each licensor hereunder covering either (i) the +# unmodified Software as contributed to or provided by such licensor, or (ii) +# the Larger Works (as defined below), to deal in both +# +# (a) the Software, and +# +# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +# one is included with the Software each a "Larger Work" to which the Software +# is contributed by such licensors), +# +# without restriction, including without limitation the rights to copy, create +# derivative works of, display, perform, and distribute the Software and make, +# use, sell, offer for sale, import, export, have made, and have sold the +# Software and the Larger Work(s), and to sublicense the foregoing rights on +# either these or other terms. +# +# This license is subject to the following condition: +# +# The above copyright notice and either this complete permission notice or at a +# minimum a reference to the UPL must be included in all copies or substantial +# portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +#!/usr/bin/env bash + +set -euo pipefail + +repo_dir="${1:-$PWD}" +mx_dir="$repo_dir/.mx" +jdk_dir="$mx_dir/labsjdk-ce-latest" +bootstrap_cache="$repo_dir/.mx-bootstrap-cache" + +if [[ ! -x "$mx_dir/mx" ]]; then + rm -rf "$mx_dir" + git clone https://github.com/graalvm/mx "$mx_dir" +fi + +mkdir -p "$repo_dir/.mxcache" + +if [[ ! -x "$jdk_dir/bin/java" ]]; then + MX_CACHE_DIR="$bootstrap_cache" "$mx_dir/mx" \ + -p "$mx_dir" \ + -y fetch-jdk \ + -A \ + --to "$mx_dir" \ + --jdk-id labsjdk-ce-latest + rm -rf "$bootstrap_cache" +fi + +printf 'JAVA_HOME=%s\n' "$jdk_dir" > "$repo_dir/.mxenv" +echo 'GraalPy devcontainer ready. Java editing works from the checked-in Maven POMs; run mx python-jvm for full builds and tests.' diff --git a/.gitignore b/.gitignore index 44f1e95c52..585daaafed 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,7 @@ compile_commands.json opencode.json pyrightconfig.json bench-results.json +/.mx/ +/.mxcache/ +/.mxenv +/.mx-bootstrap-cache/ diff --git a/docs/contributor/CONTRIBUTING.md b/docs/contributor/CONTRIBUTING.md index 612c1554f0..d98a03a95b 100644 --- a/docs/contributor/CONTRIBUTING.md +++ b/docs/contributor/CONTRIBUTING.md @@ -11,9 +11,9 @@ Please also take some time to review our [code of conduct](http://www.graalvm.or ### Using a Github codespace -The devcontainer we create sets up a code workspace on launch—the first time you launch the container, you will need a bit of patience. -Then, use the command palette or the File menu and select "Open Workspace from File" and select [/workspace/graalpython.code-workspace](../../../graalpython.code-workspace). -The VSCode window will reload and open GraalPy and all the related Java projects. +The devcontainer will use checked-in Maven POM facades, so basic Java editing works directly. +Use `mx python-jvm` to build, run, and test a GraalPy distribution artifact. +For full editing support, run `mx vscodeinit` and open the `graalpython.code-workspace` file that command generates. ### Setting up on your machine @@ -63,9 +63,9 @@ This will generate configurations for Eclipse, IntelliJ, and NetBeans so that yo See also the documentation in mx for [setting up your IDE](https://github.com/graalvm/mx/blob/master/docs/IDE.md). If you use another editor (such as VSCode, Emacs, or Neovim) with support for the [Eclipse language server](https://github.com/eclipse/eclipse.jdt.ls) or [Apache NetBeans language server](https://marketplace.visualstudio.com/items?itemName=ASF.apache-netbeans-java), you can also get useable development setups with that, but it's not something we explicitly support. -The checked-in Maven POMs are lightweight facades for quick Java IDE import in editors such as Eclipse, VSCode, or Eglot/JDT-LS. +The checked-in Maven POMs are lightweight facades for quick Java IDE import in editors such as Eclipse, VSCode, or any editor using JDTLS. They are not the full GraalPy build; use `mx ideinit` for the full generated IDE setup and `mx python-jvm` for the build needed to run or test GraalPy. -The facade uses a `graalvm.version` Maven range for the current release train so fresh checkouts resolve the newest available GraalVM artifacts; override `graalvm.version` locally to lock a specific version. +The facade uses the `graalvm.version` Maven property for GraalVM artifact resolution; override it locally if you need a different version. ## Development Layout diff --git a/mx.graalpython/mx_pominit.py b/mx.graalpython/mx_pominit.py index 7dc5ef436b..abc6e9ee4a 100644 --- a/mx.graalpython/mx_pominit.py +++ b/mx.graalpython/mx_pominit.py @@ -58,7 +58,7 @@ LOCAL_GROUP_ID = "${project.groupId}" LOCAL_VERSION = "${project.version}" GRAALVM_VERSION = "${graalvm.version}" -DEFAULT_GRAALVM_VERSION = "25.2.0" +DEFAULT_GRAALVM_VERSION = "25.0.0" CURRENT_GRAALVM_VERSION = "25.1.0" XML_UPL_HEADER = """