Skip to content

Commit abdd39a

Browse files
build(isthmus-cli): use official graal plugin (#512)
Replace the deprecated com.palantir.graal plugin, which was last released in June 2022 and is no longer maintained. Signed-off-by: Mark S. Lewis <[email protected]>
1 parent 9c0248a commit abdd39a

File tree

8 files changed

+50
-48
lines changed

8 files changed

+50
-48
lines changed

.github/workflows/pr.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,37 +105,33 @@ jobs:
105105
- uses: actions/checkout@v5
106106
with:
107107
submodules: recursive
108-
- uses: graalvm/setup-graalvm@v1
108+
- uses: actions/setup-java@v5
109109
with:
110-
java-version: '17'
111-
distribution: 'graalvm'
112-
# helps avoid rate-limiting issues
113-
github-token: ${{ secrets.GITHUB_TOKEN }}
110+
java-version: 21
111+
distribution: graalvm
114112
- name: Setup Gradle
115113
uses: gradle/actions/setup-gradle@v4
116114
- name: Report Java Version
117115
run: java -version
118-
- name: Install GraalVM native image
119-
run: gu install native-image
120116
- name: Build with Gradle
121117
run: |
122118
# fetch submodule tags since actions/checkout@v5 does not
123119
git submodule foreach 'git fetch --unshallow || true'
124120
125-
./gradlew nativeImage
121+
./gradlew nativeCompile
126122
- name: Smoke Test
127123
run: |
128124
./isthmus-cli/src/test/script/smoke.sh
129125
./isthmus-cli/src/test/script/tpch_smoke.sh
130126
- name: Rename the artifact to OS-unique name
131127
shell: bash
132128
run: |
133-
value=`mv isthmus-cli/build/graal/isthmus isthmus-cli/build/graal/isthmus-${{ matrix.os }}`
129+
value=`mv isthmus-cli/build/native/nativeCompile/isthmus isthmus-cli/build/native/nativeCompile/isthmus-${{ matrix.os }}`
134130
- name: Publish artifact
135131
uses: actions/upload-artifact@v4
136132
with:
137133
name: isthmus-${{ matrix.os }}
138-
path: isthmus-cli/build/graal/isthmus-${{ matrix.os }}
134+
path: isthmus-cli/build/native/nativeCompile/isthmus-${{ matrix.os }}
139135
dry-run-release:
140136
name: Dry-run release
141137
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,33 @@ jobs:
2222
- uses: actions/checkout@v5
2323
with:
2424
submodules: recursive
25-
- uses: graalvm/setup-graalvm@v1
25+
- uses: actions/setup-java@v5
2626
with:
27-
java-version: "17"
28-
distribution: "graalvm"
29-
# helps avoid rate-limiting issues
30-
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
java-version: 21
28+
distribution: graalvm
3129
- name: Setup Gradle
3230
uses: gradle/actions/setup-gradle@v4
3331
- name: Report Java Version
3432
run: java -version
35-
- name: Install GraalVM native image
36-
run: gu install native-image
3733
- name: Build with Gradle
3834
run: |
3935
# fetch submodule tags since actions/checkout@v5 does not
4036
git submodule foreach 'git fetch --unshallow || true'
4137
42-
./gradlew nativeImage
38+
./gradlew nativeCompile
4339
- name: Smoke Test
4440
run: |
4541
./isthmus-cli/src/test/script/smoke.sh
4642
./isthmus-cli/src/test/script/tpch_smoke.sh
4743
- name: Rename the artifact to OS-unique name
4844
shell: bash
4945
run: |
50-
value=`mv isthmus-cli/build/graal/isthmus isthmus-cli/build/graal/isthmus-${{ matrix.os }}`
46+
value=`mv isthmus-cli/build/native/nativeCompile/isthmus isthmus-cli/build/native/nativeCompile/isthmus-${{ matrix.os }}`
5147
- name: Publish artifact
5248
uses: actions/upload-artifact@v4
5349
with:
5450
name: isthmus-${{ matrix.os }}
55-
path: isthmus-cli/build/graal/isthmus-${{ matrix.os }}
51+
path: isthmus-cli/build/native/nativeCompile/isthmus-${{ matrix.os }}
5652
semantic-release:
5753
if: github.repository == 'substrait-io/substrait-java'
5854
runs-on: ubuntu-latest

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ antlr = "4.13.2"
33
calcite = "1.40.0"
44
commons-lang3 = "[3.18.0,)"
55
graal = "22.1.0"
6-
graal-plugin = "0.12.0"
6+
graal-plugin = "0.11.0"
77
gradle-extensions = "2.0.0"
88
guava = "33.4.8-jre"
99
httpclient5 = "5.5"
@@ -71,7 +71,7 @@ spark-sql = { module = "org.apache.spark:spark-sql_2.12", version.ref = "spark"
7171
jackson = [ "jackson-databind", "jackson-annotations", "jackson-datatype-jdk8", "jackson-dataformat-yaml" ]
7272

7373
[plugins]
74-
graal = { id = "com.palantir.graal", version.ref = "graal-plugin" }
74+
graal = { id = "org.graalvm.buildtools.native", version.ref = "graal-plugin" }
7575
gradle-extensions = { id = "com.github.vlsi.gradle-extensions", version.ref = "gradle-extensions" }
7676
jreleaser = { id = "org.jreleaser", version.ref = "jreleaser" }
7777
protobuf = { id = "com.google.protobuf", version.ref = "protobuf-plugin" }

isthmus-cli/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ Isthmus-CLI provides a native command-line interface to drive the [Isthmus](../i
66

77
## Build
88

9-
Isthmus can be built as a native executable via Graal
9+
Isthmus can be built as a native executable via Graal. This requires a GraalVM JDK to be installed, and its install location set in the `GRAALVM_HOME` environment variable.
1010

1111
```
12-
./gradlew nativeImage
12+
./gradlew nativeCompile
1313
```
1414

1515
## Usage
1616

1717
### Version
1818

1919
```
20-
$ ./isthmus-cli/build/graal/isthmus --version
20+
$ ./isthmus-cli/build/native/nativeCompile/isthmus --version
2121
2222
isthmus 0.1
2323
```
2424

2525
### Help
2626

2727
```
28-
$ ./isthmus-cli/build/graal/isthmus --help
28+
$ ./isthmus-cli/build/native/nativeCompile/isthmus --help
2929
3030
Usage: isthmus [-hV] [--outputformat=<outputFormat>]
3131
[--unquotedcasing=<unquotedCasing>] [-c=<createStatements>]...
@@ -52,7 +52,7 @@ Convert SQL Queries and SQL Expressions to Substrait
5252
### SQL to Substrait Plan
5353

5454
```
55-
> $ ./isthmus-cli/build/graal/isthmus \
55+
> $ ./isthmus-cli/build/native/nativeCompile/isthmus \
5656
-c "CREATE TABLE Persons ( firstName VARCHAR, lastName VARCHAR, zip INT )" \
5757
"SELECT lastName, firstName FROM Persons WHERE zip = 90210"
5858
@@ -183,7 +183,7 @@ Convert SQL Queries and SQL Expressions to Substrait
183183
#### Projection
184184

185185
```
186-
$ ./isthmus-cli/build/graal/isthmus -c "CREATE TABLE NATION (N_NATIONKEY BIGINT NOT NULL, N_NAME CHAR(25), N_REGIONKEY BIGINT NOT NULL, N_COMMENT VARCHAR(152))" \
186+
$ ./isthmus-cli/build/native/nativeCompile/isthmus -c "CREATE TABLE NATION (N_NATIONKEY BIGINT NOT NULL, N_NAME CHAR(25), N_REGIONKEY BIGINT NOT NULL, N_COMMENT VARCHAR(152))" \
187187
-e "N_REGIONKEY + 10"
188188
189189
{
@@ -283,7 +283,7 @@ $ ./isthmus-cli/build/graal/isthmus -c "CREATE TABLE NATION (N_NATIONKEY BIGINT
283283
#### Filter
284284

285285
```
286-
$ ./isthmus-cli/build/graal/isthmus -c "CREATE TABLE NATION (N_NATIONKEY BIGINT NOT NULL, N_NAME CHAR(25), N_REGIONKEY BIGINT NOT NULL, N_COMMENT VARCHAR(152))" \
286+
$ ./isthmus-cli/build/native/nativeCompile/isthmus -c "CREATE TABLE NATION (N_NATIONKEY BIGINT NOT NULL, N_NAME CHAR(25), N_REGIONKEY BIGINT NOT NULL, N_COMMENT VARCHAR(152))" \
287287
-e "N_REGIONKEY > 10"
288288
289289
{

isthmus-cli/build.gradle.kts

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import java.nio.charset.StandardCharsets
22

33
plugins {
4-
id("java")
54
id("idea")
5+
id("application")
66
alias(libs.plugins.graal)
77
alias(libs.plugins.spotless)
88
id("substrait.java-conventions")
@@ -24,7 +24,7 @@ dependencies {
2424
testRuntimeOnly(libs.junit.platform.launcher)
2525
implementation(libs.reflections)
2626
implementation(libs.guava)
27-
implementation(libs.graal.sdk)
27+
compileOnly(libs.graal.sdk)
2828
implementation(libs.picocli)
2929
annotationProcessor(libs.picocli.codegen)
3030
implementation(libs.protobuf.java.util) {
@@ -68,6 +68,7 @@ val initializeAtBuildTime =
6868
"io.substrait.isthmus.metadata.LambdaMetadataSupplier",
6969
"io.substrait.isthmus.metadata.LegacyToLambdaGenerator",
7070
"org.apache.calcite.config.CalciteSystemProperty",
71+
"org.apache.calcite.linq4j.tree.Primitive",
7172
"org.apache.calcite.rel.metadata.BuiltInMetadata\$AllPredicates",
7273
"org.apache.calcite.rel.metadata.BuiltInMetadata\$Collation",
7374
"org.apache.calcite.rel.metadata.BuiltInMetadata\$ColumnOrigin",
@@ -114,6 +115,8 @@ val initializeAtBuildTime =
114115
"org.apache.calcite.rel.metadata.RelMdSize",
115116
"org.apache.calcite.rel.metadata.RelMdTableReferences",
116117
"org.apache.calcite.rel.metadata.RelMdUniqueKeys",
118+
"org.apache.calcite.sql.SqlKind",
119+
"org.apache.calcite.util.BuiltInMethod",
117120
"org.apache.calcite.util.Pair",
118121
"org.apache.calcite.util.ReflectUtil",
119122
"org.apache.calcite.util.Util",
@@ -124,19 +127,26 @@ val initializeAtBuildTime =
124127
)
125128
.joinToString(",")
126129

127-
graal {
128-
mainClass("io.substrait.isthmus.cli.IsthmusEntryPoint")
129-
outputName("isthmus")
130-
graalVersion("22.1.0")
131-
javaVersion("17")
132-
option("--no-fallback")
133-
option("--initialize-at-build-time=${initializeAtBuildTime}")
134-
option("-H:IncludeResources=.*yaml")
135-
option("--report-unsupported-elements-at-runtime")
136-
option("-H:+ReportExceptionStackTraces")
137-
option("-H:DynamicProxyConfigurationFiles=${project.file("proxies.json")}")
138-
option("--features=io.substrait.isthmus.cli.RegisterAtRuntime")
139-
option("-J--enable-preview")
130+
application { mainClass.set("io.substrait.isthmus.cli.IsthmusEntryPoint") }
131+
132+
graalvmNative {
133+
binaries {
134+
toolchainDetection.set(false)
135+
136+
all { verbose.set(true) }
137+
138+
named("main") {
139+
imageName.set("isthmus")
140+
fallback.set(false)
141+
buildArgs.add("--initialize-at-build-time=${initializeAtBuildTime}")
142+
buildArgs.add("-H:IncludeResources=.*yaml")
143+
buildArgs.add("--report-unsupported-elements-at-runtime")
144+
buildArgs.add("-H:+ReportExceptionStackTraces")
145+
buildArgs.add("-H:DynamicProxyConfigurationFiles=${project.file("proxies.json")}")
146+
buildArgs.add("--features=io.substrait.isthmus.cli.RegisterAtRuntime")
147+
buildArgs.add("-J--enable-preview")
148+
}
149+
}
140150
}
141151

142152
tasks.register("writeIsthmusVersion") {

isthmus-cli/src/test/script/smoke.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu -o pipefail
44

55
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
66
cd "${parent_path}"
7-
CMD=../../../build/graal/isthmus
7+
CMD=../../../build/native/nativeCompile/isthmus
88
LINEITEM="CREATE TABLE LINEITEM (L_ORDERKEY BIGINT NOT NULL, L_PARTKEY BIGINT NOT NULL, L_SUPPKEY BIGINT NOT NULL, L_LINENUMBER INTEGER, L_QUANTITY DECIMAL, L_EXTENDEDPRICE DECIMAL, L_DISCOUNT DECIMAL, L_TAX DECIMAL, L_RETURNFLAG CHAR(1), L_LINESTATUS CHAR(1), L_SHIPDATE DATE, L_COMMITDATE DATE, L_RECEIPTDATE DATE, L_SHIPINSTRUCT CHAR(25), L_SHIPMODE CHAR(10), L_COMMENT VARCHAR(44))"
99
echo "${LINEITEM}"
1010
#set -x

isthmus-cli/src/test/script/tpch_smoke.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu -o pipefail
44

55
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
66
cd "${parent_path}"
7-
CMD=../../../build/graal/isthmus
7+
CMD=../../../build/native/nativeCompile/isthmus
88

99
TPCH="../../../../isthmus/src/test/resources/tpch"
1010

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ After you've cloned the project through git, Substrait Java is built with a tool
1111
./gradlew build
1212
```
1313

14-
To build the Isthmus executable that enables Substrait plans to be generated for a SQL statement, execute the following:
14+
To build the Isthmus executable that enables Substrait plans to be generated for a SQL statement, first ensure that you have GraalVM JDK installed and its install location set in the `GRAALVM_HOME` environment variable, then execute the following:
1515
```
16-
./gradlew nativeImage
16+
./gradlew nativeCompile
1717
```
1818

1919
## Getting Started

0 commit comments

Comments
 (0)