Gradle ANTLR Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Gradle Plugins =Overview=")
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* https://docs.gradle.org/current/userguide/antlr_plugin.html
=Internal=
=Internal=


* [[Gradle_Plugins#Plugin_List|Gradle Plugins]]
* [[Gradle_Plugins#Plugin_List|Gradle Plugins]]
* [[ANTLR#Gradle_Plugin|ANTLR]]


=Overview=
=Overview=
ANTLR integrates well with Gradle. A typical layout for a project that relies on an ANTL grammar and associated artifacts is to develop the grammar and the artifacts in a separate module (antlr-grammar) and declare dependencies on the module from all modules that rely on the artifacts.
=Recipe=
1. Declare an 'antlr-grammar' module. The build.gradle build script of the module is similar to:
<syntaxhighlight lang='groovy'>
apply plugin: 'antlr'
dependencies {
    antlr 'org.antlr:antlr4:4.7.1'
}
</syntaxhighlight>
2. Place the grammar in the module's ./src/main/antlr.
3. Other modules depending on grammar-related artifacts should declare their dependencies as follows:
<syntaxhighlight lang='groovy'>
apply plugin: 'java'
dependencies {
    implementation project(':antlr-grammar')
}
</syntaxhighlight>

Latest revision as of 20:26, 19 July 2018

External

Internal

Overview

ANTLR integrates well with Gradle. A typical layout for a project that relies on an ANTL grammar and associated artifacts is to develop the grammar and the artifacts in a separate module (antlr-grammar) and declare dependencies on the module from all modules that rely on the artifacts.

Recipe

1. Declare an 'antlr-grammar' module. The build.gradle build script of the module is similar to:

apply plugin: 'antlr'

dependencies {

    antlr 'org.antlr:antlr4:4.7.1'
}

2. Place the grammar in the module's ./src/main/antlr.

3. Other modules depending on grammar-related artifacts should declare their dependencies as follows:

apply plugin: 'java'

dependencies {

    implementation project(':antlr-grammar')
}