janhoy opened a new pull request, #5034: URL: https://github.com/apache/solr/pull/5034
https://issues.apache.org/jira/browse/SOLR-18119 Builds on #4999 (included here as the first commits), which made `changesToHtml` resolve `python3` via `externalTool("python3")` and fail instead of silently skipping. That PR asked *"Was failing the build the right call?"* — this answers it: keep the explicit interpreter resolution, but fall back to GraalPy rather than failing. ## What changed The build runs two Python scripts, both on the default build path: `changes2html.py` (`changesToHtml` → `documentation` → `assemble`, plus the `changesHtml` artifact in the release) and `checkJavadocLinks.py` (`checkBrokenLinks`, part of `check`). Without `python3` the first silently shipped a release with no `Changes.html` and the second hard-failed `./gradlew check`. Both now run through one `PythonExecTask` (build-infra) whose interpreter is chosen once in the new `gradle/python.gradle`: 1. `-Ppython3.exe=<path>` (validated, as in #4999) 2. `python3` on `PATH` 3. GraalPy, resolved as an ordinary Gradle dependency `-Psolr.python.mode=system|graalpy|auto` forces a path; `system` never resolves GraalPy. `./gradlew pythonInfo` reports the decision. Both scripts are pure stdlib (`sys`, `re`, `pathlib`, `html.parser`), so no pip packages are involved. `changes2html.py` gains an optional output-file argument; stdout stays the default, so running it by hand is unchanged. ## Measurements (macOS, Temurin 21.0.7, GraalPy 25.4.4.1.1) | | CPython 3.13 | GraalPy | |---|---|---| | `changes2html.py` (1.6 MB CHANGELOG.md) | 0.5 s | 3.9 s | | `checkJavadocLinks.py` (8189 HTML files) | 13.6 s | 55 s | Output is **byte-identical** for both scripts, on the success path and on the broken-link failure path. Interpreter-only Truffle costs 4–8x here, not the 40x seen on compute-heavy workloads. `./gradlew check -x test` passes in both modes. GraalPy adds 153 MB / 17 jars to the Gradle cache (no `truffle-runtime`: the optimizing runtime is unsupported on a stock JDK). Cold first run 20 s including the download; warm 8 s. It is resolved **only** when actually used — verified by deleting the `org.graalvm.*` artifacts and running `--offline` in `system` mode, which succeeds. CI runners have `python3`, so nothing changes there and no workflow edits are included. ## Drive-by fixes - `-B` on both paths: the build no longer writes `__pycache__` into the source tree (previously papered over by `.gitignore`). - `changesToHtml` is now cacheable. It was not: no path sensitivity on its inputs, `script` typed as bare `def`, and `@InputDirectory siteDir` contained `__pycache__`, so the task mutated its own input. Rendering is split from assembling the `changes` directory so the two no longer share an output dir. - `-Ppython3.exe` is now honoured by `changesToHtml`, which hardcoded `"python3"`. ## Limits - Not tested on Windows. `changes2html.py` writes with an explicit `newline='\n'` and the PATH scan honours `PATHEXT`, but someone with a Windows box should confirm. - `gradle/python.gradle` is Groovy, not `.kts`: `PythonExecTask` lives in build-infra, whose classes are not importable from build scripts (hence `buildinfra.pythonExecTaskClass()`), so its properties have to be set dynamically. - Release-manager scripts under `dev-tools/scripts/` are out of scope — they need pip packages. ### AI assistance Claude Code researched, implemented and verified this change, including the GraalPy spike and the measurements above. Jan Høydahl directed the work and takes responsibility for it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
