Monday, July 29, 2013

[android-developers] code generation task with android-gradle build system

Hi, I would like to run a task in my android-gradle based build system which will generate some Java code before compilation.

I would like it to put the generated source code in the build/ directory somewhere, like buid/src-generated

I tried the solution here:
http://forums.gradle.org/gradle/topics/source_code_generation

But this assumes the Java plugin, and I could not get this to work. It doesn't seem very elegant / simple either. I'm trying to do something like:

task generateMyCode (type:exec, dependsOn:XXX) {

     commandline <<.... run tool that puts code in $buildDir/src-generated .. >>

}

Then I can say something like

sourceSets {
    main.java.srcDirs = ['src/java', '$buildDir/src-generated']
}

Anyone have a recipe for this? Specifically, I need to know what android task (XXX) is so that my task gets fired at the right time. The generated code is the same for every variant / flavor.

Thanks

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate