Apply JavaCC plugin for Gradle. The top-level build.gradle should look something like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'ca.coglinc:javacc-gradle-plugin:2.3.1'
}
}
Apply the plug-in in the module's build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'ca.coglinc.javacc'
Make your Java compilation tasks depend on compileJavacc task and add Java files generated by Javacc to your source path:
android {
// ...
sourceSets {
main {
java.srcDir compileJavacc.outputDirectory
}
}
applicationVariants.all { variant ->
variant.javaCompile.dependsOn compileJavacc
}
// ...
}
When integrating into an Android library, replace applicationVariants with libraryVariants.
Finally, install JavaCC IntelliJ plug-in to enable syntax highlighting.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'ca.coglinc:javacc-gradle-plugin:2.3.1'
}
}
Apply the plug-in in the module's build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'ca.coglinc.javacc'
android {
// ...
sourceSets {
main {
java.srcDir compileJavacc.outputDirectory
}
}
applicationVariants.all { variant ->
variant.javaCompile.dependsOn compileJavacc
}
// ...
}
When integrating into an Android library, replace applicationVariants with libraryVariants.
Finally, install JavaCC IntelliJ plug-in to enable syntax highlighting.
No comments:
Post a Comment