|
| 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