5

Viewing and searching the Android source code is simple. You simply visit the AndroidXRef website.

But, if you want to build and run the bleeding-edge version of Superuser, you must first download an entire Android source tree.

Imagine that I want to grab the Android "master" branch from source control.

If I follow Google's official instructions:

  • The operation will definitely take at least an hour. It may take half a day or more.
  • It will probably pull in tens of gigabytes of data. Where I live, ISPs sometimes charge an "overage fee" when users pull in tens of gigabytes of data in one month. I don't enjoy paying fees or surcharges.

In short, doing an ordinary repo sync command would probably be slow and wasteful. I don't need the entire history of Android development; and I don't have infinite disk space.

How can I check out the Android source code more quickly?

  1. I know that doing a "shallow clone" would help. How can I do this?

  2. Rakesh writes, elsewhere, that repo sync -c will help. Will it? I've read the documentation for the -c option. But I don't understand Git well enough to know whether or not the option will actually help at all. Here's a related discussion.

  3. (Optional:) Are there any other tips or tricks which can I use to speed up the checkout operation?

  4. (Optional:) In the end, how much disk space will I require in order to hold the checked-out code?

P.S. I thank durron597 for the advice s/he gave me in chat last week. Any resulting improvements which have been made to this question are all thanks to him/her.

Community
  • 1
  • 1

1 Answers1

0
  1. repo init --depth=1 (according to repo help init)
  2. -c downloads only current branch. Only useful if you don't use --depth because depth implies -c (according to git help clone)
  3. I just downloaded it (20-07-2017) and the history takes up 21GB. I have checked out the studio-master-dev branch, which takes up another 15GB. So in total 36GB.