-
Notifications
You must be signed in to change notification settings - Fork 52
Simplify Gradle scripts that use AntlrKotlinTask #221
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
Conversation
``` | ||
|
||
6. Register the `build/generatedAntlr` directory as part of the common source set. | ||
5. Use the `generateKotlinGrammarSource` task to provide an additional source directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we specify such source directory? Do we use a standard path or should it be expressly defined by the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ftomassetti I've recently learnt that Gradle is able to infer the directory path automatically thanks to the @OutputDirectory
-annotated property in the custom task. So inputting the task instance to srcDir
is all what's needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but the way in which it is phrased I interpreted to mean that when using the generateKotlinGrammarSource
we will specify the source directory we want. While instead I think that what happens is that the generateKotlinGrammarSource
target will generate Kotlin code for the lexer, parser, or combined grammars found under src/main/antlr
and all the generated code will be produced in a certain directory (which is pre-defined in the gradle plugin and the user cannot pick). What the user needs to do is to instruct gradle to consider that directory where the code is generated as a source directory.
By the way, I wonder if we should do that automatically by default.
So instead of:
Use the generateKotlinGrammarSource task to provide an additional source directory to the commonMain source set. Gradle will then infer the task dependency automatically.
I would write:
Specify that the output directory of the `generateKotlinGrammarSource` task should be included as a source directory in the commonMain source set. In Gradle, you can do that by simply reference the task itself, and Gradle will automatically infer the associated output directory and include such directory in the source set.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ftomassetti makes sense to update that sentence in the readme. Your version sounds better, indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, then I will merge it and then change the sentence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me, I have just a single comment on the README
No description provided.