-
Notifications
You must be signed in to change notification settings - Fork 17
feat: unify ANTLR setup and add pre_push make target #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
giospada
wants to merge
10
commits into
substrait-io:main
Choose a base branch
from
giospada:feat/build-unify-setup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8a45dca
feat: unify ANTLR setup and add pre_push make target
giospada 9a2957a
fix: runned pre_push
giospada 39d5569
fix: update ANTLR setup
giospada abd34d9
fix: docker build
giospada c6736fb
fix: changed path handling
giospada 8954df0
fix: make ANTLR setup script work in Docker container
giospada 3b633ef
fix: removed rm operation
giospada 1fce1dd
Merge branch 'main' into feat/build-unify-setup
giospada 968d93a
Update script path for code generation
giospada b82d66f
Fix codegen target dependencies in Makefile
giospada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| codegen: antlr codegen-proto codegen-extensions codegen-version | ||
| setup-antlr: | ||
| @bash scripts/setup_antlr.sh > /dev/null | ||
|
|
||
|
|
||
| antlr: | ||
|
|
||
| antlr: setup-antlr | ||
| cd third_party/substrait/grammar \ | ||
| && java -jar ${ANTLR_JAR} -o ../../../src/substrait/gen/antlr -Dlanguage=Python3 SubstraitType.g4 \ | ||
| && java -jar ../../../lib/antlr-complete.jar -o ../../../src/substrait/gen/antlr -Dlanguage=Python3 SubstraitType.g4 \ | ||
| && rm ../../../src/substrait/gen/antlr/*.tokens \ | ||
| && rm ../../../src/substrait/gen/antlr/*.interp | ||
|
|
||
|
|
@@ -13,7 +15,7 @@ codegen-version: | |
| && echo '"' >> src/substrait/gen/version.py | ||
|
|
||
| codegen-proto: | ||
| ./gen_proto.sh | ||
| ./scripts/gen_proto.sh | ||
|
|
||
| codegen-extensions: | ||
| uv run --with datamodel-code-generator datamodel-codegen \ | ||
|
|
@@ -32,3 +34,7 @@ lint_fix: | |
|
|
||
| format: | ||
| uvx [email protected] format | ||
|
|
||
| codegen: format lint_fix antlr codegen-proto codegen-extensions codegen-version | ||
| uv sync --extra test | ||
| uv run pytest | ||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/bin/bash | ||
| # Setup ANTLR for Substrait Python | ||
| # Usage: setup_antlr.sh [ANTLR_JAR_DIR] | ||
| # If ANTLR_JAR_DIR is not provided, defaults to project root/lib | ||
|
|
||
| set -e | ||
|
|
||
| ANTLR_VERSION="4.13.2" | ||
|
|
||
| # Determine ANTLR_JAR_DIR | ||
| if [ -n "$1" ]; then | ||
| # Use provided argument | ||
| ANTLR_JAR_DIR="$1" | ||
| else | ||
| ANTLR_JAR_DIR="lib" | ||
| fi | ||
|
|
||
| ANTLR_JAR="${ANTLR_JAR_DIR}/antlr-complete.jar" | ||
| ANTLR_URL="https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar" | ||
| VERSION_FILE="${ANTLR_JAR_DIR}/.antlr_version" | ||
|
|
||
| echo "Setting up ANTLR ${ANTLR_VERSION}..." >&2 | ||
|
|
||
| # Create directory if it doesn't exist | ||
| mkdir -p "${ANTLR_JAR_DIR}" | ||
|
|
||
| # Check if installed version matches required version | ||
| INSTALLED_VERSION="" | ||
| if [ -f "${VERSION_FILE}" ]; then | ||
| INSTALLED_VERSION=$(cat "${VERSION_FILE}") | ||
| fi | ||
|
|
||
| if [ "${INSTALLED_VERSION}" = "${ANTLR_VERSION}" ] && [ -f "${ANTLR_JAR}" ]; then | ||
| echo "ANTLR ${ANTLR_VERSION} is already installed" >&2 | ||
| else | ||
| echo "Downloading ANTLR ${ANTLR_VERSION}..." >&2 | ||
| rm -f "${ANTLR_JAR}" | ||
| if ! curl -s -L -f -o "${ANTLR_JAR}" "${ANTLR_URL}"; then | ||
| echo "Failed to download ANTLR from ${ANTLR_URL}" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "${ANTLR_VERSION}" > "${VERSION_FILE}" | ||
| echo "ANTLR ${ANTLR_VERSION} downloaded successfully" >&2 | ||
| fi | ||
|
|
||
| # Output the path so it can be captured | ||
| echo "${ANTLR_JAR}" |
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand why this hardcoded path will always work..
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script is designed to download the ANTLR JAR file to that specific,
project dir/lib. This approach is consistent with the relative path used for the ../../../src directory.