Skip to content

Commit

Permalink
- fix generated files packages.
Browse files Browse the repository at this point in the history
* add post task that copies .token files to fdb-relational-core/src/main/antlr
  this makes the IDE able to parse the grammar files correctly.
  • Loading branch information
hatyo committed Jan 31, 2025
1 parent 847ffe6 commit ebac74a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ fdb-environment.properties

# Docker local support
run/

# Token files required for parsing Antlr files correctly in the IDE
fdb-relational-core/src/main/antlr/*.tokens
12 changes: 12 additions & 0 deletions gradle/antlr.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
apply plugin: 'antlr'

generateGrammarSource {
outputDirectory = layout.buildDirectory.dir('generated-src/antlr/main/com/apple/foundationdb/relational/generated').get().asFile
maxHeapSize = "128m"
arguments += ['-package','com.apple.foundationdb.relational.generated', '-listener','-visitor', '-long-messages']
}
Expand All @@ -29,3 +30,14 @@ sourceSets.configureEach {
var generateGrammarSource = tasks.named(getTaskName("generate", "GrammarSource"))
java.srcDir(generateGrammarSource.map { files() })
}

generateGrammarSource.doLast {
final source = layout.buildDirectory.dir('generated-src/antlr/main/com/apple/foundationdb/relational/generated/')
final tokensFile = "*.tokens"
final dest = layout.projectDirectory.dir('src/main/antlr')
copy {
from source
include tokensFile
into dest
}
}

0 comments on commit ebac74a

Please sign in to comment.