EGit Contributor Guide - Builds

# Builds

The central EGit and JGit builds run on the JGit/EGit Hudson instance

Prerequisites for the Maven build are

- at least Maven 3.0.0 (but currently not Maven 3.1.0)
- see settings.xml reference on how to do basic Maven configuration
- if you want to learn how Maven works start reading the Maven Getting Started Guide

Hudson

- development build jobs
- maintenance and release build jobs

## JGit

- JGit can be built using Maven 2 or 3.
- use Java 7 to run the JGit Maven build (required since bundle org.eclipse.jgit.java7 needs Java 7)
- JGit packaging projects (Eclipse feature and update site) are built using Maven 3 and Tycho.

## EGit

- EGit is built using Maven 3 and Tycho.

## Mailing Lists

If you're interested in following builds, please check out the following mailing lists:

- Subscribe to jgit-build@eclipse.org
- Subscribe to egit-build@eclipse.org

## Maven Build Sequence

- Due to a current limitation of Tycho it is not possible to mix pom-first and manifest-first builds in the same reactor build hence the pom-first JGit build has to run separately before the build for the manifest-first JGit packaging project.
- The 3 builds must share the same local Maven repository otherwise dependencies between these builds cannot be resolved.
- To run the build behind a firewall follow http://maven.apache.org/guides/mini/guide-proxies.html

Complete build sequence for a clean build (assuming $M2_HOME/bin is on the path and local Maven repository at ~/.m2/repository):

    [~/src/jgit] $ mvn clean install
    [INFO] Scanning for projects...
    ...

    [~/src/jgit] $ mvn -f org.eclipse.jgit.packaging/pom.xml clean install
    [INFO] Scanning for projects...
    ...

    [~/src/jgit] $ cd ../egit

    [~/src/egit] $ mvn clean install
    [INFO] Scanning for projects...
    ...

The EGit build uses the JGit p2 repository to resolve jgit dependencies. For local builds the build assumes that egit and jgit source trees are located under a common parent folder. If this is not the case the path to the jgit p2 repository has to be injected via system property:

    ~/src/egit $ mvn clean install -Djgit-site=file:/path/to/org.eclipse.jgit.updatesite/target/site

The hudson build on build.eclipse.org uses (for SNAPSHOT builds):

    ~/src/egit $ mvn clean install -Djgit-site=https://repo.eclipse.org/content/unzip/snapshots.unzip/
                         org/eclipse/jgit/org.eclipse.jgit.repository/${JGIT_VERSION}/org.eclipse.jgit.repository-${JGIT_VERSION}.zip-unzip/

If you wan to build EGit for the specific Juno platform, consider using the `platform-juno` maven profile:

    ~/src/egit $ mvn -P platform-juno clean install

For EGit version 3.0, `platform-juno` (Eclipse 4.2) and `platform-kepler` (Eclipse 4.3) are available. In addition `platform-kepler-staging` refers to the Kepler staging repository.

Upon a successful build, a p2 update site should be generated inside egit/org.eclipse.egit.repository/target/repository. If not, make sure the target platform has been downloaded from within Eclipse (Windows>Preferences>Plug-in Development>Target Platform). The default target platform defined in the maven build is currently Eclipse 4.3.

## FindBugs and PMD

As part of the build, JGit and EGit run FindBugs and PMD to find issues.

- JGit FindBugs Results
- JGit DRY (PMD) Results
- EGit FindBugs Results
- EGit DRY (PMD) Results

## Checking for JGit API Changes using API Baseline

The JGit projects have API tooling enabled. In order to use PDE API tools to get assistance with maintaining API changes and additions you need to set an API baseline:

- download the p2 repository for the latest EGit release (which includes the JGit artifacts) to a local folder, e.g. `~/egit-releases/updates-3.0`, find the p2 repository URLs here and see mirroring artifacts for a way to download the repository
- in Eclipse click "Preferences > Plug-In Development > API Baselines", click "Add Baseline..." and define a new baseline (e.g. egit-3.0) and point it to the local copy of the corresponding EGit p2 repository.
- the API tools will then raise warning/errors for all detected problems and provide quick fixes helping to resolve these problems
- see the PDE API Tools User Guide for more details.

## Automated Signing and Publishing

EGit and JGit builds running on the JGit/EGit Hudson are automatically signed (using the CBI eclipse-jarsigner-plugin) and published to the folder

    master branch:         /home/data/httpd/download.eclipse.org/egit/updates-nightly
    latest stable branch:  /home/data/httpd/download.eclipse.org/egit/updates-stable-nightly

- To enable signing the maven profile `eclipse-sign` must be enabled via the option `-P eclipse-sign` in the respective build jobs running at https://hudson.eclipse.org/egit/
- To enable publishing to download.eclipse.org the maven profile `publish` must be enabled via the option `-P publish` in the egit build job.

#### Signing (old method, replaced by automated procedure)

To sign the EGit build, you need to have ssh access to build.eclipse.org and the ability to run /usr/bin/sign

At the moment, Chris Aniszczyk (caniszczyk) and Matthias Sohn (msohn) have signing privileges.

The first step is to ensure you're in a place you can sign on build.eclipse.org

    cd /home/data/httpd/download-staging.priv/commonBuild

Next you run the signing command (Usage: /usr/bin/sign <file> <mail|nomail> outputDir) on a zip of the EGit repo...

    sign egit-p2-repo.zip my@email.com /home/data/users/caniszczyk/egit-0.8

After that, you can publish the zip that is generated with the signing information.

## Contribution to Release Train

The release train contribution for JGit and EGit is maintained in the git repository

    ssh://git.eclipse.org/gitroot/simrel/org.eclipse.simrel.build.git

in the file

    egit.b3aggrcon

The release train build is coordinated on the cross-project-issues-dev mailing list