0

I have an Android project where some Java source files are auto-generated using a command-line tool.

How can I include this command in my Gradle script so that it is executed when I build my application?

0xF
  • 3,214
  • 1
  • 25
  • 29

1 Answers1

2

You can use Gradle's Exec task to specify a program and its arguments. Then insert the task as a dependency of the task that requires the program to have been run.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Thanks! How do I specify my task as a dependency for compilation? (the "assemble" task I guess?) – 0xF Apr 13 '16 at 19:58
  • 1
    Well, if you're building java files that need to be available before compilation, you'd want to make that happen before the task that compiles your java. http://stackoverflow.com/questions/16853130/run-task-before-compilation-using-android-gradle-plugin – Doug Stevenson Apr 13 '16 at 20:12