Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude .g4 files under spark from repository #2680

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions spark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,47 @@ repositories {
mavenCentral()
}

tasks.register('downloadG4Files', Exec) {
tasks.register('downloadG4Files') {
description = 'Download remote .g4 files from GitHub'

executable 'curl'
// use doLast to wait the completion of command execution
doLast {
project.exec {
executable 'curl'

args '-o', 'src/main/antlr/FlintSparkSqlExtensions.g4', 'https://raw.githubusercontent.com/opensearch-project/opensearch-spark/main/flint-spark-integration/src/main/antlr4/FlintSparkSqlExtensions.g4'
args '-o', 'src/main/antlr/SparkSqlBase.g4', 'https://raw.githubusercontent.com/opensearch-project/opensearch-spark/main/flint-spark-integration/src/main/antlr4/SparkSqlBase.g4'
args '-o', 'src/main/antlr/SqlBaseParser.g4', 'https://raw.githubusercontent.com/apache/spark/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4'
args '-o', 'src/main/antlr/SqlBaseLexer.g4', 'https://raw.githubusercontent.com/apache/spark/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4'
args '-o', 'src/main/antlr/FlintSparkSqlExtensions.g4', 'https://raw.githubusercontent.com/opensearch-project/opensearch-spark/main/flint-spark-integration/src/main/antlr4/FlintSparkSqlExtensions.g4'
args '-o', 'src/main/antlr/SparkSqlBase.g4', 'https://raw.githubusercontent.com/opensearch-project/opensearch-spark/main/flint-spark-integration/src/main/antlr4/SparkSqlBase.g4'
args '-o', 'src/main/antlr/SqlBaseParser.g4', 'https://raw.githubusercontent.com/apache/spark/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4'
args '-o', 'src/main/antlr/SqlBaseLexer.g4', 'https://raw.githubusercontent.com/apache/spark/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4'
}
project.exec {
executable 'ls'

args '-l', 'src/main/antlr/'
}
}
}
clean.delete fileTree('src/main/antlr/') { include '*.g4' }

generateGrammarSource {
arguments += ['-visitor', '-package', 'org.opensearch.sql.spark.antlr.parser']
source = sourceSets.main.antlr
outputDirectory = file("build/generated-src/antlr/main/org/opensearch/sql/spark/antlr/parser")
}
tasks.register('checkGrammarSource') {
description = 'temporal'

doLast {
project.exec {
executable 'ls'

args '-l', 'build/generated-src/antlr/main/org/opensearch/sql/spark/antlr/parser'
}
}
}
checkGrammarSource.dependsOn generateGrammarSource
compileJava.dependsOn checkGrammarSource

configurations {
compile {
extendsFrom = extendsFrom.findAll { it != configurations.antlr }
Expand Down
2 changes: 2 additions & 0 deletions spark/src/main/antlr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .g4 files are downloaded from other repositories during build
*.g4
205 changes: 0 additions & 205 deletions spark/src/main/antlr/FlintSparkSqlExtensions.g4

This file was deleted.

Loading
Loading