Skip to content

Commit 8954df0

Browse files
committed
fix: make ANTLR setup script work in Docker container
1 parent c6736fb commit 8954df0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ RUN curl -s "https://get.sdkman.io" | bash
44
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && \
55
sdk install java 25-graalce"
66
COPY scripts/setup_antlr.sh /tmp/setup_antlr.sh
7-
RUN bash /tmp/setup_antlr.sh && rm /tmp/setup_antlr.sh
8-
ENV ANTLR_JAR="lib/antlr-complete.jar"
7+
RUN bash /tmp/setup_antlr.sh ~/lib && rm /tmp/setup_antlr.sh
8+
ENV ANTLR_JAR="~/lib/antlr-complete.jar"
99
# protoc 29.5 is the last version with protobuf python v5 which is compatible with protoletariat v3
1010
RUN cd ~ && curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v29.5/protoc-29.5-linux-x86_64.zip && \
1111
unzip protoc-29.5-linux-x86_64.zip -d ~/.local && \

scripts/setup_antlr.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
#!/bin/bash
22
# Setup ANTLR for Substrait Python
3+
# Usage: setup_antlr.sh [ANTLR_JAR_DIR]
4+
# If ANTLR_JAR_DIR is not provided, defaults to project root/lib
35

46
set -e
57

68
ANTLR_VERSION="4.13.2"
7-
# Get the project root (parent of scripts directory)
8-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9-
PROJECT_ROOT="$(dirname "${SCRIPT_DIR}")"
10-
ANTLR_JAR_DIR="${PROJECT_ROOT}/lib"
9+
10+
# Determine ANTLR_JAR_DIR
11+
if [ -n "$1" ]; then
12+
# Use provided argument
13+
ANTLR_JAR_DIR="$1"
14+
else
15+
ANTLR_JAR_DIR="lib"
16+
fi
17+
1118
ANTLR_JAR="${ANTLR_JAR_DIR}/antlr-complete.jar"
1219
ANTLR_URL="https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar"
1320
VERSION_FILE="${ANTLR_JAR_DIR}/.antlr_version"

0 commit comments

Comments
 (0)