I have successfully set up a very basic cloud project in android studio following this example. Further, I have added JavaCC support to the project using this gradle plugin. I can now put my *.jj files in the javacc folder and have them compiled by using the compileJavacc task from within android studio. My build.gradle
file now looks like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.14'
classpath "ca.coglinc:javacc-gradle-plugin:2.0.4"
}
}
repositories {
mavenCentral();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
apply plugin: "ca.coglinc.javacc"
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.14'
compile 'javax.servlet:servlet-api:2.5'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
}
Being a gradle and android studio beginner, I am not sure how to continue with the following:
How would I solve those two things in the most elegant way?
Thanks!
Facing exactly the same problem and experimenting with different solutions, I've chosen the one shown below.
android {
// ...
sourceSets {
main {
java.srcDirs = ['src/main/java', 'build/generated/javacc']
}
}
applicationVariants.all { variant ->
variant.javaCompile.dependsOn.add(compileJavacc)
}
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With