xref: /aosp_15_r20/sdk/README.txt (revision 1789df15502f1991eff51ff970dce5df8404dd56)
1*1789df15SXin LiSome of the SDK tools sources have moved out of the sdk.git project.
2*1789df15SXin LiThey are no longer found here.
3*1789df15SXin Li
4*1789df15SXin LiInstead they can be found in the tools/base.git and the tools/swt.git projects.
5*1789df15SXin LiIf you need to view/change the source and lack these folders, you can bring
6*1789df15SXin Lithem by using a repo init command such as:
7*1789df15SXin Li
8*1789df15SXin Li$ repo init -u https://android.googlesource.com/platform/manifest -g all,-notdefault,tools
9*1789df15SXin Li$ repo sync [-j N]
10*1789df15SXin Li
11*1789df15SXin LiThe libraries that are sourced in tools/base and tools/swt are converted to
12*1789df15SXin Liprebuilts which are located in prebuilts/devtools. These prebuilts are the
13*1789df15SXin Liones being used when doing a "make sdk".
14*1789df15SXin Li
15*1789df15SXin Li
16*1789df15SXin Li----------
17*1789df15SXin Li1- I don't build full SDKs but I want to change tool X:
18*1789df15SXin Li----------
19*1789df15SXin Li
20*1789df15SXin LiLet's say as an example you want to change lint.
21*1789df15SXin LiIt's now located in tools/base/lint.
22*1789df15SXin Li
23*1789df15SXin LiTo build it from the command-line, you'd use "gradle" as such:
24*1789df15SXin Li
25*1789df15SXin Li$ cd tools/base
26*1789df15SXin Li$ ./gradlew lint:build
27*1789df15SXin Li
28*1789df15SXin LiOutput is located in $TOP/out/host/gradle/tools/base/lint/libs/
29*1789df15SXin Li
30*1789df15SXin LiSome comments/tips:
31*1789df15SXin Li- Gradle is a build system, a bit like make or ant.
32*1789df15SXin Li  If you want to know more, visit http://www.gradle.org/
33*1789df15SXin Li
34*1789df15SXin Li- On Windows with the CMD shell, use ./gradlew.bat.
35*1789df15SXin Li  For Cygwin, Linux or Mac, use ./gradlew.
36*1789df15SXin Li
37*1789df15SXin Li- Gradle targets are in the form "project-name:task-name".
38*1789df15SXin Li  To get a list of possible tasks, try this:  $ ./gradlew lint:tasks
39*1789df15SXin Li
40*1789df15SXin Li- Generally there are only 2 task names to remember:
41*1789df15SXin Li  $ ./gradlew lint:assemble ==> builds but do not run tests.
42*1789df15SXin Li  $ ./gradlew lint:check    ==> runs tests and checks such as findbugs.
43*1789df15SXin Li
44*1789df15SXin Li- To find the list of project-names you can use with gradle:
45*1789df15SXin Li  $ ./gradlew projects
46*1789df15SXin Li
47*1789df15SXin LiThe new moved projects are unsurprisingly named like their former "make"
48*1789df15SXin Licounterparts. They are split between 2 repos:
49*1789df15SXin Li- tools/swt contains all SWT-dependent projects.
50*1789df15SXin Li- tools/base contains all other non-SWT projects.
51*1789df15SXin Li
52*1789df15SXin LiHowever that means that when you want to modify a project using both repos,
53*1789df15SXin Liyou need an extra step.
54*1789df15SXin Li
55*1789df15SXin LiFor example, the SDK Manager UI is located in /tools/swt/sdkmanager.
56*1789df15SXin LiHowever it does depend on /tools/base/sdklib. Let's say you want to
57*1789df15SXin Limake a change in both sdklib and sdkuilib. Here are the steps:
58*1789df15SXin Li
59*1789df15SXin Li$ # Edit tools/base/sdklib files.
60*1789df15SXin Li$ cd tools/base ; ./gradlew sdklib:publishLocal
61*1789df15SXin Li  => this builds sdklib and "publishes" an sdklib.JAR into a local maven
62*1789df15SXin Li     repo located in the out/gradle folder. Note that this is just a
63*1789df15SXin Li     temporary build artifact and is NOT used by "make sdk".
64*1789df15SXin Li
65*1789df15SXin Li$ # Edit tools/swt/sdkmanager/sdkuilib files to use the changes from sdklib.
66*1789df15SXin Li$ cd ../../tools/swt ; ./gradlew sdkuilib:assemble
67*1789df15SXin Li  => this builds sdkuilib by using the local JAR of sdklib that is
68*1789df15SXin Li     located in the out/gradlew folder.
69*1789df15SXin Li
70*1789df15SXin Li
71*1789df15SXin Li
72*1789df15SXin Li----------
73*1789df15SXin Li2- How do I change some tools sources and build a new SDK using these?
74*1789df15SXin Li----------
75*1789df15SXin Li
76*1789df15SXin LiLet's say you changed something in tools/base/lint and run "make sdk" from
77*1789df15SXin Lithe top dir. Your changes will NOT be included in the resulting SDK.
78*1789df15SXin Li
79*1789df15SXin LiThat's because the SDK has been changed to only rely on the prebuilts located
80*1789df15SXin Liin /prebuilts/devtools. There are pros and cons with this approach and we're
81*1789df15SXin Linot going to discuss them here. Instead we'll focus on what you need to do.
82*1789df15SXin Li
83*1789df15SXin LiIt's fairly simple. Go back to the top dir on your Android tree and run:
84*1789df15SXin Li
85*1789df15SXin Li$ prebuilts/devtools/update_jars.sh -f
86*1789df15SXin Li$ make sdk
87*1789df15SXin Li
88*1789df15SXin LiNow your changes are included in the generated SDK.
89*1789df15SXin Li
90*1789df15SXin LiWhat you should know about the update_jars.sh script:
91*1789df15SXin Li- Without argument, it prints what it would do but does nothing.
92*1789df15SXin Li  Use the "-f" argument to make it build/copy stuff.
93*1789df15SXin Li
94*1789df15SXin Li- It builds indiscriminiately. It just builds ALL the libs from
95*1789df15SXin Li  tools/base and tools/swt and updates all the JARs under prebuilts/devtools.
96*1789df15SXin Li  That should only take 20-30 seconds though. Eventually we'll work on
97*1789df15SXin Li  making it smarter because obviously we don't want anyone to just try
98*1789df15SXin Li  to submit 30 JARs just because their timestamp changed.
99*1789df15SXin Li
100*1789df15SXin Li- It generates a git merge msg in prebuilts/devtools that has the sha1
101*1789df15SXin Li  of the corresponding tools/base and tools/swt projects.
102*1789df15SXin Li  Use option -m to prevent this.
103*1789df15SXin Li
104*1789df15SXin Li
105*1789df15SXin Li------
106*1789df15SXin Li
107*1789df15SXin LiNeed a place to discuss all this?
108*1789df15SXin Lihttp://groups.google.com/group/adt-dev is the right place.
109*1789df15SXin Li
110*1789df15SXin Li--- RM 20130409
111*1789df15SXin Li
112*1789df15SXin Li
113