Skip to content

Latest commit

 

History

History
75 lines (54 loc) · 4.76 KB

AGENTS.md

File metadata and controls

75 lines (54 loc) · 4.76 KB

AGENTS.md

EGit is the Eclipse Git integration: a set of OSGi bundles built with Maven and Tycho on top of the JGit library.

Build

Build with JDK 25 (the BREE is JavaSE-25); JGit's build fails on newer JDKs.

EGit resolves JGit from a locally built p2 repository at ../../jgit/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/target/repository (the jgit-site property in pom.xml), so JGit has to be built first in a sibling checkout whose version matches the Require-Bundle/Import-Package range in EGit's manifests:

cd ../../jgit && mvn clean install -DskipTests
cd org.eclipse.jgit.packaging && mvn clean install -DskipTests   # separate reactor

Full EGit build from the repo root:

mvn clean verify -DskipTests
  • The target platform is picked with -Dtarget-platform=egit-4.xx; the files live in org.eclipse.egit.target (.tpd sources, generated .target files).
  • -Pstatic-checks adds SpotBugs and PMD (spotbugs-excludes.xml).
  • Pass -Dtycho.baseline.replace=none on local builds, otherwise Tycho may swap the freshly built jar for the published baseline jar.
  • The code formatter profile is tools/eclipse-JGit-Format.xml.

Tests

org.eclipse.egit.ui.test holds SWTBot tests; only classes matching **/*Test.java are executed. Shared test utilities live in org.eclipse.egit.core.junit.

Run a single test class by putting the test bundle and every in-repo bundle it depends on into the reactor; bundles left out are resolved from the target platform or ~/.m2 and the test runs against stale code. org.eclipse.egit.ui.test depends on the EGit and gitflow features, so those must be in the reactor too, together with -Dtycho.localArtifacts=ignore:

# core
mvn verify -pl org.eclipse.egit,org.eclipse.egit.core,org.eclipse.egit.core.junit,org.eclipse.egit.core.test \
  -Dtest=IndexDiffCacheTest -DfailIfNoTests=false \
  -Dtycho.baseline.replace=none -Dtycho.localArtifacts=ignore

# UI, headless on Linux
env -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE GDK_BACKEND=x11 xvfb-run -a mvn verify \
  -pl org.eclipse.egit,org.eclipse.egit.core,org.eclipse.egit.ui,org.eclipse.egit.doc,org.eclipse.egit-feature,org.eclipse.egit.gitflow,org.eclipse.egit.gitflow.ui,org.eclipse.egit.gitflow-feature,org.eclipse.egit.core.junit,org.eclipse.egit.ui.test \
  -Dtest=<TestClass> -DfailIfNoTests=false \
  -Dtycho.baseline.replace=none -Dtycho.localArtifacts=ignore

Tycho needs mvn verify, not mvn test.

Architecture

  • org.eclipse.egit.core wraps JGit for the Eclipse workspace and has no UI dependencies. It provides the Team provider (GitProvider), the mapping of workspace projects to repositories (RepositoryCache, RepositoryUtil, internal/project), long running Git operations as IEGitOperations in op/, and the index diff cache (internal/indexdiff) that incrementally tracks working tree status from resource deltas and feeds decorators and the Staging view.
  • org.eclipse.egit.ui builds all UI on top of core.
  • org.eclipse.egit.gitflow and org.eclipse.egit.gitflow.ui are an optional core/UI pair for the gitflow branching model.

Conventions that span several files:

  • Background services are OSGi Declarative Services components (for example ExternalRepositoryScanner, AutoFetchComponent). Their OSGI-INF/*.xml descriptors are checked in and not regenerated by the build, so a new or changed @Component needs its XML written by hand and listed in the Service-Component header of MANIFEST.MF.
  • User visible strings use Eclipse NLS: fields in UIText / CoreText must match keys in uitext.properties / coretext.properties.
  • UI preference keys live in UIPreferences, their defaults in PluginPreferenceInitializer; core preferences in GitCorePreferences / GitCorePreferenceInitializer.
  • Job families used by tests to join jobs are declared in JobFamilies (core and UI each have one).
  • Javadoc is concise: one or two sentences on what the class or method does, without implementation details, issue links or change history, and without @param/@return tags that only repeat the name.
  • Almost everything is in internal packages; keep new API out of exported packages unless it is meant to be API, since versions follow OSGi semantic versioning.

Contributing

Changes are reviewed on Gerrit (GerritHub), not via GitHub pull requests, which cannot be merged. Commits need a Change-Id from the Gerrit commit-msg hook and an Eclipse Contributor Agreement signature; each review is a single commit, updated by amending it. Keep the commit message concise: a short imperative subject line and a body of a few sentences saying what changed and why, without an implementation plan, test plan or bullet-list changelog.

git push ssh://<user>@eclipse.gerrithub.io:29418/eclipse-egit/egit HEAD:refs/for/master