1 Some of the SDK tools sources have moved out of the sdk.git project. 2 They are no longer found here. 3 4 Instead they can be found in the tools/base.git and the tools/swt.git projects. 5 If you need to view/change the source and lack these folders, you can bring 6 them by using a repo init command such as: 7 8 $ repo init -u https://android.googlesource.com/platform/manifest -g all,-notdefault,tools 9 $ repo sync [-j N] 10 11 The libraries that are sourced in tools/base and tools/swt are converted to 12 prebuilts which are located in prebuilts/devtools. These prebuilts are the 13 ones being used when doing a "make sdk". 14 15 16 ---------- 17 1- I don't build full SDKs but I want to change tool X: 18 ---------- 19 20 Let's say as an example you want to change lint. 21 It's now located in tools/base/lint. 22 23 To build it from the command-line, you'd use "gradle" as such: 24 25 $ cd tools/base 26 $ ./gradlew lint:build 27 28 Output is located in $TOP/out/host/gradle/tools/base/lint/libs/ 29 30 Some comments/tips: 31 - Gradle is a build system, a bit like make or ant. 32 If you want to know more, visit http://www.gradle.org/ 33 34 - On Windows with the CMD shell, use ./gradlew.bat. 35 For Cygwin, Linux or Mac, use ./gradlew. 36 37 - Gradle targets are in the form "project-name:task-name". 38 To get a list of possible tasks, try this: $ ./gradlew lint:tasks 39 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. 43 44 - To find the list of project-names you can use with gradle: 45 $ ./gradlew projects 46 47 The new moved projects are unsurprisingly named like their former "make" 48 counterparts. They are split between 2 repos: 49 - tools/swt contains all SWT-dependent projects. 50 - tools/base contains all other non-SWT projects. 51 52 However that means that when you want to modify a project using both repos, 53 you need an extra step. 54 55 For example, the SDK Manager UI is located in /tools/swt/sdkmanager. 56 However it does depend on /tools/base/sdklib. Let's say you want to 57 make a change in both sdklib and sdkuilib. Here are the steps: 58 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". 64 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. 69 70 71 72 ---------- 73 2- How do I change some tools sources and build a new SDK using these? 74 ---------- 75 76 Let's say you changed something in tools/base/lint and run "make sdk" from 77 the top dir. Your changes will NOT be included in the resulting SDK. 78 79 That's because the SDK has been changed to only rely on the prebuilts located 80 in /prebuilts/devtools. There are pros and cons with this approach and we're 81 not going to discuss them here. Instead we'll focus on what you need to do. 82 83 It's fairly simple. Go back to the top dir on your Android tree and run: 84 85 $ prebuilts/devtools/update_jars.sh -f 86 $ make sdk 87 88 Now your changes are included in the generated SDK. 89 90 What 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. 93 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. 99 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. 103 104 105 ------ 106 107 Need a place to discuss all this? 108 http://groups.google.com/group/adt-dev is the right place. 109 110 --- RM 20130409 111 112 113