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

Fixes for Gradle tasks for Antlr #3079

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

hatyo
Copy link
Contributor

@hatyo hatyo commented Jan 31, 2025

This adds two fixes:

  • Puts the generated files in a directory that corresponds to their set package.
  • Creates a post-generateGrammarSource task which copies all *.token files next to the grammar and lexer files in src/main/antlr. These files are added to .gitignore to avoid checking them in by mistake.

These effectively enable the IDE to correctly parse and present the grammar files as well as the generated files, before it was showing hundreds of errors due to file location mismatch and the inability to link the grammar file with the respective tokens array.

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: ebac74a
  • Duration 0:57:05
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@alecgrieser alecgrieser marked this pull request as ready for review January 31, 2025 14:07
@alecgrieser alecgrieser self-requested a review January 31, 2025 14:07
alecgrieser
alecgrieser previously approved these changes Jan 31, 2025
Copy link
Collaborator

@alecgrieser alecgrieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one comment about cleaning these generated tokens, but this is also clearly a win, and I'm merging this one and taking a change to clean up the tokens files as a follow up

gradle/antlr.gradle Show resolved Hide resolved
@@ -21,6 +21,7 @@
apply plugin: 'antlr'

generateGrammarSource {
outputDirectory = layout.buildDirectory.dir('generated-src/antlr/main/com/apple/foundationdb/relational/generated').get().asFile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to think at some point how to make this more generic so that it accepts different package names, though for now, this should be fine. Something we will have to notice if we ever change the hardcoded package below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's cross that bridge when we reach it then.

hatyo added 2 commits February 6, 2025 18:50
* 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.
@alecgrieser alecgrieser merged commit 8de74f2 into FoundationDB:main Feb 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants