blob: 2f890a39785af0b9475d5a368b9343a243033ab4 [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
108reduce this list to around 60 projects, which will make your repo syncs a lot
109faster.
110
111Solution: Simply ignore all projects bionic, bootable/*, external/* and
112hardware/*.
113
114Here's a script that takes care of all these details. It performs the repo
115init, creates the appropriate local_manifest.xml and does a repo sync as
116needed:
117
118------------
119#!/bin/bash
120
121set -e # fail on errors
122
123URL=git://android.git.kernel.org/platform/manifest.git
124BRANCH=donut
125
126if [ ! -d .repo ]; then
127 # repo init if there's no .repo directory
128 repo init -u $URL -b $BRANCH
129
130 # create a local_manifest to exclude projects not useful to the Windows SDK
131 M=.repo/manifest.xml
132 L=.repo/local_manifest.xml
133
134 cat > $L <<EOF
135<?xml version="1.0" encoding="UTF-8"?>
136<manifest>
137EOF
138
139 for i in $(grep -E "/(bionic|bootable|external|hardware)" $M | sed -s '/name/s/^.*name="\([^"]\+\)".*/\1/') ; do
140 echo "Ignore project $i"
141 echo " <remove-project name=\"$i\" />" >> $L
142 done
143
144 cat >> $L <<EOF2
145</manifest>
146EOF2
147fi
148
149[[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
150repo sync
151------------
152
153
154Simply extract this to a "my_sync.sh" file and try the following:
155 $ mkdir android_src
156 $ cd android_src
157 $ chmod +x mysync.sh
158 $ ./mysync.sh
159
160
161-end-
162
163
164
165