Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Developing Tycho"

(Manually setup)
(Replaced content with "See https://github.com/eclipse/tycho/blob/master/CONTRIBUTING.md")
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Setup your environment ==
+
See https://github.com/eclipse/tycho/blob/master/CONTRIBUTING.md
 
+
=== Using the Eclipse Installer (Oomph) ===
+
Step by step instructions:
+
# Download the [https://wiki.eclipse.org/Eclipse_Installer Eclipse Installer].
+
# Start the installer using the ''eclipse-inst'' executable.
+
# On the first page (product selection), click the preference button in the top-right corner and select the ''Advanced Mode''.
+
# If you are behind a proxy, at this point you might want to double check your network settings by clicking in the "Network Proxy Settings" at the bottom.
+
# Select ''Eclipse IDE for Eclipse Committers''. Click ''Next''.
+
# Under ''Eclipse.org'', double-click on ''Tycho'' (single click is not enough!). Make sure that ''Tycho'' is shown in the table on the bottom. Click ''Next''.
+
# You can edit the ''Installation Folder'', but you do not have to select the ''Target Platform'' here, this will be set later automatically. By choosing ''Show all variables'' at the bottom of the page, you are able to change other values as well but you do not have to. Click ''Next''.
+
# Press ''Finished'' on the ''Confirmation'' page will start the installation process.
+
# The installer will download the selected Eclipse version, starts Eclipse and will perform all the additional steps (cloning the git repos, etc...). When the downloaded Eclispe started, the progress bar in the status bar shows the progress of the overall setup.
+
# Once the ''Executing startup tasks'' job is finished you should have all the Tycho and Tycho Extras projects imported into 2 working sets called ''Tycho'' and ''Tycho Extras''.
+
# Some Projects might sill have errors. Select them (or all) and choose ''Maven''->''Update Project..'' from the context menu. De-select ''Clean projects'' in the shown dialog and press ''OK'' to update the projects. After that, no more error should be there. 
+
 
+
=== Manually setup ===
+
Prefered and easier way is to follow the instructions above, but you could also setup your environment manually:
+
# Get an [https://www.eclipse.org/downloads/ Eclipse IDE] with a recent version of the [http://www.eclipse.org/m2e/ Maven integration for Eclipse (m2eclipse)] and Eclipse PDE installed. m2eclipse is included in various Eclipse packages, e.g. the "Eclipse IDE for Eclipse Committers" package. To add m2eclipse to your existing Eclipse installation, install it from the [https://wiki.eclipse.org/Simultaneous_Release release train p2 repository] or from the [http://download.eclipse.org/technology/m2e/releases m2eclipse update site].
+
# Install [http://maven.apache.org/download.html Maven] version 3.0 or later
+
# If your Internet connection uses a proxy, make sure that you have the proxy configured in your [http://maven.apache.org/settings.html Maven settings.xml]
+
# Get the [https://projects.eclipse.org/projects/technology.tycho/developer Tycho sources] from eclipse.org; there are different ways to do this:
+
#* In EGit, open the ''Git Repositories'' view, select ''Clone a Git Repository'' and clone from the location https://git.eclipse.org/r/tycho/org.eclipse.tycho for Tycho.
+
#* In a shell, execute <tt>git clone https:</tt><tt>//git.eclipse.org/r/tycho/org.eclipse.tycho </tt> for Tycho.
+
# In Eclipse, use ''File > Import > Existing Maven Projects'', select the root directory of the sources, and import all projects. If prompted by m2eclipse, install the proposed project configurators and restart Eclipse.
+
# For Tycho only: Configure the target platform: Open the file <tt>tycho-bundles-target/tycho-bundles-target.target</tt> and click on ''Set as Target Platform'' in the upper right corner of the target definition editor.
+
 
+
The result should be an Eclipse workspace without build errors. m2eclipse may take some time to download required libraries from Maven central.
+
* If there are compile errors in the projects <tt>org.eclipse.tycho.surefire.junit</tt>, <tt>org.eclipse.tycho.surefire.junit4</tt>, <tt>org.eclipse.tycho.surefire.junit47</tt>, or <tt>org.eclipse.tycho.surefire.osgibooter</tt>, just select these projects and manually trigger an update via ''Maven > Update project...'' from the context menu.
+
* If there are compile errors in the project <tt>tycho-p2-director-plugin</tt>, right-click on the project and go to ''Build Path > Configure Build Path...'' and change the JRE System Library to JavaSE-1.7. Then revert the changes that the PDE does to the file <tt>tycho-p2-director-plugin/.settings/org.eclipse.jdt.core.prefs</tt>. (Background: The project optionally uses classes from the Java 7 library, so it needs to compile with a Java 7 JDK.)
+
 
+
== Building and Testing ==
+
 
+
To build Tycho/Tycho Extras from source, executed '''<tt>mvn clean install</tt>''' in the source root. This also runs the unit tests.
+
 
+
=== Tycho integration tests ===
+
 
+
The Tycho integration tests are located in the project <tt>tycho-its</tt>. To run all Tycho integration tests, execute <tt>mvn clean install -f tycho-its/pom.xml</tt>. To run a single integration test, select the test class in Eclipse and run it as ''JUnit Test''.
+
 
+
'''Background information on the Tycho integration tests'''
+
 
+
The integration tests trigger sample builds that use Tycho. These builds expect that Tycho has been installed to the local Maven repository. This is why you need to build Tycho through a <tt>mvn install</tt> before you can run the integration tests.
+
 
+
Alternatively, e.g. if you are only interested in modifying an integration test and do not want to patch Tycho itself, you can configure the integration tests to download the current Tycho snapshot produced by the [http://hudson.eclipse.org/tycho/view/CI Tycho CI builds]. To do this, you need to edit the Maven settings stored in <tt>tycho-its/settings.xml</tt> and add the tycho-snapshots repository as described in [[Getting Tycho]]. (Advanced note: The integration tests can also be pointed to a different settings.xml with the system property <tt>tycho.testSettings</tt>.)
+
 
+
=== Tycho Extras integration tests ===
+
 
+
Each Tycho Extras project does have its own integration tests located in the subdirectory <tt>it</tt> within the project (e.g. <tt>tycho-eclipserun-plugin/src/it</tt>).
+
To run the tests use the maven profile <tt>its</tt>, run <tt>mvn integration-test -Pits</tt> either within the Tycho Extras source folder to run all Tycho Extras integration tests or within a Tycho Extras plugin directory to run only the integration tests of that project.
+
 
+
'''Background information on the Tycho Extras integration tests'''
+
 
+
Tycho Extras and Tycho are developed and released in parallel and will use the snapshot version of Tycho from the repository <tt>https://repo.eclipse.org/content/repositories/tycho-snapshots/</tt>.
+
If you want to run the tests with a specific version of Tycho use the <tt>tycho-version</tt> system property, e.g. <tt>mvn integration-test -Pits -Dtycho-version=0.22.0</tt>.
+
To use a different Tycho snapshot repository use the system property <tt>tycho-snapshots-url</tt>, e.g. <tt>mvn integration-test -Pits -Dtycho-snapshots-url=file:/path/to/repo</tt>
+
 
+
== Debugging ==
+
 
+
In order to debug Tycho/Tycho Extras plugins inside Eclipse:
+
# Get the Tycho/Tycho Extras sources in Eclipse
+
# Create/get a project that highlights the bug
+
# Run the project with <tt>mvnDebug clean install</tt>
+
# Go into your Eclipse, use ''Debug > Remote Java Application'', select port 8000
+
 
+
== Advanced Topics ==
+
 
+
=== Writing Tycho integration tests ===
+
 
+
The hardest part for writing Tycho integration tests is the naming. While names are mostly important for readability, there were also cases where the ID "feature" was used multiple times and hence a test used the build result of a different integration test.
+
 
+
Therefore, here are a few tips for writing good integration tests:
+
* Test project name: Although many existing test have a bug number in the name, this is '''not''' the recommended naming scheme. Since integration test can take some time to execute, it may be a good idea to test related things in one test. <br>So name the test projects in a way that they can be found, and that related tests are sorted next to each other, e.g. in the form <tt>&lt;component&gt;.&lt;aspect&gt;</tt>.
+
* Package: Should be <tt>org.eclipse.tycho.test.&lt;component&gt;</tt> (without the aspect so that we don't get an excessive number of packages)
+
* Test project groupIds: Should be <tt>tycho-its-project.&lt;component&gt;.&lt;aspect&gt;</tt> plus a segment for the reactor in case of multi-reactor tests. The groupId is particularly important if the test project is installed to the local Maven repository. (Avoid install; use verify if possible.)
+
* Test project artifactIds: Have to be the same as the ID of the feature/bundle; need to start with something unique, e.g. the first letters of each segment of the project name.
+
 
+
=== Building Tycho against a locally built version of p2 ===
+
 
+
Tycho makes heavy use of p2 functionality. Therefore it may be useful to try out patches to p2 without waiting for a new p2 release, or even just the next nightly build. With the following steps it is possible to build Tycho against a locally built version of p2.
+
 
+
# Get the p2 sources (see [http://projects.eclipse.org/projects/rt.equinox.p2/developer p2 project information])
+
# Make changes in the p2 sources
+
# Build the changed p2 bundles individually with <tt>mvn clean install -Pbuild-individual-bundles</tt> (see [[Equinox/p2/Build]] for more information)
+
# Build at least the Tycho module tycho-bundles-external with <tt>mvn clean install</tt> - you should see a warning that the locally built p2 bundles have been used.
+
Then the locally built Tycho SNAPSHOT includes the patched p2 version.
+
 
+
Note: Tycho always allows references to locally built artifacts, even if they are not part of the target platform. Therefore you may want to clear the list of locally built artifacts (in the local Maven repository in .meta/p2-local-metadata.properties) after you have finished your trials with the patched p2 version.
+
 
+
=== Updating the Equinox and JDT dependencies of Tycho ===
+
 
+
Tycho has Maven dependencies to Equinox and JDT, so these artifact need to be available in a Maven repository. Currently, the authors don't provide these artifacts in Maven central, so we deploy them ourselves (with the groupId <tt>org.eclipse.tycho</tt>). See <tt>tycho-releng/pom.xml</tt> for the technical details on how this is done.
+
 
+
If we want to use a new version of these dependencies in a Tycho snapshot, we can also deploy snapshot versions of these dependencies alongside with the Tycho snapshots. This is how this is done:
+
 
+
# Update the p2 repository in <tt>tycho-releng/pom.xml</tt>
+
# Update the versions in the parent POM so that they match the versions available in the p2 repository. Add the <tt>-SNAPSHOT</tt> suffix to the Maven version properties.
+
# Commit and upload the change to Gerrit. The Gerrit build will fail with a dependency resolution error.
+
# Trigger the job [https://ci.eclipse.org/tycho/job/tycho-deploy-dependencies/ tycho-deploy-dependencies] and make it build the proposed change
+
# Re-trigger the voter job for the Gerrit change. The build should now pass.
+
 
+
[[Category:Tycho]]
+

Latest revision as of 18:35, 8 April 2021

See https://github.com/eclipse/tycho/blob/master/CONTRIBUTING.md

Back to the top