• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

melix/antlr4-gradle-plugin: Antlr4 plugin for Gradle

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

melix/antlr4-gradle-plugin

开源软件地址(OpenSource Url):

https://github.com/melix/antlr4-gradle-plugin

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

Antlr4 Gradle Plugin

Build Status

This plugin is unmaintained. Since its release official support for Antlr 4 has been added to Gradle. See https://docs.gradle.org/current/userguide/antlr_plugin.html#header

The antlr4-gradle-plugin provides an easy way to generate grammars with Antlr4 using Gradle.

Installation

Use the following snippet inside a Gradle build file:

build.gradle
buildscript {
    repositories {
        maven {
            name 'JFrog OSS snapshot repo'
            url  'https://oss.jfrog.org/oss-snapshot-local/'
        }
        jcenter()
    }

    dependencies {
        classpath 'me.champeau.gradle:antlr4-gradle-plugin:0.1'
    }
}

repositories {
   jcenter()
}

apply plugin: 'me.champeau.gradle.antlr4'

Configuration

The plugin adds a new task named antlr4. This task exposes 5 properties as part of its configuration

source

where the source grammars are. Type: File. Default: src/main/antlr4.

output

where generated sources go. Type: File. Default: $buildDir/generated-src.

listener

generate parse tree listener. Type: boolean. Default: true

visitor

generate parse tree visitor. Type: boolean. Default: true

extraArgs

extra arguments to pass to the antlr4 tool. Type: List. Default: empty. Example: extraArgs=['-Werror']

Usage

Basic generation

Generating grammars can be done by calling the antlr4 task:

gradle antlr4

Dependency on generated sources

In general, you will want your main project to depend on the generated sources for compilation. You can easily do this by adding this configuration into your build.gradle:

build.gradle
// make the Java compile task depend on the antlr4 task
compileJava.dependsOn antlr4

// add the generated source files to the list of java sources
sourceSets.main.java.srcDirs += antlr4.output

// add antlr4 to classpath
configurations {
   compile.extendsFrom antlr4
}



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap