Skip to content

[build] Fix for #4647: get Antlr4 Tool .jar from github.#4821

Merged
teverett merged 4 commits into
antlr:masterfrom
kaby76:g4-4647-updated
May 2, 2026
Merged

[build] Fix for #4647: get Antlr4 Tool .jar from github.#4821
teverett merged 4 commits into
antlr:masterfrom
kaby76:g4-4647-updated

Conversation

@kaby76
Copy link
Copy Markdown
Contributor

@kaby76 kaby76 commented Apr 19, 2026

This PR fixes #4647, where builds would fail due to Maven Central rejecting download requests, typically during a weekday afternoon. To fix this, a copy of the antlr4-tools Python package was added to the repo, and the tool was modified to work against github.com instead of Maven Central. This is the best way to avoid download problems because Maven Central rejects download requests when it is heavily loaded, whereas GitHub does not. Besides, the Antlr.org download page itself points to GitHub, not Maven Central (https://www.antlr.org/download.html, last sentence on webpage). This change also eliminates the extra dependency on the external antlr4 Python wrapper tool. Builds will still fail when other servers are heavily loaded, but it's less likely to occur.

@kaby76 kaby76 marked this pull request as ready for review April 19, 2026 15:07
Copilot AI review requested due to automatic review settings April 19, 2026 15:07
@kaby76 kaby76 marked this pull request as draft April 19, 2026 15:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR vendors a modified copy of the antlr4-tools Python package into the repository and updates CI to install it from the local _scripts/antlr4-tools directory, aiming to avoid Maven Central flakiness by downloading the ANTLR tool jar from GitHub instead.

Changes:

  • Add a vendored antlr4-tools package under _scripts/antlr4-tools, including a modified antlr4_tool_runner.py that fetches the ANTLR jar from GitHub and adds retry behavior.
  • Update GitHub Actions workflow to pip install _scripts/antlr4-tools (local install) and show the installed package info.
  • Minor markdown formatting change in abb/readme.md.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
abb/readme.md Minor formatting (trailing blank line).
_scripts/antlr4-tools/setup.py Adds local packaging metadata/entrypoints for the vendored antlr4-tools.
_scripts/antlr4-tools/developer-cert-of-origin.txt Adds DCO text file for the vendored package directory.
_scripts/antlr4-tools/antlr4_tool_runner.py Implements GitHub-based jar fetch with retries and local caching; provides antlr4/antlr4-parse entrypoints.
_scripts/antlr4-tools/README.md Adds documentation for using the tool and Windows notes.
_scripts/antlr4-tools/LICENSE Adds MIT license text for the vendored package.
.github/workflows/main.yml Switches CI to install antlr4-tools from the vendored local path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread _scripts/antlr4-tools/antlr4_tool_runner.py
Comment thread _scripts/antlr4-tools/antlr4_tool_runner.py Outdated
Comment thread _scripts/antlr4-tools/antlr4_tool_runner.py
Comment thread _scripts/antlr4-tools/antlr4_tool_runner.py Outdated
Comment thread _scripts/antlr4-tools/antlr4_tool_runner.py Outdated
Comment thread _scripts/antlr4-tools/setup.py Outdated
…and UX.

- Replace sonatype.com version lookup with GitHub Releases API
- Add os.path.isdir check before falling back to cached versions
- Fix version_dirs.pop() to version_dirs[0] (reverse-sorted list)
- Add missing import time; remove unused import argparse
- Replace argparse -v handling with manual argv scan to avoid -visitor conflict
- Fix HTTPError/URLError catch order (HTTPError is subclass of URLError)
- Break immediately on HTTPError (no retry); print friendly message on 404
- Print "Using ANTLR version X" on every invocation
- Remove unused find_packages import from setup.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kaby76 kaby76 marked this pull request as ready for review April 19, 2026 15:32
@teverett
Copy link
Copy Markdown
Member

teverett commented May 2, 2026

@kaby76 thanks

@teverett teverett merged commit 08022df into antlr:master May 2, 2026
37 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.

[Build] Maven Central unreliable in builds.

3 participants