1Some of the SDK tools sources have moved out of the sdk.git project.
2They are no longer found here.
4Instead they can be found in the tools/base.git and the tools/swt.git projects.
5If you need to view/change the source and lack these folders, you can bring
6them by using a repo init command such as:
8$ repo init -u https://android.googlesource.com/platform/manifest -g all,-notdefault,tools
9$ repo sync [-j N]
11The libraries that are sourced in tools/base and tools/swt are converted to
12prebuilts which are located in prebuilts/devtools. These prebuilts are the
13ones being used when doing a "make sdk".
171- I don't build full SDKs but I want to change tool X:
20Let's say as an example you want to change lint.
21It's now located in tools/base/lint.
23To build it from the command-line, you'd use "gradle" as such:
25$ cd tools/base
26$ ./gradlew lint:build
28Output is located in $TOP/out/host/gradle/tools/base/lint/libs/
31- Gradle is a build system, a bit like make or ant.
32 If you want to know more, visit http://www.gradle.org/
34- On Windows with the CMD shell, use ./gradlew.bat.
35 For Cygwin, Linux or Mac, use ./gradlew.
37- Gradle targets are in the form "project-name:task-name".
38 To get a list of possible tasks, try this: $ ./gradlew lint:tasks
40- Generally there are only 2 task names to remember:
41 $ ./gradlew lint:assemble ==> builds but do not run tests.
42 $ ./gradlew lint:check ==> runs tests and checks such as findbugs.
44- To find the list of project-names you can use with gradle:
45 $ ./gradlew projects
47The new moved projects are unsurprisingly named like their former "make"
48counterparts. They are split between 2 repos:
49- tools/swt contains all SWT-dependent projects.
50- tools/base contains all other non-SWT projects.
52However that means that when you want to modify a project using both repos,
53you need an extra step.
55For example, the SDK Manager UI is located in /tools/swt/sdkmanager.
56However it does depend on /tools/base/sdklib. Let's say you want to
57make a change in both sdklib and sdkuilib. Here are the steps:
59$ # Edit tools/base/sdklib files.
60$ cd tools/base ; ./gradlew sdklib:publishLocal
61 => this builds sdklib and "publishes" an sdklib.JAR into a local maven
62 repo located in the out/gradle folder. Note that this is just a
63 temporary build artifact and is NOT used by "make sdk".
65$ # Edit tools/swt/sdkmanager/sdkuilib files to use the changes from sdklib.
66$ cd ../../tools/swt ; ./gradlew sdkuilib:assemble
67 => this builds sdkuilib by using the local JAR of sdklib that is
68 located in the out/gradlew folder.
732- How do I change some tools sources and build a new SDK using these?
76Let's say you changed something in tools/base/lint and run "make sdk" from
77the top dir. Your changes will NOT be included in the resulting SDK.
79That's because the SDK has been changed to only rely on the prebuilts located
80in /prebuilts/devtools. There are pros and cons with this approach and we're
81not going to discuss them here. Instead we'll focus on what you need to do.
83It's fairly simple. Go back to the top dir on your Android tree and run:
85$ prebuilts/devtools/update_jars.sh -f
86$ make sdk
88Now your changes are included in the generated SDK.
90What you should know about the update_jars.sh script:
91- Without argument, it prints what it would do but does nothing.
92 Use the "-f" argument to make it build/copy stuff.
94- It builds indiscriminiately. It just builds ALL the libs from
95 tools/base and tools/swt and updates all the JARs under prebuilts/devtools.
96 That should only take 20-30 seconds though. Eventually we'll work on
97 making it smarter because obviously we don't want anyone to just try
98 to submit 30 JARs just because their timestamp changed.
100- It generates a git merge msg in prebuilts/devtools that has the sha1
101 of the corresponding tools/base and tools/swt projects.
102 Use option -m to prevent this.
107Need a place to discuss all this?
108http://groups.google.com/group/adt-dev is the right place.
110--- RM 20130409