blob: 078062b411cb2e47cc913e9e26cfe61b6d644d51 [file] [log] [blame]
Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Subject: How to get the android source code using Cygwin and Git
Date: 2009/04/27
Table of content:
1- Goals and Requirements
2- Getting the code, the simple way
3- SSH issues
4- Advanced Tricks
-------------------------
1- Goals and Requirements
-------------------------
This document explains how to checkout the Android source from the git
repositories under Windows.
As stated in development/docs/howto_build_SDK.txt, one can't build the whole
Android source code under Windows. You can only build a the SDK tools for
Windows.
There are a number of caveats in checking out the code from Git under Windows.
This document tries to explain them.
First you will need to meet the following requirements:
- You must have Cygwin installed.
See http://www.cygwin.com/
- You must install Cyginw using the "Unix / Binary" mode.
If you don't do that, git will fail to properly compute some SHA1 keys.
- You need the "git" and "curl" packages to checkout the code.
If you plan to contribute, you might want to get "gitk" also.
Note: if you want to build the SDK, check the howto_build_SDK.txt file
for a list of extra required packages.
-----------------------------------
2- Getting the code, the simple way
-----------------------------------
Out of the box, "repo" and "git" will work just fine under Cygwin:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo sync
And you're done. You can build as explained in howto_build_SDK.txt and ignore
the rest of this document.
-------------
3- SSH issues
-------------
If you maintain your own private repository using an SSH server, you might get
some "mux/ssh" errors. In this case try this:
$ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
$ export GIT_SSH=ssh
$ repo sync
------------------
4- Advanced Tricks
------------------
There are two remaining issues with the default repo/git options:
A- If you plan on contributing, you will notice that even after a fresh "repo
sync" some projects are marked as having modified files. This happens on the
"bionic" and the "external/iptables" project. The issue is that they have files
which have the same name yet differ only by their case-sensitivity. Since the
Windows filesystem is not case-sensitive, this confuses Git.
Solution: we can simply ignore these projects as they are not needed to build
the Windows SDK.
To do this you just need to create a file .repo/local_manifest.xml that
provides a list of projects to ignore:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="platform/bionic" />
<remove-project name="platform/external/iptables" />
</manifest>
B- The other issue is that by default repo maintains around 100+ git projects.
However most of these are not needed to build the Windows SDK. We can easily
reduce this list to around 70 projects, which will make your repo syncs a lot
faster.
Solution: Simply ignore all projects bionic, bootable/*, hardware/* and most
external projects. For external, we still need a handful of projects for the
SDK -- things like the emulator or sqlite can be quite useful :-)
Here's a script that takes care of all these details. It performs the repo
init, creates the appropriate local_manifest.xml and does a repo sync as
needed:
------------
#!/bin/bash
set -e # fail on errors
URL=git://android.git.kernel.org/platform/manifest.git
BRANCH=donut
# repo init if there's no .repo directory
if [[ ! -d .repo ]]; then
repo init -u $URL -b $BRANCH
fi
# create a local_manifest to exclude projects not useful to the Windows SDK
L=.repo/local_manifest.xml
if [[ ! -f $L ]]; then
M=.repo/manifest.xml
cat > $L <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
EOF
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
echo "Ignore project $i"
echo " <remove-project name=\"$i\" />" >> $L
done
cat >> $L <<EOF2
</manifest>
EOF2
fi
[[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
repo sync
------------
Simply extract this to a "my_sync.sh" file and try the following:
$ mkdir android_src
$ cd android_src
$ chmod +x mysync.sh
$ ./mysync.sh
-end-