Right now there is no better way to do this. We know it's fragile and we would like to find a better mechanism that would be easier to keep compatible in the long term.
BTW you shouldn't tough the output of javaCompile. you should simply have your own task consume javaCompile's output. Put its own output somewhere, and change the Dex task. On Wed, May 6, 2015 at 9:59 AM, Ariel Cattan <[email protected]> wrote: > Hey guys, > > > I'm currently writing a Gradle plugin to be used within Android Studio, > and I need to add some steps (new tasks) to the Android build flow. > The Android build runs many tasks, but let’s assume for simplicity that it > runs the javaCompile task, and then the Dex task. > The Dex task uses the output of the javaCompile task. So we have: > > javaCompile > Dex (very simplified) > > Now, I would like to add a step in the middle, so that it works like this: > > javaCompile > MyTask > Dex > > In other words, I would like to have MyTask work on the output of > javaCompile, produce a new output, and have the Dex task use the output of > MyTask instead of the output of javaCompile. > I was able to change the output folder of the javaCompile task, but then > the Dex task took its files from the new folder, which was not what I > wanted. > Eventually I was able to change the input directory of the Dex task, so > that it takes its files from MyTask instead of javaCompile. However, I did > it by looking at the Android plugin source code, and relied on the fact > that the Dex task had an inputDir variable which I was able to set. This > means that if Google decide to change their implementation later on – my > plugin may stop working. > I was wondering whether there was a better way of achieving what I wanted > without relying at all on the internals of the Android implementation. > > Thanks! > Ariel > > -- > You received this message because you are subscribed to the Google Groups > "adt-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. http://developer.android.com | http://tools.android.com Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
