Skip to content

Use native Bazel commands for live GraalVM development - #67

Merged
Sam Gammon (sgammon) merged 3 commits into
mainfrom
feat/native-graal-dev
Nov 28, 2026
Merged

Sam Gammon (sgammon) merged 3 commits into
mainfrom
feat/native-graal-dev

Conversation

@sgammon

Copy link
Copy Markdown
Member

Use Bazel's dev configuration to select live GraalVM checkouts next to rules_mx.

bazel test --config=dev @graal//graalpython:jvm_standalone_test

The repository rule generates the mx and Gazelle overlay inside Bazel's external repository. It watches file additions, removals and suite metadata. Edits to existing sources go directly into the compile and test graph. An ignored user.bazelrc can enable the configuration for plain Bazel commands.

The existing CI qualification uses the same Bazel profile. It edits Truffle, runs GraalJS and GraalPy, checks the five affected test results are cached on repeat, and tests the relocated GraalPy standalone.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment on lines +151 to +156
roots = tuple(watch_dirs)
for path, source in sources.items():
for parent in source.parents:
if parent in roots:
break
watch_dirs.add(parent)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 New sources missed in empty directories

When a developer adds a source to an existing empty subdirectory, scan has left that directory unwatched. The addition leaves the watched parent listing unchanged, so Bazel keeps using a graph without the new source.

Learn more

The live repository links in only the files listed by scan. Bazel refreshes the repository when one of the directory listings registered by _live_repository_impl changes. Each listing covers immediate entries only. A directory with no inventoried files beneath it never gets registered unless it is a checkout or suite root.

Example: Create an empty fixture subdirectory, query the live Truffle targets, and then add a SimpleLanguage fixture to that subdirectory without staging it. A second query still omits the target that the fixture generator would emit, because the only changed directory listing was not registered.

Recommended fix: Inventory watchable directories independently of inventoried files, including empty source directories. Keep Git internals out of that traversal. Add a qualification case that creates a fixture in a directory that was empty during the previous fetch and queries its new target without forcing a refresh.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread graal/live_repository.bzl
Comment on lines +12 to +14
helper = ctx.path(ctx.attr._helper)
for label in ctx.attr._graph_inputs + ctx.attr.patches:
ctx.watch(label)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Live graph skips two cache inputs

Editing only _helper or the HSDIS lock leaves the cached live graph valid. Bazel does not watch _helper through ctx.path(), and the lock is absent from _graph_inputs. The next dev command skips updated discovery or HSDIS compatibility validation.

Learn more

The live repository runs a Python helper to discover checkouts, generate BUILD files, and run check_input_pins. That check compares each generated JSON file with its committed counterpart. The generator emits an HSDIS pin, which the compiler's disassembler targets consume through the HSDIS repository rule. Bazel 9.3.3 disables implicit watches on labels passed to ctx.path(), and neither the helper nor the committed HSDIS lock gets an explicit watch.

Example: Fetch the live repository, change just the helper's discovery logic, and run another dev query. Bazel reuses the previous BUILD files, so the query does not exercise the revised helper.

Recommended fix: Explicitly watch ctx.attr._helper and add Label("//graal:hsdis.json") to _graph_inputs. This makes a change to either file invalidate an existing fetch.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@sgammon
Sam Gammon (sgammon) merged commit b97530e into main Nov 28, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant