Skip to content

Commit ae76dfa

Browse files
authored
Initial commit (#1)
1 parent 22a6f12 commit ae76dfa

File tree

128 files changed

+10486
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+10486
-0
lines changed

.github/workflows/pr.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PR Build Check
2+
3+
on:
4+
pull_request:
5+
jobs:
6+
java:
7+
name: Build and Test Java
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up JDK 17
12+
uses: actions/setup-java@v2
13+
with:
14+
java-version: '17'
15+
distribution: 'adopt'
16+
- name: Build with Gradle
17+
run: ./gradlew build
18+
isthmus-native-image-mac-linux:
19+
name: Build Isthmus Native Image
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest, macOS-latest]
24+
steps:
25+
- uses: actions/checkout@v1
26+
- uses: DeLaGuardo/[email protected]
27+
with:
28+
graalvm: '22.0.0.2'
29+
java: 'java17'
30+
- run: java -version
31+
- run: gu install native-image
32+
- name: Build with Gradle
33+
run: ./gradlew nativeImage
34+
- name: Smoke Test
35+
run: ./isthmus/src/test/script/smoke.sh
36+
- name: Rename the artifact to OS-unique name
37+
shell: bash
38+
run: |
39+
value=`mv isthmus/build/graal/isthmus isthmus/build/graal/isthmus-${{ matrix.os }}`
40+
- name: Publish artifact
41+
uses: actions/upload-artifact@master
42+
with:
43+
name: isthmus-${{ matrix.os }}
44+
path: isthmus/build/graal/isthmus-${{ matrix.os }}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/target
2+
**/.gradle
3+
**/.idea
4+
**/build
5+
gen

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "spec"]
2+
path = substrait
3+
url = https://github.com/substrait-io/substrait.git

bom/build.gradle.kts

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
plugins {
18+
`java-platform`
19+
}
20+
21+
val String.v: String get() = rootProject.extra["$this.version"] as String
22+
23+
// Note: Gradle allows to declare dependency on "bom" as "api",
24+
// and it makes the contraints to be transitively visible
25+
// However Maven can't express that, so the approach is to use Gradle resolution
26+
// and generate pom files with resolved versions
27+
// See https://github.com/gradle/gradle/issues/9866
28+
29+
fun DependencyConstraintHandlerScope.apiv(
30+
notation: String,
31+
versionProp: String = notation.substringAfterLast(':')
32+
) =
33+
"api"(notation + ":" + versionProp.v)
34+
35+
fun DependencyConstraintHandlerScope.runtimev(
36+
notation: String,
37+
versionProp: String = notation.substringAfterLast(':')
38+
) =
39+
"runtime"(notation + ":" + versionProp.v)
40+
41+
javaPlatform {
42+
allowDependencies()
43+
}
44+
45+
dependencies {
46+
api(platform("com.fasterxml.jackson:jackson-bom:${"jackson".v}"))
47+
48+
// Parenthesis are needed here: https://github.com/gradle/gradle/issues/9248
49+
(constraints) {
50+
// api means "the dependency is for both compilation and runtime"
51+
// runtime means "the dependency is only for runtime, not for compilation"
52+
// In other words, marking dependency as "runtime" would avoid accidental
53+
// dependency on it during compilation
54+
55+
}
56+
}

build.gradle.kts

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import com.github.vlsi.gradle.dsl.configureEach
2+
3+
plugins {
4+
id("java")
5+
id("idea")
6+
id("com.github.vlsi.gradle-extensions") version "1.74"
7+
}
8+
9+
repositories {
10+
mavenCentral()
11+
}
12+
13+
java {
14+
toolchain {
15+
languageVersion.set(JavaLanguageVersion.of(17))
16+
}
17+
}
18+
19+
dependencies {
20+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
21+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
22+
implementation("org.slf4j:slf4j-jdk14:1.7.30")
23+
annotationProcessor("org.immutables:value:2.8.8")
24+
compileOnly("org.immutables:value-annotations:2.8.8")
25+
}
26+
27+
allprojects {
28+
repositories {
29+
mavenCentral()
30+
}
31+
32+
tasks.configureEach<Test> {
33+
useJUnitPlatform()
34+
}
35+
36+
37+
tasks.withType<JavaCompile>().configureEach {
38+
options.compilerArgs.add("--enable-preview")
39+
}
40+
41+
tasks.withType<Test>().configureEach {
42+
jvmArgs("--enable-preview")
43+
}
44+
45+
group = "io.substrait"
46+
version = "1.0-SNAPSHOT"
47+
48+
49+
50+
51+
}
52+

core/build.gradle.kts

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import com.google.protobuf.gradle.protobuf
2+
import com.google.protobuf.gradle.protoc
3+
import org.gradle.plugins.ide.idea.model.IdeaModel
4+
5+
plugins {
6+
id("java")
7+
id("idea")
8+
id("antlr")
9+
id("com.google.protobuf") version "0.8.17"
10+
}
11+
12+
dependencies {
13+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
14+
testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.0")
15+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
16+
implementation("com.google.protobuf:protobuf-java:3.17.3")
17+
implementation("com.fasterxml.jackson.core:jackson-databind:2.12.4")
18+
implementation("com.fasterxml.jackson.core:jackson-annotations:2.12.4")
19+
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.4")
20+
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.4")
21+
implementation("com.google.code.findbugs:jsr305:3.0.2")
22+
23+
24+
antlr("org.antlr:antlr4:4.9.2")
25+
implementation("org.slf4j:slf4j-jdk14:1.7.30")
26+
implementation("org.antlr:antlr4:4.9.2")
27+
annotationProcessor("org.immutables:value:2.8.8")
28+
compileOnly("org.immutables:value-annotations:2.8.8")
29+
30+
}
31+
32+
java {
33+
toolchain {
34+
languageVersion.set(JavaLanguageVersion.of(17))
35+
}
36+
}
37+
38+
sourceSets {
39+
main {
40+
proto.srcDir("../substrait/proto")
41+
resources.srcDir("../substrait/extensions")
42+
java.srcDir(file("build/generated/sources/antlr/main/java/"))
43+
}
44+
}
45+
46+
project.configure<IdeaModel> {
47+
module {
48+
resourceDirs.addAll(listOf(
49+
file("../substrait/text"),
50+
file("../substrait/extensions"),
51+
file("../substrait/proto")
52+
))
53+
generatedSourceDirs.addAll(listOf(
54+
file("build/generated/sources/antlr/main"),
55+
file("build/generated/source/proto/main/java")
56+
))
57+
}
58+
}
59+
60+
tasks.named<AntlrTask>("generateGrammarSource") {
61+
arguments.add("-package")
62+
arguments.add("io.substrait.type")
63+
arguments.add("-visitor")
64+
arguments.add("-long-messages")
65+
arguments.add("-Xlog")
66+
arguments.add("-Werror")
67+
arguments.add("-Xexact-output-dir")
68+
setSource(fileTree("src/main/antlr/SubstraitType.g4"))
69+
outputDirectory = File(buildDir, "generated/sources/antlr/main/java/io/substrait/type")
70+
}
71+
72+
protobuf {
73+
protoc {
74+
artifact = "com.google.protobuf:protoc:3.17.3"
75+
}
76+
}

0 commit comments

Comments
 (0)