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 "SMILA/Documentation/HowTo/Howto set up dev environment"

m (Howto Setup Development Environment)
m (Howto Build and Test Locally)
Line 1: Line 1:
 
[[Category:SMILA]]
 
[[Category:SMILA]]
=== Howto Build and Test Locally ===
+
=== Setup an Eclipse instance/installation for building ===
  
==== Setup an Eclipse instance/installation for building ====
+
==== Checkout sources from Eclipse svn ====
  
Setting up an own instance is recommended so that no extensions/features you might have installed in your eclipse instance you use for developing interferes with the build. It probably also makes the build a little faster as the headless start of eclipse takes less time due to fewer plug-ins installed.
+
First of all you have to checkout the sources, configuration files and build files from Eclipse svn to your harddrive (e.g. e:/Smila).
 +
 
 +
* svn location
 +
<pre>http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/</pre>
 +
 
 +
==== Installation and configuration of Eclipse (3.4) ====
 +
After getting SMILA relevant files you have to install and configure Eclipse.
  
==== Eclipse 3.4 ====
 
 
# Download an eclipse SDK, starting with at least [http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4.1-200809111700/eclipse-SDK-3.4.1-win32.zip eclipse-SDK-3.4.1-win32.zip].
 
# Download an eclipse SDK, starting with at least [http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4.1-200809111700/eclipse-SDK-3.4.1-win32.zip eclipse-SDK-3.4.1-win32.zip].
 
# Download [http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4.1-200809111700/eclipse-3.4.1-delta-pack.zip eclipse-3.4.1-delta-pack.zip].
 
# Download [http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4.1-200809111700/eclipse-3.4.1-delta-pack.zip eclipse-3.4.1-delta-pack.zip].
# unzip the archive and copy '''org.eclipse.equinox.executable_<version>''' from features into your features folder under your eclipse installation.
+
# Unzip the archive and copy '''org.eclipse.equinox.executable_<version>''' from features into your features folder under your eclipse installation.
# copy all necessary plug-ins (containing linux.x86 or win32.x86) from plugins into your plugins folder under your eclipse installation.
+
# Copy all necessary plug-ins (containing linux.x86 or win32.x86) from plugins into your plugins folder under your eclipse installation.
# start that eclipse and set up a custom target platform:
+
# Start that Eclipse and set up a custom target platform:
 
:* Unzip SMILA-xxx-.zips:
 
:* Unzip SMILA-xxx-.zips:
 
:::* Unzip SMILA-incubation-win32.win32.x86.zip into a directory (e.g. E:\ SMILA-incubation-win32.win32.x86). You may download it from [http://demo1.brox.de/smila/daily/SMILA-incubation-win32.win32.x86.zip SMILA-incubation-win32.win32.x86.zip]
 
:::* Unzip SMILA-incubation-win32.win32.x86.zip into a directory (e.g. E:\ SMILA-incubation-win32.win32.x86). You may download it from [http://demo1.brox.de/smila/daily/SMILA-incubation-win32.win32.x86.zip SMILA-incubation-win32.win32.x86.zip]
Line 21: Line 26:
 
::Click Window --> Preferences --> Plug-in Development --> Target Platform
 
::Click Window --> Preferences --> Plug-in Development --> Target Platform
  
==== Eclipse 3.3 ====
+
==== Import SMILA sources into your Eclipse workspace ====
# Download an eclipse SDK, starting with at least [http://archive.eclipse.org/eclipse/downloads/drops/R-3.3.2-200802211800/download.php?dropFile=eclipse-SDK-3.3.2-win32.zip eclipse-SDK-3.3.2-win32.zip].
+
# Download [http://archive.eclipse.org/eclipse/downloads/drops/R-3.3.2-200802211800/download.php?dropFile=eclipse-RCP-3.3.2-delta-pack.zip eclipse-RCP-3.3.2-delta-pack.zip].
+
# unzip the archive and copy '''org.eclipse.equinox.executable_<version>''' from features into your features folder under your eclipse installation.
+
# copy all necessary plug-ins (containing linux.x86 or win32.x86) from plugins into your plugins folder under your eclipse installation.
+
# start that eclipse and add sole extension location to WC /SMILA.extension by:
+
:* Menu: Help / Software Updates / Manage configuration
+
:* add extension location and choose the folder SMILA.extension/eclipse from smila project folder
+
 
+
==== Build Requirements ====
+
 
+
Text file encoding has to set to UTF-8.
+
 
+
Steps to provide UTF-8 text file encoding: Window --> Preferences --> General --> Workspace --> choose UTF-8 under Other
+
 
+
 
+
 
+
 
+
Our build process needs ant-contrib to build SMILA application. It is not included in the trunk. You may download it from: [http://sourceforge.net/projects/ant-contrib ant-contrib].
+
 
+
Furthermore our build process may generate reports for checkstyle, emma and pmd. To generate these reports you need special files. These files are also not included in the svn trunk. To generate these reports you may download these files from:  [http://checkstyle.sourceforge.net/ checkstyle] [http://emma.sourceforge.net/ emma] [http://pmd.sourceforge.net/ pmd].
+
The base location for these files and the ant-contrib is lib and has to be located in the trunk directory. This folder structure is recommanded. See below:
+
 
+
<source lang="text">
+
lib/
+
  ant-contrib/
+
      ant-contrib-1.0b1.jar
+
  checkstyle/
+
      checkstyle-all-4.3.jar
+
  emma/
+
      emma.jar
+
      emma_ant.jar
+
  pmd/
+
      asm-3.1.jar
+
      jaxen-1.1.1.jar
+
      pmd-4.1.jar
+
</source>
+
 
+
By default the configuration of the build process is developed to run the build with and without these dependencies (exception: ant-contrib is always required). If you don´t include these dependencies during build process, reports for checkstyle, emma and pmd won´t be generated.
+
 
+
 
+
After downloading files you have two possibilities to include these files into the build process:
+
# Create a folder structure like above in the trunk directory
+
# Create a folder structure like above anywhere on your hard disk (e.g. d:\lib) and pass the location via -Dlib.dir paramater to the build process (e.g. -Dlib.dir=d:\lib).
+
 
+
==== Configuring the Build ====
+
The folder <tt>SMILA.builder</tt> contains everything needed to build SMILA and/or run all tests locally. The default settings are set to build against eclipse 3.4.1 and build a product for Win 32bit and Linux 32bit. But it is also possible to build other platforms.
+
 
+
Whether you build from command line or from eclipse, in both cases the <tt>make.xml</tt> ant script is executed. Before execution certain properties need to be set to meet the local setup.
+
 
+
===== Setting the Target Build Platform =====
+
 
+
Independent of which way you are going to build, you must set the <tt>configs</tt> property in  the <tt>build.properties</tt> file to your setup.
+
 
+
{|
+
! Windows 32bit
+
| {{Codeblock|<pre>...
+
configs=win32,win32,x86
+
# ... </pre>
+
}}
+
|+
+
! Windows 64bit
+
(only provided by eclipse 3.4 and higher)
+
| {{Codeblock|<pre>...
+
configs=win32,win32,x86_64
+
# ... </pre>
+
}}
+
|+
+
! Linux 32bit
+
| {{Codeblock|<pre>...
+
configs=linux,gtk,x86
+
# ... </pre>
+
}}
+
|+
+
! Linux 64bit
+
| {{Codeblock|<pre>...
+
configs=linux, gtk, x86_64
+
# ... </pre>
+
}}
+
|+
+
! Solaris SPARC
+
| {{Codeblock|<pre>...
+
configs=solaris, gtk, sparc
+
# ... </pre>
+
}}
+
|}
+
 
+
If you want to provide several distributions e.g one for windows 32bit and one for linux 32bit (default build plan), you have to string together the config values.
+
 
+
{|
+
! Example:
+
| {{Codeblock|<pre>
+
configs=win32, win32, x86 & \
+
linux, gtk, x86 </pre>
+
}}
+
|}
+
 
+
 
+
 
+
 
+
''Note:
+
:The default is to build for both, windows and linux platforms. However, for this to work locally the eclipse must have the corresponding plugins installed which is usually not the case if you downloaded a platform specific distribution. If platform plugins are missing you will end up on Windows with:
+
 
+
:<tt>...
+
:[java] D:\Program Files\eclipse33\eclipse-SDK-3.3.2-win32-smila-build\eclipse\plugins\org.eclipse.pde.build_3.3.2.v20071019\scripts\genericTargets.xml:85: Unable to find plug-in: org.eclipse.core.filesystem.linux.x86_0.0.0. Please check the error log for more details.</tt>
+
 
+
===== Setting Build Properties =====
+
 
+
{| border="1" style="font-family:Tahoma, Verdana, Helvetica, sans-serif;font-size:100%;border-color:#CCC;border-collapse:collapse;color:black;" cellspacing="0" cellpadding="5" valign=top
+
! Property !! Default !! Comment
+
|-
+
|buildDirectory || <SMILA_HOME>/eclipse.build  ||
+
|-
+
|eclipse.home || <ECLIPSE_HOME>  || the location of the [[#Setup an Eclipse instance/installation for building|eclipse instance]] used to build smila
+
|-
+
|builder || <SMILA_HOME>/SMILA.builder 
+
|-
+
|eclipse.running || true 
+
|-
+
|pdeBuildPluginVersion || 3.4.1.R34x_v20080805 (for 3.4.1) || 3.3.2.v20071019 (for 3.3.2) to change the value go to build.properties file in folder SMILA.builder
+
|-
+
|equinoxLauncherPluginVersion || 1.0.101.R34x_v20080819 (for 3.4.1)  || 1.0.1.R33x_v20080118 (for 3.3.2) to change the value go to build.properties file in folder SMILA.builder
+
|-
+
|os || win32 || rowspan=3 | these merely control under which platform the test will run. It must be one of the [[#Setting the Target Build Platform |target platforms]] you have build.
+
|-
+
|ws || win32 
+
|-
+
|arch || x86 
+
|-
+
|test.java.home || <JAVA_HOME> || a java 1.5 SDK instance
+
|-
+
|}
+
 
+
 
+
For the build from eclipse you pass in these values via the command line text box in the launch config on the command line these are set in a shell script.
+
 
+
==== Executing the make.xml ====
+
 
+
[[Image:Smila.build.all.png|thumb|right| <tt>all</tt> dependency graph]]
+
 
+
The default target is <tt>all</tt>. This will by default build the application and run all unit tests.
+
The [[:image:Smila.build.all.png|dependency graph]] will explain what will happen and shows the relevant targets you may call instead.
+
 
+
 
+
===== Executing make.xml from within eclipse =====
+
# select the SMILA.builder bundle
+
# open External Tools Dialog
+
# create a new ant build configuration or choose your configuration if exists
+
# choose the build file of this bundle, e. g. ${workspace_loc:/SMILA.builder/make.xml}
+
# insert all properties from above into the arguments input field (but adapt these to your setup) but prepend each with <tt>-D</tt> so each is passed into <tt>ant</tt> as a property, e.g.
+
#: -DbuildDirectory=D:/eccenca/SMILA/eclipse.build
+
#: -Declipse.home=D:/eclipse33
+
#: -Dbuilder=D:/eccenca/SMILA/SMILA.builder
+
#: -Declipse.running=true
+
#: -DpdeBuildPluginVersion=3.3.2.v20071019
+
#: -DequinoxLauncherPluginVersion=1.0.1.R33x_v20080118
+
#: -Dos=win32 -Dws=win32 -Darch=x86
+
#: -Dtest.java.home=D:/java/jre1.5.0_11
+
# Apply, close and run SMILA.builder with this external tool configuration
+
 
+
''Note
+
: To start another than the default target specify the desired target also in the argument input box.
+
  
===== Executing make.xml from command line =====
+
:*Start Eclipse and import SMILA sources:
 +
::* Click '''File''' --> '''Import'''
 +
::* Expand '''General''' and choose '''Existing Projects into Workspace'''
 +
[[Image:Import-wizard.png]]
 +
:: <br/>
 +
::* Click '''Next''', set the root directory (e.g. e:/Smila), select all and then click '''Finish'''
 +
[[Image:Import-root.png]]
 +
:: <br/>
 +
::* After you followed the above steps, you should have the following structure in your '''Package Explorer'''
 +
[[Image:Package-explorer.png]]
  
The make.bat (or .sh) is just a shell script to set the properties that are needed for the ant script. These files exist only as templates in SVN with <tt>.#~#~#</tt> appended to denote their template nature. Rename it as u see fit, but make.bat (.sh) is already in the svn:ignore to prevent it from beeing committed accidentally, so it is recommended to use that.
 
  
Steps:
+
=== Launch SMILA in Eclipse ===
# adjust all paths in \SMILA.builder\make.bat according to own setup
+
# execute make.bat
+
  
''Note:
+
There is a folder '''SMILA.launch''' located in our trunk. This folder contains two launch configuration files for Eclipse. With these two files (one for windows 32bit and one for linux 32bit) you have the possibility to start SMILA in Eclipse. Follow the steps below:
: To execute another than the default target just pass it as an argument, like so:
+
::* Click '''Debug''' --> '''Debug Configurations''' and expand '''OSGI Framework'''
:: {{Code|make build}}
+
[[Image:Launch-smila.png]]
  
 
=== Howto Setup Development Environment ===
 
=== Howto Setup Development Environment ===

Revision as of 09:05, 24 March 2009

Setup an Eclipse instance/installation for building

Checkout sources from Eclipse svn

First of all you have to checkout the sources, configuration files and build files from Eclipse svn to your harddrive (e.g. e:/Smila).

  • svn location
http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/

Installation and configuration of Eclipse (3.4)

After getting SMILA relevant files you have to install and configure Eclipse.

  1. Download an eclipse SDK, starting with at least eclipse-SDK-3.4.1-win32.zip.
  2. Download eclipse-3.4.1-delta-pack.zip.
  3. Unzip the archive and copy org.eclipse.equinox.executable_<version> from features into your features folder under your eclipse installation.
  4. Copy all necessary plug-ins (containing linux.x86 or win32.x86) from plugins into your plugins folder under your eclipse installation.
  5. Start that Eclipse and set up a custom target platform:
  • Unzip SMILA-xxx-.zips:
  • Copy test specific plug-ins to Smila target platform:
  • Copy org.junit_3.8.2xxx from the “plugins” folder of your eclipse installation or copy org.junit_3.8.2.v200706111738 from Smila-test-and-sample folder to your Smila installation (e.g. E:\ SMILA-incubation-win32.win32.x86/plugins).
  • Copy org.eclipse.smila.test_0.5.0.jar from Smila-test-and-sample folder to your Smila installation (e.g. E:\ SMILA-incubation-win32.win32.x86/plugins).
  • Start eclipse and set the target platform location to this folder (e.g. E:\SMILA-incubation-win32.win32.x86).
Click Window --> Preferences --> Plug-in Development --> Target Platform

Import SMILA sources into your Eclipse workspace

  • Start Eclipse and import SMILA sources:
  • Click File --> Import
  • Expand General and choose Existing Projects into Workspace

Import-wizard.png


  • Click Next, set the root directory (e.g. e:/Smila), select all and then click Finish

Import-root.png


  • After you followed the above steps, you should have the following structure in your Package Explorer

Package-explorer.png


Launch SMILA in Eclipse

There is a folder SMILA.launch located in our trunk. This folder contains two launch configuration files for Eclipse. With these two files (one for windows 32bit and one for linux 32bit) you have the possibility to start SMILA in Eclipse. Follow the steps below:

  • Click Debug --> Debug Configurations and expand OSGI Framework

Launch-smila.png

Howto Setup Development Environment

  • SVN location
http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/

Howto Run junit tests for OSGi bundles

  • Plugin Junit Launch config
  • write config.ini and ref it from lauch config.
    tip: use \ to brake up long lines to have better overview
  • share the launch config

For further information see: Development Guidelines

Back to the top