and git repo

Any learning Android development if the developer wants to study in depth Android, Android must look at the source code, download the Android source code on the Internet there are a lot of tutorials, if you have the FQ, you can refer directly tutorial Google's official website or the old law out of date of course , if you have not FQ, you can use the Android source image Tsinghua University .

I did not start with they recommend downloading Ubuntu, but heard that Windows 10 has a built-in Pro Ubuntu subsystem later, I tried to download the source code with Windows 10, but encountered many problems, the Internet and found less than the corresponding interpretation and repo this thing made me very confused, did not know is Gesha, and later within the company also began to switch to the git repo and only gradually get to know the relationship between the two, but also "success" in Windows 10 to download the Android Source.

Git as a version control tool, very powerful, the new branch, the branch switch very quickly, a small team with Git can manage very well, but if the Android system is such a huge project it, we know that is a full Android source code big, big, directory structure is very complicated, if it is init directly into a Git repository, simply a disaster, does not meet the requirements of decoupling.
Android Source
To know Git is not the middle of the whole library to a single clone out of the directory, so if I'm just in charge of frameworks, but when I was under the code but the whole are lower down.

How to do it, very simple, sub-module Well, for example, put each directory in the root directory as a separate Git repository, so developers only focus on their own modules on the line, on the other modules of code when invisible. Ah, well, the problem seems to be solved. But this is not enough, you gotta have a complete set of Android source code to compile a version of it, how do you know this big library which contains a version of it, some people will say, why do you want to record, not on so many libraries Well, in turn taken out not on the list. Perhaps it is for us to work in contact with the size of the project, this is enough, but Android, the 7.1.1 have been compared to the beginning, Android itself has undergone enormous changes, some modules may be in the process of evolution gradually abandoned, and this time we need to define a file to a record of each version of Android in the end with what the library.

In fact, the above is the principle of repo and solved the problem, let's look at repo in the end is doing.

When you have completed the repo init, you'll find a hidden directory .repo in your directory, into .repo / manifest /, open default.xml, you said before this is used to record a version of needs What file library. The figure is android-4.0.1_r1 default.xml file version corresponding to:

repo/default.xml

A closer look, is not very familiar with? But Google finer points of a number of sub-modules, not simply a directory directly draw into a module, such as external, it is divided into two directories, and under a number of device catalog is divided more. And the corresponding revision is defined corresponding to the library branch.

Well, after reading the file is closed, we run under .repo / manifest / directory git branch -ato see.

Write pictures described here

This time it is clear the bar, this manifest itself directory is actually a git repository, a version of Android with a branch, which default.xml to record this version of the library needed, repo tool according to the document and then go and take each library corresponding branched and eventually combined.

To sum up, Git separate management module, and manage all of Git repo library, combines multiple Git repository, to form a complete big version.

 

Transfer from https://blog.csdn.net/u013171283/article/details/80895125

Guess you like

Origin www.cnblogs.com/foolish-xc/p/10994201.html