blob: 078062b411cb2e47cc913e9e26cfe61b6d644d51 [file] [log] [blame]
Raphael5ea42872009-04-27 15:01:16 -07001Copyright (C) 2009 The Android Open Source Project
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14
15
16Subject: How to get the android source code using Cygwin and Git
17Date: 2009/04/27
18
19
20
21Table of content:
22 1- Goals and Requirements
23 2- Getting the code, the simple way
24 3- SSH issues
25 4- Advanced Tricks
26
27
28-------------------------
291- Goals and Requirements
30-------------------------
31
32This document explains how to checkout the Android source from the git
33repositories under Windows.
34
35As stated in development/docs/howto_build_SDK.txt, one can't build the whole
36Android source code under Windows. You can only build a the SDK tools for
37Windows.
38
39There are a number of caveats in checking out the code from Git under Windows.
40This document tries to explain them.
41
42First you will need to meet the following requirements:
43- You must have Cygwin installed.
44 See http://www.cygwin.com/
45
46- You must install Cyginw using the "Unix / Binary" mode.
47 If you don't do that, git will fail to properly compute some SHA1 keys.
48
49- You need the "git" and "curl" packages to checkout the code.
50 If you plan to contribute, you might want to get "gitk" also.
51
52 Note: if you want to build the SDK, check the howto_build_SDK.txt file
53 for a list of extra required packages.
54
55
56-----------------------------------
572- Getting the code, the simple way
58-----------------------------------
59
60Out of the box, "repo" and "git" will work just fine under Cygwin:
61
62 $ repo init -u git://android.git.kernel.org/platform/manifest.git
63 $ repo sync
64
65And you're done. You can build as explained in howto_build_SDK.txt and ignore
66the rest of this document.
67
68
69-------------
703- SSH issues
71-------------
72
73If you maintain your own private repository using an SSH server, you might get
74some "mux/ssh" errors. In this case try this:
75
76 $ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
77 $ export GIT_SSH=ssh
78 $ repo sync
79
80
81------------------
824- Advanced Tricks
83------------------
84
85There are two remaining issues with the default repo/git options:
86
87A- If you plan on contributing, you will notice that even after a fresh "repo
88sync" some projects are marked as having modified files. This happens on the
89"bionic" and the "external/iptables" project. The issue is that they have files
90which have the same name yet differ only by their case-sensitivity. Since the
91Windows filesystem is not case-sensitive, this confuses Git.
92
93Solution: we can simply ignore these projects as they are not needed to build
94the Windows SDK.
95
96To do this you just need to create a file .repo/local_manifest.xml that
97provides a list of projects to ignore:
98
99<?xml version="1.0" encoding="UTF-8"?>
100<manifest>
101 <remove-project name="platform/bionic" />
102 <remove-project name="platform/external/iptables" />
103</manifest>
104
105
106B- The other issue is that by default repo maintains around 100+ git projects.
107However most of these are not needed to build the Windows SDK. We can easily
Raphael68fee202009-04-28 12:11:03 -0700108reduce this list to around 70 projects, which will make your repo syncs a lot
Raphael5ea42872009-04-27 15:01:16 -0700109faster.
110
Raphael68fee202009-04-28 12:11:03 -0700111Solution: Simply ignore all projects bionic, bootable/*, hardware/* and most
112external projects. For external, we still need a handful of projects for the
113SDK -- things like the emulator or sqlite can be quite useful :-)
Raphael5ea42872009-04-27 15:01:16 -0700114
115Here's a script that takes care of all these details. It performs the repo
116init, creates the appropriate local_manifest.xml and does a repo sync as
117needed:
118
119------------
120#!/bin/bash
121
122set -e # fail on errors
123
124URL=git://android.git.kernel.org/platform/manifest.git
125BRANCH=donut
126
Raphael68fee202009-04-28 12:11:03 -0700127# repo init if there's no .repo directory
128if [[ ! -d .repo ]]; then
Raphael5ea42872009-04-27 15:01:16 -0700129 repo init -u $URL -b $BRANCH
Raphael68fee202009-04-28 12:11:03 -0700130fi
Raphael5ea42872009-04-27 15:01:16 -0700131
Raphael68fee202009-04-28 12:11:03 -0700132# create a local_manifest to exclude projects not useful to the Windows SDK
133L=.repo/local_manifest.xml
134if [[ ! -f $L ]]; then
Raphael5ea42872009-04-27 15:01:16 -0700135 M=.repo/manifest.xml
Raphael5ea42872009-04-27 15:01:16 -0700136
137 cat > $L <<EOF
138<?xml version="1.0" encoding="UTF-8"?>
139<manifest>
140EOF
141
Raphael68fee202009-04-28 12:11:03 -0700142 for i in $(sed -sn '/external\/\(apache\|expat\|g\|libpng\|pr\|qemu\|sqlite\|tag\|zlib\)/d;/\(bionic\|bootable\|cts\|external\|hardware\).* name/s/^.*name="\([^"]\+\)".*/\1/p' $M) ; do
Raphael5ea42872009-04-27 15:01:16 -0700143 echo "Ignore project $i"
144 echo " <remove-project name=\"$i\" />" >> $L
145 done
146
147 cat >> $L <<EOF2
148</manifest>
149EOF2
150fi
151
152[[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
153repo sync
154------------
155
156
157Simply extract this to a "my_sync.sh" file and try the following:
158 $ mkdir android_src
159 $ cd android_src
160 $ chmod +x mysync.sh
161 $ ./mysync.sh
162
163
164-end-
165
166
167
168