Skip to content

Building Agit

rtyley edited this page Jan 10, 2013 · 32 revisions

Requirements

Building from the command-line

All of Agit's dependencies (apart from the Android SDK) are in Maven Central, so building from the command-line is easy:

export ANDROID_HOME=/home/roberto/tools/android-sdk   # Change to the location of your SDK!
git clone git://github.com/rtyley/agit.git agit-parent
cd agit-parent
mvn clean install

This will download all the project dependencies, compile the project, deploy the APK to your device, and run the integration tests (slow). You may want to restrict yourself to just performing a package android:deploy after the initial build as it's faster:

cd agit-parent/agit
mvn package android:deploy

The APK will be built to:

agit-parent/agit/target/agit-XXXX.apk

Intellij IDEA

Right now, IDEA has out-of-the-box support for Android and Maven (even in the free open-source Community Edition), and it's what I use to develop Agit. Just import the agit-parent.pom as an existing project, ensure that an Android SDK is available, and you're done.

See http://stackoverflow.com/a/9491525/438886 for few more details on getting IntelliJ to work with Maven-based Android projects.

Eclipse

Eclipse needs 3 plugins to handle Agit: the Android plugin, the Maven Plugin (tho Eclipse Indigo includes it in the standard install), and m2e-android (link contains detailed set-up instructions).

You'll probably want to turn off automatic-rebuild, as it was rather too slow with Agit last time I checked.

APK Signing

You might find that your device doesn't let you install Agit if you already have the version from the Android Market installed - this is standard Android security, it won't let you directly replace an app that's been signed with a differing key. Just uninstall Agit under 'Manage Applications' and you'll then be able to install your own version.

Integration Tests (and how to survive them)

The integration tests will install toy-ssh-agent into the Android VM, this will interfere with the ConnectBot ssh-agent if you're using that for SSH support. If you want to use Agit with SSH, make sure that ConnectBot is installed before Agit and toy-ssh-agent - if necessary, uninstall all three apps and start again.

The tests also require the Android VM to hit the mini-git-server running in the Maven process - and thus need to know what the host for the Maven process is. If the Android VM is the emulator, this will default to '10.0.2.2', which will work, if the Android VM is a proper device, then you'll need to tell the device the hostname. Create a file called 'agit-integration-test.properties' on the root folder of your SD card, and give it a line like this:

gitserver.host.address=192.168.1.104

Make sure the device can hit your machine over that address, and the integration tests should pass :-)