17859e2e7SPaul LawrenceSome of the SDK tools sources have moved out of the sdk.git project.
27859e2e7SPaul LawrenceThey are no longer found here.
37859e2e7SPaul Lawrence
47859e2e7SPaul LawrenceInstead they can be found in the tools/base.git and the tools/swt.git projects.
57859e2e7SPaul LawrenceIf you need to view/change the source and lack these folders, you can bring
67859e2e7SPaul Lawrencethem by using a repo init command such as:
77859e2e7SPaul Lawrence
87859e2e7SPaul Lawrence$ repo init -u https://android.googlesource.com/platform/manifest -g all,-notdefault,tools
97859e2e7SPaul Lawrence$ repo sync [-j N]
107859e2e7SPaul Lawrence
117859e2e7SPaul LawrenceThe libraries that are sourced in tools/base and tools/swt are converted to
127859e2e7SPaul Lawrenceprebuilts which are located in prebuilts/devtools. These prebuilts are the
137859e2e7SPaul Lawrenceones being used when doing a "make sdk".
147859e2e7SPaul Lawrence
157859e2e7SPaul Lawrence
167859e2e7SPaul Lawrence----------
177859e2e7SPaul Lawrence1- I don't build full SDKs but I want to change tool X:
187859e2e7SPaul Lawrence----------
197859e2e7SPaul Lawrence
207859e2e7SPaul LawrenceLet's say as an example you want to change lint.
217859e2e7SPaul LawrenceIt's now located in tools/base/lint.
227859e2e7SPaul Lawrence
237859e2e7SPaul LawrenceTo build it from the command-line, you'd use "gradle" as such:
247859e2e7SPaul Lawrence
257859e2e7SPaul Lawrence$ cd tools/base
267859e2e7SPaul Lawrence$ ./gradlew lint:build
277859e2e7SPaul Lawrence
287859e2e7SPaul LawrenceOutput is located in $TOP/out/host/gradle/tools/base/lint/libs/
297859e2e7SPaul Lawrence
307859e2e7SPaul LawrenceSome comments/tips:
317859e2e7SPaul Lawrence- Gradle is a build system, a bit like make or ant.
327859e2e7SPaul Lawrence  If you want to know more, visit http://www.gradle.org/
337859e2e7SPaul Lawrence
347859e2e7SPaul Lawrence- On Windows with the CMD shell, use ./gradlew.bat.
357859e2e7SPaul Lawrence  For Cygwin, Linux or Mac, use ./gradlew.
367859e2e7SPaul Lawrence
377859e2e7SPaul Lawrence- Gradle targets are in the form "project-name:task-name".
387859e2e7SPaul Lawrence  To get a list of possible tasks, try this:  $ ./gradlew lint:tasks
397859e2e7SPaul Lawrence
407859e2e7SPaul Lawrence- Generally there are only 2 task names to remember:
417859e2e7SPaul Lawrence  $ ./gradlew lint:assemble ==> builds but do not run tests.
427859e2e7SPaul Lawrence  $ ./gradlew lint:check    ==> runs tests and checks such as findbugs.
437859e2e7SPaul Lawrence
447859e2e7SPaul Lawrence- To find the list of project-names you can use with gradle:
457859e2e7SPaul Lawrence  $ ./gradlew projects
467859e2e7SPaul Lawrence
477859e2e7SPaul LawrenceThe new moved projects are unsurprisingly named like their former "make"
487859e2e7SPaul Lawrencecounterparts. They are split between 2 repos:
497859e2e7SPaul Lawrence- tools/swt contains all SWT-dependent projects.
507859e2e7SPaul Lawrence- tools/base contains all other non-SWT projects.
517859e2e7SPaul Lawrence
527859e2e7SPaul LawrenceHowever that means that when you want to modify a project using both repos,
537859e2e7SPaul Lawrenceyou need an extra step.
547859e2e7SPaul Lawrence
557859e2e7SPaul LawrenceFor example, the SDK Manager UI is located in /tools/swt/sdkmanager.
567859e2e7SPaul LawrenceHowever it does depend on /tools/base/sdklib. Let's say you want to
577859e2e7SPaul Lawrencemake a change in both sdklib and sdkuilib. Here are the steps:
587859e2e7SPaul Lawrence
597859e2e7SPaul Lawrence$ # Edit tools/base/sdklib files.
607859e2e7SPaul Lawrence$ cd tools/base ; ./gradlew sdklib:publishLocal
617859e2e7SPaul Lawrence  => this builds sdklib and "publishes" an sdklib.JAR into a local maven
627859e2e7SPaul Lawrence     repo located in the out/gradle folder. Note that this is just a
637859e2e7SPaul Lawrence     temporary build artifact and is NOT used by "make sdk".
647859e2e7SPaul Lawrence
657859e2e7SPaul Lawrence$ # Edit tools/swt/sdkmanager/sdkuilib files to use the changes from sdklib.
667859e2e7SPaul Lawrence$ cd ../../tools/swt ; ./gradlew sdkuilib:assemble
677859e2e7SPaul Lawrence  => this builds sdkuilib by using the local JAR of sdklib that is
687859e2e7SPaul Lawrence     located in the out/gradlew folder.
697859e2e7SPaul Lawrence
707859e2e7SPaul Lawrence
717859e2e7SPaul Lawrence
727859e2e7SPaul Lawrence----------
737859e2e7SPaul Lawrence2- How do I change some tools sources and build a new SDK using these?
747859e2e7SPaul Lawrence----------
757859e2e7SPaul Lawrence
767859e2e7SPaul LawrenceLet's say you changed something in tools/base/lint and run "make sdk" from
777859e2e7SPaul Lawrencethe top dir. Your changes will NOT be included in the resulting SDK.
787859e2e7SPaul Lawrence
797859e2e7SPaul LawrenceThat's because the SDK has been changed to only rely on the prebuilts located
807859e2e7SPaul Lawrencein /prebuilts/devtools. There are pros and cons with this approach and we're
817859e2e7SPaul Lawrencenot going to discuss them here. Instead we'll focus on what you need to do.
827859e2e7SPaul Lawrence
837859e2e7SPaul LawrenceIt's fairly simple. Go back to the top dir on your Android tree and run:
847859e2e7SPaul Lawrence
857859e2e7SPaul Lawrence$ prebuilts/devtools/update_jars.sh -f
867859e2e7SPaul Lawrence$ make sdk
877859e2e7SPaul Lawrence
887859e2e7SPaul LawrenceNow your changes are included in the generated SDK.
897859e2e7SPaul Lawrence
907859e2e7SPaul LawrenceWhat you should know about the update_jars.sh script:
917859e2e7SPaul Lawrence- Without argument, it prints what it would do but does nothing.
927859e2e7SPaul Lawrence  Use the "-f" argument to make it build/copy stuff.
937859e2e7SPaul Lawrence
947859e2e7SPaul Lawrence- It builds indiscriminiately. It just builds ALL the libs from
957859e2e7SPaul Lawrence  tools/base and tools/swt and updates all the JARs under prebuilts/devtools.
967859e2e7SPaul Lawrence  That should only take 20-30 seconds though. Eventually we'll work on
977859e2e7SPaul Lawrence  making it smarter because obviously we don't want anyone to just try
987859e2e7SPaul Lawrence  to submit 30 JARs just because their timestamp changed.
997859e2e7SPaul Lawrence
1007859e2e7SPaul Lawrence- It generates a git merge msg in prebuilts/devtools that has the sha1
1017859e2e7SPaul Lawrence  of the corresponding tools/base and tools/swt projects.
1027859e2e7SPaul Lawrence  Use option -m to prevent this.
1037859e2e7SPaul Lawrence
1047859e2e7SPaul Lawrence
1057859e2e7SPaul Lawrence------
1067859e2e7SPaul Lawrence
1077859e2e7SPaul LawrenceNeed a place to discuss all this?
1087859e2e7SPaul Lawrencehttp://groups.google.com/group/adt-dev is the right place.
1097859e2e7SPaul Lawrence
1107859e2e7SPaul Lawrence--- RM 20130409
1117859e2e7SPaul Lawrence
1127859e2e7SPaul Lawrence