RepoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded is one of a triplet of tools that you will use when you work with Android source, the other two being GitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. and Gerrit. You can read more about those tools from Android official site.
This article focuses on repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded and aims at teaching you some useful tips & tricks that will hopefully help you become more efficient when managing Android source.
What is RepoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded?
RepoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded is a repository management tool built on top of GitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily..
It’s first purpose is to downloads files from multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories into your local working directory (aka the source tree). That means that you won’t have to manually download or fetch the latest changes from about 300+ projects (depending on if you are downloading AOSPThe Android Open Source ProjectThe Android Open Source Project is the Google project which makes available the source code for Android, allowing anyone to build it for themselves. All Android ROMs are ultimately based on AOSP at some point in their development. is the Google project which makes available the source code for Android, allowing anyone to build it for themselves. All Android ROMs are ultimately based on AOSP at some point in their development., CM or AOKP for example), repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded will do it for you.
The second purpose of repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded is to made it easy to submit your code contributions for review to a Gerrit server.
Downloading Android Source: 3 easy steps
The first thing you will always read about Android source is how to download them to your local hard drive. It’s obviously the first stage of working with the sources. Fetching the sources is as easy as the three following steps:
- The first step is to download the repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded command and make it executable:
|
|
mkdir ~/bin PATH=~/bin:$PATH curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod a+x ~/bin/repo |
Check your shell login scripts (like .profile, .bash_profile,…) that ~/bin is included in your $PATH.
- The second step will initialiaze a new local source repository in the current working directory:
|
|
repo init -u url -b branch |
This will create a new place to hold your local copy of the source tree. “url” should point to a ManifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. repository that describes the whole sources. It is a special project with a file (default.xml) that lists all the projects that Android is made of. In the ManifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. file, each projects has attributes about: where to place it in the tree, where to download it from (gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. server), revision that will be used (usually a branch name, tag or commit sha-id). An example of such file can be found here.
- The third and last step is to actually download the source:
The first time you run this command, it will download the sources. Android sources are huge, for example, CM10 (Jellybean) sources are about 14GiB. So, be prepared: you’ll need space in your hard drive, and time (possibly several hours).
Hopefully this article will help you save both time and space with some useful tricks. Next times you run it, it will only fetch the latest changes made to each repository.
Looking inside RepoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded
Let’s get back to the second step we’ve just seen earlier. What does repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded init really do? repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded init will create a hidden directory called .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/ in the rootRoot is the name of the highest level superuser (susu (substitute user) is a Linux command which, when run without a username parameter, gives the user full ‘root’ permissions. By default, this command binary (ie. Linux equivalent of an executable file) is not included on Android systems, but the process of “rooting” a phone copies this file to the ‘/system/bin/’ directory thereby enabling the command. Since root privileges can be abused by malicious applications it’s highly recommended to install an app to grant and manage access to su, similar to UAC on Windows. Many ROMs include the app called “SuperSU” for this.) on Unix-like systems such as Android. The root user, and applications run by the root user, have administrative access to protected files and services which makes it dangerous for normal daily use.
A ‘rooted’ device is one which has been hacked to provide privilege escalation from a standard user to superuser. Rooting a device is usually the first step in installing cooked ROMs. of your source tree. Inside .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/ we will find very interesting things:
- repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/ : That is actually a (gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily.) clone of the full repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded sources themselves, while the repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded command we downloaded earlier is much more a launcher that will then rely on those. It’s made in Python.
- manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on..xml : The main manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. of the tree (usually android/default.xml). DO NOT edit this file.
- projects/ : This folder will actually hold the .gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. structures of every projects you repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded sync. We will see later how it will save us several hours.
- local_manifest.xml : That file won’t be created by repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded, but it’s relevant to know it. It’s an optional file you can create to override the main manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on..
Downloading the source efficiently
Considering the size of Android sources, more than 250.000 files, with all the versions of those files, we are talking of about 14GiB for CM10. It can take a lot of time to download! Fortunately, you can instruct repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded to download several projects in paralell using the “-j” flag, so therepo sync command will read something like:
You should tune the number of jobs repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded will launch in paralell with regards of your number of CPU cores, and your bandwidth. -j 16 should be fine for a 8-cores box with a high Internet bandwidth.
This option will considerably lower the time needed to download the sources. Althought, be careful, as raising this number too much might be counter productive.
To avoid issues, it is recommended that you also add net.ipv4.tcp_window_scaling=0 to your /etc/sysctl.conf file (and run sudo sysctl -p , or reboot to apply the change).
Another handy option you might consider using is the “-c” flag:
|
|
-c, --current-branch fetch only current branch from server |
We’ve seen that Android source is made of hundreds of project, each project having it’s sources in its own gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repository. With all the Android versions jumps, those projects have evolved, and all that history is still recorded in those gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. That means that each of those hundred gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repository will have several branches. So the question is: do we really need to download (gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily.-clone) all the branches of every projects that make Android? Probably not.
That is where the “-c” flag is useful. With that flag, repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded will only download the revision (branch) that is specified in the manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on., not all the branches that are on the remote server. It will thus save us quite some space, and again it will take less time to download.
Editing the default ManifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on.
We’ve already seen that repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded relies on a manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. file, usually a file called default.xml in the android project. The copy that repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded will use as its reference is saved as .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on..xml.
We’ve also said that we shouldn’t modify the .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on..xml manually!
The right way to modify the manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on..xml file would be to edit the android/default.xml, commit the change, and push it upstream and thenrepo sync . Doing so will update the .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on..xml copy, and everything will stay under (gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. & repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded) control.
Overriding the default ManifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on.: Local ManifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on.
There can be cases where editing the android/default.xml file isn’t the best option, or not an option at all. For example, if we have downloaded the sources from a Team, and we don’t have access to pushing to their gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily.. Or because the change is relevant only to me, or only to a device, or maybe it’s just for testing purpose.
Think also about the two following questions:
- Do you really need all the projects from the default.xml?
- Do you need any other projects not in the default.xml?
For example, when building on a Linux machine, do you really need to download the toolchains for building arm binaries on a darwin machine?! I guess not.
In those cases, we can use the “local manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on.” to override (modify) the default manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on.. It’s a file calledlocal_manifest.xml , under .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/ in our source tree. The file doens’t exist, we will need to create it.
This local_manifest.xml will allow us to:
- Add new “remotes”
- Add, remove or replace “projects” (repositories)
Obviously, this file won’t be modified with repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded sync., that is the point of it.
The synthax is the same as for the default manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on.:
-
<remote/> to add a remote
-
<project /> to add a project
-
<remove-project /> to remove a project
Replacing a project with another is simply done by removing the project from the default manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. and add a new one in its place, like for example:
|
|
<?xml version="1.0" encoding="UTF-8"?> <manifest> <remove-project path="hardware/qcom/display" name="CyanogenMod/android_hardware_qcom_display" /> <project path="hardware/qcom/display" name="WinSuk/android_hardware_qcom_display" /> </manifest> |
See
repo help manifest for more information.
Save a snapshot of the source tree
As we’ve said earlier, the source tree is described in a manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. file that is a combination of the android/default.xml and an eventual local_manifest.xml file you might have created.
repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded allows us to export the resulting manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on.. It will describes the current state of our source tree (any project and their revision at the current time). The command to achive this is:
|
|
repo manifest -o snapshot.xml -r |
You can of course save the snapshot.xml wherever you want, and change the name to your liking.
It can be very hand to save a snapshot of our source tree each time you make a new build, so you can always come back to that exact same point later on if needed.
To restore the tree to the state described in a manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. snapshot file we had taken previously, we would run the following commands:
|
|
cp snapshot.xml .repo/manifests/ repo init -m snapshot.xml repo sync -d |
It’s however important to take into account some considerations here:
- Any modification you might have made to any project which are not yet commited won’t be “saved” in the manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. snapshot file.
- If you have commited some changes locally, but haven’t pushed those to the upstream remote repository, those commits will be saved in the manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. snapshot, but you will only be able to restore the manifestAn XML file that each application must define, to describe the application’s package name, version, components (activities, intentA message object that you can use to launch or communicate with other applications/activities asynchronously. An Intent object is an instance of Intent. It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others. An application sends an Intent to the Android system, rather than sending it directly to another application/activity. The application can send the Intent to a single target application or it can send it as a broadcast, which can in turn be handled by multiple applications sequentially. The Android system is responsible for resolving the best-available receiver for each Intent, based on the criteria supplied in the Intent and the Intent Filters defined by other applications. filters, services), imported libraries, and describes the various activities, and so on. snapshot locally.
Removing a project
Sometimes you might want to completely remove a project from your source tree. The first way that may come into your mind would be to simply remove the directory you see in your source tree.
Remember that when repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded syncs the source tree, it will first clone all the gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories under .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/projects, then fetch the files of every one of those projects into the source tree directory. So, if you want to completely remove a project from your local sources, you will also need to find the gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. directory corresponding to that project under .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/projects and delete it.
Lets see an example: we want to completely remove hardware/qcom/display . The corresponding gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. directory is .repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded/projects/hardware/qcom/display.gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. :
|
|
rm -r hardware/qcom/display rm -r .repo/projects/hardware/qcom/display.git |
Syncing a full new source tree in minutes!
Time might come when you’ll need to work with several full source trees. For example, you may want to have an AOKP source tree as well as a CM tree.
Obvisouly, you could repeat the same steps, to repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded init and then repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded sync -j 8 -c for both. But that would be twice as time consuming.
There is an alternative that should be much faster. Lets say that you have already initialized and synced a CM source tree, in ~/android/cm.
Now, we will prepare a new repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded for AOKP tree, in ~/android/aokp. Here comes the trick: We will use the
--reference flag of
repo init to indicate to repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded that we already have a local repository that it can take information from, instead of downloading everything from Internet again:
|
|
mkdir ~/android/aokp cd ~/android/aokp repo init --reference=~/android/cm -u git://github.com/AOKP/platform_manifest.git -b jb |
You should notice a big time diference, from hours for a full repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded sync, down to minutes using this trick!
Troubleshooting RepoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded
Like happen with all piece of software, repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded can hang, or appear not to work like you would expect…
- Kill a hanging repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded command
If a
repo sync have been stuck for too long, you can kill it easily issuing the following command:
Obvisouly, you should only run that command if you know there won’t be any other python script running on the machine at that time (with the same user).
- Make repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded be more verbose
Sometimes you’ll wish repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded be more verbose. It’s particularly true when repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded sync fail, but won’t tell you why! The reason is usually a remote gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. server that isn’t available. To make repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded be more verbose about what it does, you can add the
--trace flasg, right after repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded:
|
|
repo --trace sync -c -d -j8 |
You can always read repoRepo is used within the Android source code to manage multiple gitThe Git version control system is a distributed version control system, which tracks the changes made to some source code. Android and the Linux kernel make heavy use of git.
Git lets multiple authors collaborate on code, and share their changes quickly and easily. repositories. It can synchronise them all, and carry out other actions such as setting up your source tree, without having to manually define each repository needing downloaded’s help, for any command, for example:
|
|
repo help init repo help manifest repo help sync |