在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):javacc/javaccPlugin开源软件地址(OpenSource Url):https://github.com/javacc/javaccPlugin开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):JavaCC Compiler Plugin for GradleProvides the ability to use JavaCC via Gradle. If the 'java' plugin is also applied, JavaCompile tasks will depend upon the compileJavacc task. InstallationSimply grab the plugin from Maven Central: To use the Gradle Plugins DSL, add the following lines to your plugins {
id "org.javacc.plugin.javacc-gradle" version "3.0.0"
} Refer to the Gradle Plugins portal for additional details about the installation procedure, including syntax for the Kotlin DSL and the legacy Building from sourceTo build, simply run the following command in the directory where you checked out the plugin source:
NOTE: Currently, the plugin must be built with Java 8. The plugin itself will build successfully with Java 9+, but a number of the tests will fail due to incompatibility with the Java 9+ module system. UsagePlace your JavaCC code into Place your JJTree code into You can configure the input/output directory by configuring the compileJavacc task: compileJavacc {
inputDirectory = file('src/main/javacc')
outputDirectory = file(project.buildDir.absolutePath + '/generated/javacc')
} Due to the nature of the JavaCC compiler and its use of the OUTPUT_DIRECTORY parameter, you should prefer using You can configure commandline arguments passed to JavaCC by specifying compileJavacc {
arguments = [grammar_encoding: 'UTF-8', static: 'false']
} Input/output directories and arguments can be configured as well for JJTree: compileJjtree {
inputDirectory = file('src/main/jjtree')
outputDirectory = file(project.buildDir.absolutePath + '/generated/jjtree')
arguments = [grammar_encoding: 'UTF-8', static: 'false']
} EclipseIf you are using Eclipse and would like your gradle project to compile nicely in eclipse and have the generated code in the build path, you can simply add the generated path to the main sourceSet and add a dependency on sourceSets {
main {
java {
srcDir compileJavacc.outputDirectory
}
}
}
eclipseClasspath.dependsOn("compileJavacc") Dependency on another version of JavaCCIf for some reason you need to depend on a different version of JavaCC than the plugin's default, you can use the following in your build script: dependencies {
javacc 'net.java.dev.javacc:javacc:[version]'
} Custom AST classesTo use your own custom AST classes, simply place them in your JavaCC input directory besides your regular .jj files. Make sure to include .java files:
If you prefer, you can simply have them sit in your regular java source set. Of course, a custom AST class needs to be in the same package as the original AST class it overrides. JJDocThe jjdoc {
inputDirectory = file('src/main/javacc')
outputDirectory = file(project.buildDir.absolutePath + '/generated/jjdoc')
arguments = [text: 'true']
} CompatibilityThis plugin requires Java 8+. It has been tested with Gradle 6.0.1+. Please let us know if you have had success with other versions of Gradle. SignatureThe artifacts for this plugin are signed using the PGP key for ReleasingThe following command can be used to release the project, upload to Maven Central and upload to Bintray:
Changelog3.0.0-SNAPSHOT
Breaking changes
2.4.0
2.3.1
2.3.0
2.2.2
2.2.1
2.2.0
2.1.0
2.0.4
2.0.3
2.0.2
2.0.1Fixed the gradle-plugin attribute for the Bintray package version. 2.0.0
1.0.1Updated JavaCC to 6.1.2. 1.0.0Initial version with limited features. Simply generates JavaCC files to Java from a non-configurable location into a non-configurable location. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论