Skip to content

Commit

Permalink
Initial commit (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacques-n authored Apr 9, 2022
1 parent 22a6f12 commit ae76dfa
Show file tree
Hide file tree
Showing 128 changed files with 10,486 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PR Build Check

on:
pull_request:
jobs:
java:
name: Build and Test Java
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Build with Gradle
run: ./gradlew build
isthmus-native-image-mac-linux:
name: Build Isthmus Native Image
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- uses: DeLaGuardo/setup-graalvm@5.0
with:
graalvm: '22.0.0.2'
java: 'java17'
- run: java -version
- run: gu install native-image
- name: Build with Gradle
run: ./gradlew nativeImage
- name: Smoke Test
run: ./isthmus/src/test/script/smoke.sh
- name: Rename the artifact to OS-unique name
shell: bash
run: |
value=`mv isthmus/build/graal/isthmus isthmus/build/graal/isthmus-${{ matrix.os }}`
- name: Publish artifact
uses: actions/upload-artifact@master
with:
name: isthmus-${{ matrix.os }}
path: isthmus/build/graal/isthmus-${{ matrix.os }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/target
**/.gradle
**/.idea
**/build
gen
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "spec"]
path = substrait
url = https://github.com/substrait-io/substrait.git
56 changes: 56 additions & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
`java-platform`
}

val String.v: String get() = rootProject.extra["$this.version"] as String

// Note: Gradle allows to declare dependency on "bom" as "api",
// and it makes the contraints to be transitively visible
// However Maven can't express that, so the approach is to use Gradle resolution
// and generate pom files with resolved versions
// See https://github.com/gradle/gradle/issues/9866

fun DependencyConstraintHandlerScope.apiv(
notation: String,
versionProp: String = notation.substringAfterLast(':')
) =
"api"(notation + ":" + versionProp.v)

fun DependencyConstraintHandlerScope.runtimev(
notation: String,
versionProp: String = notation.substringAfterLast(':')
) =
"runtime"(notation + ":" + versionProp.v)

javaPlatform {
allowDependencies()
}

dependencies {
api(platform("com.fasterxml.jackson:jackson-bom:${"jackson".v}"))

// Parenthesis are needed here: https://github.com/gradle/gradle/issues/9248
(constraints) {
// api means "the dependency is for both compilation and runtime"
// runtime means "the dependency is only for runtime, not for compilation"
// In other words, marking dependency as "runtime" would avoid accidental
// dependency on it during compilation

}
}
52 changes: 52 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import com.github.vlsi.gradle.dsl.configureEach

plugins {
id("java")
id("idea")
id("com.github.vlsi.gradle-extensions") version "1.74"
}

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
implementation("org.slf4j:slf4j-jdk14:1.7.30")
annotationProcessor("org.immutables:value:2.8.8")
compileOnly("org.immutables:value-annotations:2.8.8")
}

allprojects {
repositories {
mavenCentral()
}

tasks.configureEach<Test> {
useJUnitPlatform()
}


tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("--enable-preview")
}

tasks.withType<Test>().configureEach {
jvmArgs("--enable-preview")
}

group = "io.substrait"
version = "1.0-SNAPSHOT"




}

76 changes: 76 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc
import org.gradle.plugins.ide.idea.model.IdeaModel

plugins {
id("java")
id("idea")
id("antlr")
id("com.google.protobuf") version "0.8.17"
}

dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
implementation("com.google.protobuf:protobuf-java:3.17.3")
implementation("com.fasterxml.jackson.core:jackson-databind:2.12.4")
implementation("com.fasterxml.jackson.core:jackson-annotations:2.12.4")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.4")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.4")
implementation("com.google.code.findbugs:jsr305:3.0.2")


antlr("org.antlr:antlr4:4.9.2")
implementation("org.slf4j:slf4j-jdk14:1.7.30")
implementation("org.antlr:antlr4:4.9.2")
annotationProcessor("org.immutables:value:2.8.8")
compileOnly("org.immutables:value-annotations:2.8.8")

}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

sourceSets {
main {
proto.srcDir("../substrait/proto")
resources.srcDir("../substrait/extensions")
java.srcDir(file("build/generated/sources/antlr/main/java/"))
}
}

project.configure<IdeaModel> {
module {
resourceDirs.addAll(listOf(
file("../substrait/text"),
file("../substrait/extensions"),
file("../substrait/proto")
))
generatedSourceDirs.addAll(listOf(
file("build/generated/sources/antlr/main"),
file("build/generated/source/proto/main/java")
))
}
}

tasks.named<AntlrTask>("generateGrammarSource") {
arguments.add("-package")
arguments.add("io.substrait.type")
arguments.add("-visitor")
arguments.add("-long-messages")
arguments.add("-Xlog")
arguments.add("-Werror")
arguments.add("-Xexact-output-dir")
setSource(fileTree("src/main/antlr/SubstraitType.g4"))
outputDirectory = File(buildDir, "generated/sources/antlr/main/java/io/substrait/type")
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.17.3"
}
}
Loading

0 comments on commit ae76dfa

Please sign in to comment.