From Fedora Project Wiki

Line 62: Line 62:
  </repository>
  </repository>


Currently there are plans underway to absorb this functionality into Tycho itself so that the above 3 steps will no longer be required.
Tycho (in rawhide, and f17 soon) will resolve against most system osgi bundles (eclipse bundles, and anything in /usr/share/java) by default. This functionality is tracked at [https://bugzilla.redhat.com/show_bug.cgi?id=809575 Bug 809575]





Revision as of 17:56, 20 June 2012

Tycho Integration Into Fedora

Purpose

To document and comment upon the integration of Tycho into Fedora.

Information

Upstream : http://www.eclipse.org/tycho/
Fedora Tycho Repository : http://pkgs.fedoraproject.org/gitweb/?p=tycho.git
Koji Builds : http://koji.fedoraproject.org/koji/packageinfo?packageID=11939
Package ACLs : https://admin.fedoraproject.org/pkgdb/acls/name/tycho
Bugs : https://admin.fedoraproject.org/pkgdb/acls/bugs/tycho

Fedora's Tycho is currently updating and tracking upstream's releases for the following branches :

  • rawhide
  • f17
  • f16 (0.10.0)


Packages currently having a BuildRequire on Tycho :

  • eclipse-cdt
  • eclipse-dltk
  • jacoco
  • swt-chart
  • tycho
  • tycho-extras

Important Notes

Tycho Local OSGi bundle resolution

Much like Maven, Tycho must resolve its dependencies from other packages already available in Fedora if it is going to be used to build other OSGi bundles. To do this a local resolution mode has been implement similar to how it is done for Maven. When running mvn-rpmbuild (provided by Maven), Tycho will resolve maven dependencies in the same way as Maven. In the case of remote p2 repositories Tycho will also ignore them when running in local mode (mvn-rpmbuild, mvn-local).

Currently, an OSGi project wishing to build with Tycho that has OSGi dependencies must provide a local p2 repository on the system holding all of those dependencies. This is accomplished in 3 steps :

  1. Eclipse's copy-platform script is used to gather the various dependencies needed for the build and place them in a single folder.
  2. The FeaturesAndBundlesPublisher application is used to create a p2 repository on the local system.
  3. Tycho is made aware of this repository by specifying it under the list of repositories.

A rough boilerplate for the above steps would be :

(At the end of the %prep section of the specfile)

/usr/lib/eclipse/buildscripts/copy-platform SDK \
/usr/lib/eclipse cdt

eclipse -debug -consolelog -nosplash -verbose \
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
-metadataRepository file:/path/to/myrepo \
-artifactRepository file:/path/to/myrepo \
-source $PWD/SDK \
-compress -append -publishArtifacts

(In the project's top-level pom.xml, and within the <repositories> tag)

<repository>
 <id>my_local_rpmbuild_repo</id>
 <layout>p2</layout>
 <url>file:/path/to/myrepo</url>
</repository>

Tycho (in rawhide, and f17 soon) will resolve against most system osgi bundles (eclipse bundles, and anything in /usr/share/java) by default. This functionality is tracked at Bug 809575


Tycho Bootstrap Building In Fedora

The building of Tycho in Fedora is different from most builds. Since Tycho itself has subprojects that are OSGi bundles, it must do a bootstrap build of the modules needed for building OSGi bundles, before it can build everything else. As a result it has a dependency on itself.

In Fedora the first build was accomplished by providing a pre-built (from sources) version of Tycho (0.13.0) in its m2 cache so that it may resolve its dependency on itself. All subsequent builds simply depended on the previously built version (BuildRequires: %{name}). This actually causes a problem because when the previous version is not different from the version about to be built (as is the case during release bumps), the Maven resolver enters a cyclic dependency. It does not resolve the necessary artifact from the system, but rather from the reactor project, and thus fails. To work around this issue we build twice.

The first build modifies the version to be different from the previous (often ${version}-SNAPSHOT which is different from ${version}). The second build removes the "SNAPSHOT" so that a proper build may take place. Note that upstream has confirmed this would have to be done : http://dev.eclipse.org/mhonarc/lists/tycho-user/msg02599.html