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 "Trace Compass/Development Environment Setup"

(Set the Target Platform)
(Setup Maven Plug-ins)
(26 intermediate revisions by 9 users not shown)
Line 5: Line 5:
 
= Get the Eclipse SDK =
 
= Get the Eclipse SDK =
  
Under [http://eclipse.org/downloads/ eclipse.org downloads], select the '''Eclipse IDE for Eclipse Committers''' archive. You can start with any Eclipse pre-package, but make sure you have the ''Eclipse Plug-in Development Environment'' feature installed.
+
Under [https://www.eclipse.org/downloads/packages/ eclipse.org download packages], select the '''Eclipse IDE for Eclipse Committers''' archive. You can start with any Eclipse pre-package, but make sure you have the ''Eclipse Plug-in Development Environment'' feature installed.
  
 
Uncompress and start Eclipse. Example for Linux:
 
Uncompress and start Eclipse. Example for Linux:
  $ tar xzvf eclipse-standard-luna-SR2-linux-gtk-x86_64.tar.gz
+
  $ tar xzvf eclipse-committers-2021-06-R-linux-gtk-x86_64.tar.gz  
 
  $ cd eclipse
 
  $ cd eclipse
 
  $ ./eclipse
 
  $ ./eclipse
Line 15: Line 15:
  
 
You will then be greeted by the welcome screen, which you can dismiss by clicking the ''Workbench'' arrow in the upper-right corner.
 
You will then be greeted by the welcome screen, which you can dismiss by clicking the ''Workbench'' arrow in the upper-right corner.
 +
 +
= Setup Java 11 =
 +
 +
Trace Compass requires Java 8, but to develop it, java 11 is required. Here is how to install on recent Ubuntu:
 +
 +
$ sudo apt-get install openjdk-11-jdk
 +
 +
For old versions of Ubuntu, install from the [https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa OpenJDK PPA].
 +
 +
Next, the JRE must be added in Eclipse.
 +
 +
* Select "Window -> Preferences".
 +
* Navigate to "Java -> Installed JREs".
 +
* Click "Add..." and enter the path to Java 11 home directory (ex: /usr/lib/jvm/java-11-openjdk-amd64).
 +
* Check the Java 11 entry to use it by default for new projects and run configurations.
 +
 +
Note: if you migrate your environment to Java 11, existing debug and run configurations will continue to use the previous JRE. To use the new JRE, open the run configuration pannel "Run -> Run configurations..." and from the tab "Main", select the appropriate JRE under "Java Runtime Environment -> Execution environment".
 +
 +
When running (not developing) Trace Compass, Java 8 (openjdk-8-jre) would suffice.
 +
 +
= Setup Maven Plug-ins =
 +
When developing for the Trace Compass incubator project, make sure to install the m2e plug-ins to your Eclipse IDE. You can omit these steps if not developing incubator features. This is a recent addition to m2e and requires an Eclipse IDE 2021-06 or later.
 +
 +
To install M2E, select menu "Help -> Install New Software...". An "Install" dialog will open. Select the release update site from the "Work with" drop-down menu. For example, if your IDE is based on Eclipse 2021-06 the select "2021-06 - http://download.eclipse.org/releases/2021-06". Then select "M2E- Integration for Eclipse" and "M2E - PDE Integration" and select "Next" Button and the "Finish". Restart Eclipse when asked for it.
  
 
= Get the source code for org.eclipse.tracecompass =
 
= Get the source code for org.eclipse.tracecompass =
Line 21: Line 45:
  
 
Then, simply clone the following repository somewhere on your hard drive:
 
Then, simply clone the following repository somewhere on your hard drive:
* git://git.eclipse.org/gitroot/tracecompass/org.eclipse.tracecompass.git
+
* https://git.eclipse.org/c/tracecompass/org.eclipse.tracecompass.git
 +
 
 +
git clone https://git.eclipse.org/r/tracecompass/org.eclipse.tracecompass.git
 +
 
 +
If adding tests that require an actual trace, then it should be added to the following trace repository first:
 +
 
 +
* https://git.eclipse.org/c/tracecompass/tracecompass-test-traces.git/
 +
 
 +
git clone https://git.eclipse.org/r/tracecompass/tracecompass-test-traces.git
 +
 
 +
Extra functionalities are developed in the Trace Compass Incubator sub-project. If interested in any of those feature, the following repository can be cloned
 +
 
 +
* https://git.eclipse.org/c/tracecompass.incubator/org.eclipse.tracecompass.incubator.git/
 +
 
 +
git clone https://git.eclipse.org/r/tracecompass.incubator/org.eclipse.tracecompass.incubator.git
  
 
= Import the Trace Compass projects into the workspace =
 
= Import the Trace Compass projects into the workspace =
Line 39: Line 77:
 
To set the target platform for the Trace Compass plugins:
 
To set the target platform for the Trace Compass plugins:
 
* Expand the "org.eclipse.tracecompass.target" project.
 
* Expand the "org.eclipse.tracecompass.target" project.
* Double-click the .target file that corresponds to your Eclipse version (tracecompass-e4.5.target, at the time of this writing).
+
* Double-click the .target file that corresponds to the Eclipse version (tracecompass-e4.20.target, at the time of this writing).
 
* In the view that just opened, click ''Set as Target Platform'' on the top right.
 
* In the view that just opened, click ''Set as Target Platform'' on the top right.
  
Line 48: Line 86:
 
= Define an API baseline =
 
= Define an API baseline =
  
== Using Eclipse 4.5.0 and greater ==
+
== Using the Eclipse IDE ==
  
 
''Starting with Eclipse 4.5.0, it is no longer necessary to download and maintain a separate Eclipse installation for the API baseline. You can simply use a target definition file, as explained below.''
 
''Starting with Eclipse 4.5.0, it is no longer necessary to download and maintain a separate Eclipse installation for the API baseline. You can simply use a target definition file, as explained below.''
Line 59: Line 97:
 
* Click on "Add Baseline..."
 
* Click on "Add Baseline..."
 
* Choose "A target platform" and click Next.
 
* Choose "A target platform" and click Next.
* In the next page check the box next to the target which contains "baseline" in its name, like "tracecompass-baseline-1.0".
+
* In the next page check the box next to the target which contains "baseline" in its name, like "tracecompass-baseline-7.0".
* Click "Reset" to download the contents of the target.
+
* Click "Refresh" to download the contents of the target.
* Specify a name for this baseline in the top area, like "Trace Compass 1.0" for example.
+
* Specify a name for this baseline in the top area, like "Trace Compass 7.0" for example.
 
* Click "Finish", then "OK" in the previous dialog.
 
* Click "Finish", then "OK" in the previous dialog.
  
Line 67: Line 105:
  
 
Once that is done, your workspace will be rebuilt and the API changes will now be tracked. Any new method or class will have to be annotated with "@since n", where n is the major.minor version number found in the plugin's MANIFEST.MF file.
 
Once that is done, your workspace will be rebuilt and the API changes will now be tracked. Any new method or class will have to be annotated with "@since n", where n is the major.minor version number found in the plugin's MANIFEST.MF file.
 
== Using Eclipse 4.4.2 and earlier ==
 
 
Versions before 4.5.0 do not support using a target definition file. Instead, you can point to another Eclipse installation containing your baseline.
 
 
=== Download the baseline install ===
 
 
* You can re-use the Eclipse archive you downloaded previously or go to [http://eclipse.org/downloads/ eclipse.org downloads], select the '''Eclipse IDE for Eclipse Committers''' archive.
 
* Extract it in a directory somewhere, separate from your normal Eclipse installation. We will call this new installation the ''baseline''.
 
 
=== Update the baseline ===
 
 
The baseline needs to be updated with the latest version of Trace Compass. Intermediate releases might not be part of the base Eclipse install, so they have to be downloaded from the update site. To verify if you have the latest version, and update it if needed:
 
* Run your baseline installation of Eclipse (''cd'' to its directory and run ''./eclipse'').
 
** To be safe, select a different workspace that the one for your real installation (you can use a ''workspace/'' subdirectoy under the baseline's ''eclipse/'' directory for example).
 
* Dismiss the splash screen and go to "Help -> Install New Software".
 
* In the new window, click on the ''Available Software Sites'' link at the top.
 
* In the following window, add the Trace Compass update site for the latest baseline. The URL is:
 
** http://download.eclipse.org/tracecompass/mars/milestones/rc4a/
 
* Click OK until you go back to the first window, then on the drop-down menu, select ''--All Available Sites--''.
 
* In the list, select all the features.
 
** If you do not see any entries, it means you already have the latest versions installed. This may happen if you downloaded a Service Release that includes the latest Trace Compass stable release. You can skip the rest and go back to your real Eclipse.
 
* Click Next, Next, Finish. The new versions of the plugins will be downloaded and installed.
 
* Eclipse will offer to restart at this point. It might be a good idea to restart and make sure that the correct versions are installed.
 
Once you are done, close the baseline Eclipse. You should never have to run this installation, other than to update it.
 
 
=== Set up your regular Eclipse to use the baseline ===
 
* In your regular Eclipse install, go to "Window -> Preferences -> Plug-in Development -> API Baselines".
 
* Click on "Add Baseline..."
 
* In the new window click "Browse...", and point it to the directory of the baseline Eclipse install you set up earlier.
 
* Give your baseline a name, then click "Finish".
 
  
 
= Build the documentation (optional) =
 
= Build the documentation (optional) =
Line 111: Line 118:
 
* Restart Eclipse
 
* Restart Eclipse
  
You can now build the documentation plugins:
+
You can now build the documentation plugins using maven build from the command-line from the Trace Compass root directory:
* Click on one of the *.help projects
+
* mvn clean install -DskipTests=true
* In the top menu, click "Project -> Build Project"
+
 
* After it is built, the warning should disappear, and the HTML files should be present in its ''doc/'' subdirectory.
 
* After it is built, the warning should disappear, and the HTML files should be present in its ''doc/'' subdirectory.
  
Line 127: Line 133:
 
The next time you can just select "Eclipse Application" from the Run (or Debug) icon in the toolbar.
 
The next time you can just select "Eclipse Application" from the Run (or Debug) icon in the toolbar.
  
 +
= Run test suite with Maven =
 +
 +
Before submitting to Gerrit, it may be useful to validate changes for possible regression. Running the GUI tests opens windows that will interfere with the main desktop session. On Linux, the windows can be redirected to a virtual display.
 +
 +
== Setup virtual display on Ubuntu ==
 +
* Install Xephyr and Metacity: sudo apt-get install xserver-xephyr metacity
 +
* Start the virtual display: Xephyr :2 -screen 1024x768 &
 +
* Setup environment: export DISPLAY=:2
 +
* Start the Metacity window manager: metacity --replace &
 +
* Execute the tests: mvn clean install
 +
 +
== Static code verification ==
 +
 +
In the testing phase, it is suggested to use [http://www.vogella.com/tutorials/Findbugs/article.html FindBugs] to check the code for common errors. Coding conventions are checked with Checkstyle. Bad practices are verified by (PMD).
 +
 +
Conversely, one can use [http://docs.sonarqube.org/display/SONAR/Installing+SonarQube+in+Eclipse sonar for eclipse] to check all the issues in one place.
 +
 +
You can also consult the static analysis results at [https://scan.coverity.com/projects/tracecompass Coverity] and [https://dev.eclipse.org/sonar/dashboard/index/org.eclipse.tracecompass:org.eclipse.tracecompass Eclipse SonarQube server].
  
 
= Using the Eclipse Installer (Oomph) =
 
= Using the Eclipse Installer (Oomph) =
Line 132: Line 156:
 
(experimental)
 
(experimental)
  
You can use the Eclipse Installer to setup the Eclipse installation and everything required to get started with Trace Compass development. It downloads Eclipse, sets the API baseline, clones the Trace Compass git repo and imports the projects for you.
+
You can use the Eclipse Installer to setup the Eclipse installation and everything required to get started with Trace Compass development. It downloads Eclipse, sets the API baseline, clones the Trace Compass git repository and imports the projects for you.
  
 
# Download the Eclipse Oomph installer, available at https://wiki.eclipse.org/Eclipse_Oomph_Installer
 
# Download the Eclipse Oomph installer, available at https://wiki.eclipse.org/Eclipse_Oomph_Installer
 
# Extract and start the installer.
 
# Extract and start the installer.
# After the initial preference questions, at the package selection, click the Advanced Mode button in the top-right corner.
+
# After the initial preference questions, at the package selection, click the menu button in the top-right corner and select 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.
 
# 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, Select Eclipse IDE for Eclipse Committers. Click Next.
# Under Eclipse.org, double-click on Trace Compass. Click next.
+
# Under Eclipse Projects, double-click on Trace Compass. Click Next.
 
# Enter installation folder name, workspace name, etc. Click Next, Finish.
 
# Enter installation folder name, workspace name, etc. Click Next, Finish.
  
After the initial setup, you should have a complete Eclipse environment to work on Trace Compass.
+
After the Eclipse workbench is installed and launched, wait for the "Executing startup tasks" job to be completed, then you should have a complete Eclipse environment to work on Trace Compass.

Revision as of 15:11, 19 September 2022

This page describes how to setup the Trace Compass development environment.

Note that this should only be required if you want to make modifications to the code or contribute patches. If you only want to run the plugin as a user, you would probably be better served by the stable or nightly builds, available on this page.

Get the Eclipse SDK

Under eclipse.org download packages, select the Eclipse IDE for Eclipse Committers archive. You can start with any Eclipse pre-package, but make sure you have the Eclipse Plug-in Development Environment feature installed.

Uncompress and start Eclipse. Example for Linux:

$ tar xzvf eclipse-committers-2021-06-R-linux-gtk-x86_64.tar.gz 
$ cd eclipse
$ ./eclipse

The first time you run it, it will ask for a workspace directory. You can use the default location.

You will then be greeted by the welcome screen, which you can dismiss by clicking the Workbench arrow in the upper-right corner.

Setup Java 11

Trace Compass requires Java 8, but to develop it, java 11 is required. Here is how to install on recent Ubuntu:

$ sudo apt-get install openjdk-11-jdk

For old versions of Ubuntu, install from the OpenJDK PPA.

Next, the JRE must be added in Eclipse.

  • Select "Window -> Preferences".
  • Navigate to "Java -> Installed JREs".
  • Click "Add..." and enter the path to Java 11 home directory (ex: /usr/lib/jvm/java-11-openjdk-amd64).
  • Check the Java 11 entry to use it by default for new projects and run configurations.

Note: if you migrate your environment to Java 11, existing debug and run configurations will continue to use the previous JRE. To use the new JRE, open the run configuration pannel "Run -> Run configurations..." and from the tab "Main", select the appropriate JRE under "Java Runtime Environment -> Execution environment".

When running (not developing) Trace Compass, Java 8 (openjdk-8-jre) would suffice.

Setup Maven Plug-ins

When developing for the Trace Compass incubator project, make sure to install the m2e plug-ins to your Eclipse IDE. You can omit these steps if not developing incubator features. This is a recent addition to m2e and requires an Eclipse IDE 2021-06 or later.

To install M2E, select menu "Help -> Install New Software...". An "Install" dialog will open. Select the release update site from the "Work with" drop-down menu. For example, if your IDE is based on Eclipse 2021-06 the select "2021-06 - http://download.eclipse.org/releases/2021-06". Then select "M2E- Integration for Eclipse" and "M2E - PDE Integration" and select "Next" Button and the "Finish". Restart Eclipse when asked for it.

Get the source code for org.eclipse.tracecompass

First, make sure you have a Git client installed (either the git command-line tool, or the Eclipse Git Team Provider plugin, also available in Eclipse's "Install New Software").

Then, simply clone the following repository somewhere on your hard drive:

git clone https://git.eclipse.org/r/tracecompass/org.eclipse.tracecompass.git

If adding tests that require an actual trace, then it should be added to the following trace repository first:

git clone https://git.eclipse.org/r/tracecompass/tracecompass-test-traces.git

Extra functionalities are developed in the Trace Compass Incubator sub-project. If interested in any of those feature, the following repository can be cloned

git clone https://git.eclipse.org/r/tracecompass.incubator/org.eclipse.tracecompass.incubator.git

Import the Trace Compass projects into the workspace

  • Select "File -> Import..."
  • Select "General -> Existing Projects into Workspace"
  • Next to "Select root directory" click "Browse..."
  • Navigate to the directory where you git clone'd the project earlier.
  • It should now list the available plugins. Make sure they are all checked and click "Finish".
  • The plugins should now be added to your workspace, and visible in the Package Explorer view on the left.

You will probably get a bunch of build errors at this point. DON'T PANIC! This is because Trace Compass needs additional dependencies that might not be present in your current Eclipse installation. We will install those in the following section.

Set the Target Platform

Eclipse offers the ability to set target platforms, which will download a specific environment to run your plugins, without having to "pollute" your Eclipse install. Trace Compass ships target definition files, which is the recommended way of installing its dependencies.

To set the target platform for the Trace Compass plugins:

  • Expand the "org.eclipse.tracecompass.target" project.
  • Double-click the .target file that corresponds to the Eclipse version (tracecompass-e4.20.target, at the time of this writing).
  • In the view that just opened, click Set as Target Platform on the top right.

Eclipse will now download the required dependencies, which may take some time the first time.

If you wish to switch target platforms in the future, you can come back to this plugin, or you can go to "Window -> Preferences -> Plug-in Development -> Target Platform". From that page, you can switch between any of the known targets, or your base Eclipse runtime.

Define an API baseline

Using the Eclipse IDE

Starting with Eclipse 4.5.0, it is no longer necessary to download and maintain a separate Eclipse installation for the API baseline. You can simply use a target definition file, as explained below.

Since Trace Compass is out of incubation with its 1.0 release, all API changes have to be tracked and marked with the proper @since annotations. The Eclipse API tool can compare the contents of the current workspace with the last stable version, defined in a target definition file.

To set up the API baseline, follow these steps:

  • Select "Window -> Preferences". In the window that opens, select "Plug-in Development -> API Baselines" on the left pane.
  • Click on "Add Baseline..."
  • Choose "A target platform" and click Next.
  • In the next page check the box next to the target which contains "baseline" in its name, like "tracecompass-baseline-7.0".
  • Click "Refresh" to download the contents of the target.
  • Specify a name for this baseline in the top area, like "Trace Compass 7.0" for example.
  • Click "Finish", then "OK" in the previous dialog.

It should offer you do to a full rebuild. You can click "Yes" at this point.

Once that is done, your workspace will be rebuilt and the API changes will now be tracked. Any new method or class will have to be annotated with "@since n", where n is the major.minor version number found in the plugin's MANIFEST.MF file.

Build the documentation (optional)

If you imported the *.help plugins (which contain the user and developer guides), you might notice warnings in these plugins because of missing files. It is because the documentation plugins need to be built using a separate component. If you do not care for the documentation, you can ignore those warnings, or even remove those plugins from your workspace.

On the other hand, if you want to build or work on the documentation (which you should do if you add user-visible features!), here is how to build it.

First you need to install the Mylyn-Wikitext Eclipse plugin:

  • Go to "Help -> Install New Software..."
  • Select "-- All Available Sites--"
  • In the list of available plugins, select "Collaboration -> Mylyn Wikitext", and click Next/Finish to install it.
  • Restart Eclipse

You can now build the documentation plugins using maven build from the command-line from the Trace Compass root directory:

  • mvn clean install -DskipTests=true
  • After it is built, the warning should disappear, and the HTML files should be present in its doc/ subdirectory.

Note that this builder does not run automatically ; Ant is not very smart at figuring out which files were changed, so it would end up constantly rebuilding the doc plugins for nothing. For this reason, if you modify the source (.mediawiki) files, you will have to rebuild the HTML manually, using the same method.

Run (or Debug) the plugins

To run (or debug) the code, start a nested Eclipse with the plugins loaded:

  • Right-click the "org.eclipse.tracecompass.tmf.core" plugin
  • Select "Run As -> Eclipse Application" (or "Debug As -> Eclipse Application" to run in debug mode).

The next time you can just select "Eclipse Application" from the Run (or Debug) icon in the toolbar.

Run test suite with Maven

Before submitting to Gerrit, it may be useful to validate changes for possible regression. Running the GUI tests opens windows that will interfere with the main desktop session. On Linux, the windows can be redirected to a virtual display.

Setup virtual display on Ubuntu

  • Install Xephyr and Metacity: sudo apt-get install xserver-xephyr metacity
  • Start the virtual display: Xephyr :2 -screen 1024x768 &
  • Setup environment: export DISPLAY=:2
  • Start the Metacity window manager: metacity --replace &
  • Execute the tests: mvn clean install

Static code verification

In the testing phase, it is suggested to use FindBugs to check the code for common errors. Coding conventions are checked with Checkstyle. Bad practices are verified by (PMD).

Conversely, one can use sonar for eclipse to check all the issues in one place.

You can also consult the static analysis results at Coverity and Eclipse SonarQube server.

Using the Eclipse Installer (Oomph)

(experimental)

You can use the Eclipse Installer to setup the Eclipse installation and everything required to get started with Trace Compass development. It downloads Eclipse, sets the API baseline, clones the Trace Compass git repository and imports the projects for you.

  1. Download the Eclipse Oomph installer, available at https://wiki.eclipse.org/Eclipse_Oomph_Installer
  2. Extract and start the installer.
  3. After the initial preference questions, at the package selection, click the menu button in the top-right corner and select Advanced Mode.
  4. 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.
  5. Under Eclipse.org, Select Eclipse IDE for Eclipse Committers. Click Next.
  6. Under Eclipse Projects, double-click on Trace Compass. Click Next.
  7. Enter installation folder name, workspace name, etc. Click Next, Finish.

After the Eclipse workbench is installed and launched, wait for the "Executing startup tasks" job to be completed, then you should have a complete Eclipse environment to work on Trace Compass.

Back to the top