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 "Sapphire Modeling Tycho build support"

m
m
Line 1: Line 1:
This page is for adopters of [[Sapphire]] framework.
+
This page is for adopters of [[Sapphire]] framework that also use Tycho to build their eclipse plugins.
  
 
For any users that are trying to use tycho to build their eclipse plugins that use sapphire's model annotations, you will be required to configure tycho to generate the model classes as part of the maven build.  In the sample Sapphire plugins this is done with a customBuildCallbacks.xml which is a facility for PDE build.  Tycho doesn't support this ability out of the box but it can be easily configured by making some changes to your pom.xml and a edited version of the customBuildCallbacks.xml sample.  [http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.sapphire/plugins/org.eclipse.sapphire.samples/customBuildCallbacks.xml?view=markup&root=Technology_Project Here is a link to the customBuildCallbacks.xml sample in CVS]
 
For any users that are trying to use tycho to build their eclipse plugins that use sapphire's model annotations, you will be required to configure tycho to generate the model classes as part of the maven build.  In the sample Sapphire plugins this is done with a customBuildCallbacks.xml which is a facility for PDE build.  Tycho doesn't support this ability out of the box but it can be easily configured by making some changes to your pom.xml and a edited version of the customBuildCallbacks.xml sample.  [http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.sapphire/plugins/org.eclipse.sapphire.samples/customBuildCallbacks.xml?view=markup&root=Technology_Project Here is a link to the customBuildCallbacks.xml sample in CVS]
Line 7: Line 7:
 
1) In your pom.xml used snippet [1] to launch the ant script during generate-sources
 
1) In your pom.xml used snippet [1] to launch the ant script during generate-sources
  
2) In customBuildCallback.xml, had to make the following changes:
+
2a) In customBuildCallback.xml, set the default ant target to be pre.@dot [2]
2a) modify the location of ant-contrib.jar for my build environment
+
2b) modify the location of ant-contrib.jar for my build environment
2b) Change the <safe-apt /> task [2] to reference classpath refs provided by maven3/tycho
+
2c) Change the <safe-apt /> task [3] to reference classpath refs provided by maven3/tycho
2c) Change the <taskdef /> element [3] for how to find the sapphire SDK ant task
+
2d) Change the <taskdef /> element [4] for how to find the sapphire SDK ant task
  
3) In plugin.xml you need to add optional dependencies these bundles [4], so that when maven/tycho generates the classpath references it will include those two jars on the classpath.  There are other ways to do this in maven/tycho that are more elegant.
+
3) In plugin.xml you need to add optional dependencies these bundles [5], so that when maven/tycho generates the classpath references it will include those two jars on the classpath.  There are other ways to do this in maven/tycho that are more elegant.
  
  
Line 42: Line 42:
 
</pre>
 
</pre>
  
[2]  
+
[2]
 +
<pre>
 +
<project name="Build specific targets and properties" default="pre.@dot">
 +
</pre>
 +
 
 +
[3]  
 
<pre>
 
<pre>
 
<safe-apt srcdir="src"
 
<safe-apt srcdir="src"
Line 52: Line 57:
 
</pre>
 
</pre>
  
[3]  
+
[4]  
 
<pre>
 
<pre>
 
<taskdef  
 
<taskdef  
Line 59: Line 64:
 
</pre>
 
</pre>
  
[4] Optional dependencies in MANIFEST.MF
+
[5] Optional dependencies in MANIFEST.MF
 
<pre>
 
<pre>
 
org.eclipse.sapphire.sdk;bundle-version="0.3.0";resolution:=optional,
 
org.eclipse.sapphire.sdk;bundle-version="0.3.0";resolution:=optional,
 
org.eclipse.sapphire.sdk.build.processor;bundle-version="0.3.0";resolution:=optional
 
org.eclipse.sapphire.sdk.build.processor;bundle-version="0.3.0";resolution:=optional
 
</pre>
 
</pre>

Revision as of 15:32, 7 June 2011

This page is for adopters of Sapphire framework that also use Tycho to build their eclipse plugins.

For any users that are trying to use tycho to build their eclipse plugins that use sapphire's model annotations, you will be required to configure tycho to generate the model classes as part of the maven build. In the sample Sapphire plugins this is done with a customBuildCallbacks.xml which is a facility for PDE build. Tycho doesn't support this ability out of the box but it can be easily configured by making some changes to your pom.xml and a edited version of the customBuildCallbacks.xml sample. Here is a link to the customBuildCallbacks.xml sample in CVS

In the pom.xml for any plugin that has sapphire generated models you need to have the pom run an ant script during the generate-sources phase. To do this requires both changes to pom.xml and also changes to the customBuildCallbacks.xml provided in the sapphire samples.

1) In your pom.xml used snippet [1] to launch the ant script during generate-sources

2a) In customBuildCallback.xml, set the default ant target to be pre.@dot [2] 2b) modify the location of ant-contrib.jar for my build environment 2c) Change the <safe-apt /> task [3] to reference classpath refs provided by maven3/tycho 2d) Change the <taskdef /> element [4] for how to find the sapphire SDK ant task

3) In plugin.xml you need to add optional dependencies these bundles [5], so that when maven/tycho generates the classpath references it will include those two jars on the classpath. There are other ways to do this in maven/tycho that are more elegant.


[1]

<build>
     <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <ant antfile="customBuildCallbacks.xml" inheritRefs="true" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

[2]

<project name="Build specific targets and properties" default="pre.@dot">

[3]

<safe-apt srcdir="src"
      destdir=".apt_generated"
      preprocessdir=".apt_generated"
      classpathref="maven.compile.classpath"
      factorypathref="maven.compile.classpath"
      compile="false"/>

[4]

<taskdef 
          resource="org/eclipse/sapphire/sdk/build/antlib.xml"
          classpathref="maven.compile.classpath"/>

[5] Optional dependencies in MANIFEST.MF

org.eclipse.sapphire.sdk;bundle-version="0.3.0";resolution:=optional,
org.eclipse.sapphire.sdk.build.processor;bundle-version="0.3.0";resolution:=optional

Back to the top