Is it possible to add some code in gradle source code?

Hi all,

I’m very new in gradle. Could someone help to to solve my question? Thanks a lot in advance. Below is my question:

I’ve download the gradle source code and need to add some codes in it.

Ex: I may need to add “command.add(”-X");" in AndroidBuilder.java which is located in /home/xxxxx/gradle/build/builder/src/main/java/com/android/builder

in the gradle source code.

However, I don’t know how to re-compile the AndroidBuilder.java after adding special code. Could someone give me some directions? Thanks a lot.

Hi,

This doesn’t quite make sense as a thing to do. Doing something like this means you’ll have to maintain your own version of the Android SDK and this isn’t something you want to do.

I suggest asking for help on the ADT Google Group. You are also likely to get better help if you explain your problem to them instead of your desired solution.

Hi Luke,

Thanks a lot for your help, but coudl you please tell me how to do this thing?

Or how could I do if I just want to do println some message in AndroidBuilder.java?

And then this message will be showed in the terminal if I execute “gradle build --debug”

to build this android project.

Thanks a lot.

Sincerely,

Eason

You will have to checkout the Android SDK source code, make your changes, build the binaries, push the binaries to somewhere where your project can find them, configure your project to use this custom build.

Dear Luke,

I think I may misunderstand somthing on your comment. Coudl you please give me some directions again? Thanks a lot.

The detailed question is :

(1)I’ve done build one android project using “gradle assemble --debug” command. (2)From the build log, I found I need to add one flag during the compilation. (3)After downloading the gradle source code from http://www.gradle.org/downloads (gradle-1.6-all.zip), I found the flag can be added in AndroidBuilder.java which is located in gradle-1.6-all directory, instead of the android sdk directory. (4)I need to find ways to re-compile AndroidBuilder.java for custom build. (5)If my thoughts are incorrect, please correct me.

Thank you.

Sincerely,

Eason

5 is the case. You are going the very long and painful way about this.

I suggest asking for help on the ADT Google Group. You are also likely to get better help if you explain your problem to them instead of your desired solution.