Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Tycho and single source RCP/RAP

Hello,

ah yes, I'm sorry... I forgot to put the bug number of my enhancement
request here. It's bug 392408.

Regards
Timo


2012/10/19 Jay Jay Billings <jayjaybillings@xxxxxxxxx>:
> I agree - great discussion!
>
> Hopefully in the next couple of weeks I will have time to incorporate Timo's
> techniques into our build. After I get it working, I would be willing to
> write or update a wiki article with single-sourcing details. I think this is
> going to be very popular in the future.
>
> Jay
>
>
> On Fri, Oct 19, 2012 at 9:07 AM, Wim Jongman <wim.jongman@xxxxxxxxx> wrote:
>>
>> Great discussion. What is the bug number?
>>
>>
>> On Fri, Oct 19, 2012 at 8:45 AM, Timo Rohrberg <rti.init@xxxxxxxxxxxxxx>
>> wrote:
>>>
>>> Hello Tobias,
>>>
>>> thanks for your reply. Such an additional option for treating optional
>>> dependencies greedy would be absolutely cool and save me a lot of
>>> configuration work. So I opened an enhancement request in Bugzilla. I
>>> guess, I will get informed once the option has been implemented, by
>>> watching the request...
>>>
>>> Thanks again.
>>>
>>> Regards
>>> Timo
>>>
>>>
>>> 2012/10/18 Oberlies, Tobias <tobias.oberlies@xxxxxxx>:
>>> > Well done!
>>> >
>>> > Just to let you know that it wouldn't be hard to change Tycho so that
>>> > you wouldn't need this setup: optionalDependencies could have another option
>>> > to make the dependency resolution try to resolve all optional dependencies,
>>> > and if they are not in the target platform, omit them. This option was
>>> > originally discussed in the bug that introduced the switch [1], but simply
>>> > wasn't implemented because no-one requested it.
>>> >
>>> > So, if _you_ want it, let us know through an enhancement request in
>>> > Bugzilla.
>>> >
>>> > Regards
>>> > Tobias
>>> >
>>> >
>>> > [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=351842#c16
>>> >
>>> >
>>> >> -----Original Message-----
>>> >> From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-
>>> >> bounces@xxxxxxxxxxx] On Behalf Of Timo Rohrberg
>>> >> Sent: Donnerstag, 18. Oktober 2012 13:30
>>> >> To: Tycho user list
>>> >> Subject: Re: [tycho-user] Tycho and single source RCP/RAP
>>> >>
>>> >> Hello Jay,
>>> >>
>>> >> as the application I am working at is a commercial one, I cannot just
>>> >> publish my whole POMs on this mailing list. But at least, I can
>>> >> provide you with some details and the major sections in my POM files
>>> >> that do the trick...
>>> >>
>>> >> First of all, I have a hierarchy of three parent POM files, each in
>>> >> individual projects which build as individual artifacts as well:
>>> >>
>>> >> 1) There is a master parent in which I just activate Tycho:
>>> >>
>>> >> <properties>
>>> >>   <tycho-version>0.14.1</tycho-version>
>>> >> </properties>
>>> >>
>>> >> <build>
>>> >>   <plugins>
>>> >>     <plugin>
>>> >>       <groupId>org.eclipse.tycho</groupId>
>>> >>       <artifactId>tycho-maven-plugin</artifactId>
>>> >>       <version>${tycho-version}</version>
>>> >>       <extensions>true</extensions>
>>> >>     </plugin>
>>> >>     <plugin>
>>> >>       <groupId>org.apache.maven.plugins</groupId>
>>> >>       <artifactId>maven-compiler-plugin</artifactId>
>>> >>       <version>2.3.1</version>
>>> >>       <configuration>
>>> >>         <source>1.6</source>
>>> >>         <target>1.6</target>
>>> >>       </configuration>
>>> >>     </plugin>
>>> >>   </plugins>
>>> >> </build>
>>> >>
>>> >> 2) A second-level parent, in which I configure the P2 repositories to
>>> >> use for resolving (internal and external) dependencies. This parent is
>>> >> used by the three "compatibility" plugins and fragments respectively
>>> >> (see below for further details). Here, the "extra requirements" are
>>> >> also configured as described in my initial response to this posting.
>>> >>
>>> >> <repositories>
>>> >>   <repository>
>>> >>     <id>common</id>
>>> >>     <layout>p2</layout>
>>> >>     <url>${common-site}</url>
>>> >>   </repository>
>>> >> </repositories>
>>> >>
>>> >> <build>
>>> >>   <plugins>
>>> >>     <plugin>
>>> >>       <groupId>org.eclipse.tycho</groupId>
>>> >>       <artifactId>tycho-source-plugin</artifactId>
>>> >>       <version>${tycho-version}</version>
>>> >>       <executions>
>>> >>         <execution>
>>> >>           <id>plugin-source</id>
>>> >>           <goals>
>>> >>             <goal>plugin-source</goal>
>>> >>           </goals>
>>> >>         </execution>
>>> >>       </executions>
>>> >>     </plugin>
>>> >>     <plugin>
>>> >>       <groupId>org.eclipse.tycho</groupId>
>>> >>       <artifactId>target-platform-configuration</artifactId>
>>> >>       <version>${tycho-version}</version>
>>> >>       <configuration>
>>> >>         <resolver>p2</resolver>
>>> >>         <environments>
>>> >>           <environment>
>>> >>             <os>win32</os>
>>> >>             <ws>win32</ws>
>>> >>             <arch>x86</arch>
>>> >>           </environment>
>>> >>           <environment>
>>> >>             <os>win32</os>
>>> >>             <ws>win32</ws>
>>> >>             <arch>x86_64</arch>
>>> >>           </environment>
>>> >>         </environments>
>>> >>       </configuration>
>>> >>     </plugin>
>>> >>   </plugins>
>>> >> </build>
>>> >>
>>> >> <profiles>
>>> >>   <profile>
>>> >>     <id>client-rcp</id>
>>> >>     <activation>
>>> >>       <activeByDefault>false</activeByDefault>
>>> >>       <property>
>>> >>         <name>maven.profile</name>
>>> >>         <value>client-rcp</value>
>>> >>       </property>
>>> >>     </activation>
>>> >>     <repositories>
>>> >>       <repository>
>>> >>         <id>rcp</id>
>>> >>         <layout>p2</layout>
>>> >>         <url>${rcp-site}</url>
>>> >>       </repository>
>>> >>     </repositories>
>>> >>     <build>
>>> >>       <plugins>
>>> >>         <plugin>
>>> >>           <groupId>org.eclipse.tycho</groupId>
>>> >>           <artifactId>target-platform-configuration</artifactId>
>>> >>           <version>${tycho-version}</version>
>>> >>           <configuration>
>>> >>             <dependency-resolution>
>>> >>               <optionalDependencies>ignore</optionalDependencies>
>>> >>               <extraRequirements>
>>> >>                 <requirement>
>>> >>                   <type>eclipse-plugin</type>
>>> >>                   <id>org.eclipse.ui</id>
>>> >>                   <versionRange>0.0.0</versionRange>
>>> >>                 </requirement>
>>> >>                 <requirement>
>>> >>                   <type>eclipse-plugin</type>
>>> >>                   <id>org.eclipse.ui.views</id>
>>> >>                   <versionRange>0.0.0</versionRange>
>>> >>                 </requirement>
>>> >>               </extraRequirements>
>>> >>             </dependency-resolution>
>>> >>           </configuration>
>>> >>         </plugin>
>>> >>       </plugins>
>>> >>     </build>
>>> >>   </profile>
>>> >>   <profile>
>>> >>     <id>client-rap</id>
>>> >>     <activation>
>>> >>       <activeByDefault>false</activeByDefault>
>>> >>       <property>
>>> >>         <name>maven.profile</name>
>>> >>         <value>client-rap</value>
>>> >>       </property>
>>> >>     </activation>
>>> >>     <repositories>
>>> >>       <repository>
>>> >>         <id>rap</id>
>>> >>         <layout>p2</layout>
>>> >>         <url>${rap-site}</url>
>>> >>       </repository>
>>> >>     </repositories>
>>> >>     <build>
>>> >>       <plugins>
>>> >>         <plugin>
>>> >>           <groupId>org.eclipse.tycho</groupId>
>>> >>           <artifactId>target-platform-configuration</artifactId>
>>> >>           <version>${tycho-version}</version>
>>> >>           <configuration>
>>> >>             <dependency-resolution>
>>> >>               <optionalDependencies>ignore</optionalDependencies>
>>> >>               <extraRequirements>
>>> >>                 <requirement>
>>> >>                   <type>eclipse-plugin</type>
>>> >>                   <id>org.eclipse.rap.ui</id>
>>> >>                   <versionRange>0.0.0</versionRange>
>>> >>                 </requirement>
>>> >>                 <requirement>
>>> >>                   <type>eclipse-plugin</type>
>>> >>                   <id>org.eclipse.rap.ui.views</id>
>>> >>                   <versionRange>0.0.0</versionRange>
>>> >>                 </requirement>
>>> >>               </extraRequirements>
>>> >>             </dependency-resolution>
>>> >>           </configuration>
>>> >>         </plugin>
>>> >>       </plugins>
>>> >>     </build>
>>> >>   </profile>
>>> >>   <profile>
>>> >>     <id>server</id>
>>> >>     <activation>
>>> >>       <activeByDefault>false</activeByDefault>
>>> >>       <property>
>>> >>         <name>maven.profile</name>
>>> >>         <value>server</value>
>>> >>       </property>
>>> >>     </activation>
>>> >>     <repositories>
>>> >>       <repository>
>>> >>         <id>equinox</id>
>>> >>         <layout>p2</layout>
>>> >>         <url>${equinox-site}</url>
>>> >>       </repository>
>>> >>     </repositories>
>>> >>   </profile>
>>> >> </profiles>
>>> >>
>>> >> 3) A third-level parent, which is used by all of my client projects
>>> >> that itself depend on the "compatibility" plugins and fragments (see
>>> >> below for further details). Here, the same trick with "extra
>>> >> dependencies" is applied to add the corresponding RCP- or RAP-fragment
>>> >> of the "compatibility" plugin depending on the active Maven profile.
>>> >> Note the combine.children="append" attribute which makes Tycho to
>>> >> append the extra requirements to the ones already defined in the
>>> >> second-level parent ;-).
>>> >>
>>> >> <profiles>
>>> >>   <profile>
>>> >>     <id>client-rcp</id>
>>> >>     <activation>
>>> >>       <activeByDefault>false</activeByDefault>
>>> >>       <property>
>>> >>         <name>maven.profile</name>
>>> >>         <value>client-rcp</value>
>>> >>       </property>
>>> >>     </activation>
>>> >>     <build>
>>> >>       <plugins>
>>> >>         <plugin>
>>> >>           <groupId>org.eclipse.tycho</groupId>
>>> >>           <artifactId>target-platform-configuration</artifactId>
>>> >>           <version>${tycho-version}</version>
>>> >>           <configuration>
>>> >>             <dependency-resolution>
>>> >>               <optionalDependencies>ignore</optionalDependencies>
>>> >>               <extraRequirements combine.children="append">
>>> >>                 <requirement>
>>> >>                   <type>eclipse-plugin</type>
>>> >>                   <id>com.initplan.mplan.client.compatibility.rcp</id>
>>> >>                   <versionRange>0.0.0</versionRange>
>>> >>                 </requirement>
>>> >>               </extraRequirements>
>>> >>             </dependency-resolution>
>>> >>           </configuration>
>>> >>         </plugin>
>>> >>       </plugins>
>>> >>     </build>
>>> >>   </profile>
>>> >>   <profile>
>>> >>     <id>client-rap</id>
>>> >>     <activation>
>>> >>       <activeByDefault>false</activeByDefault>
>>> >>       <property>
>>> >>         <name>maven.profile</name>
>>> >>         <value>client-rap</value>
>>> >>       </property>
>>> >>     </activation>
>>> >>     <build>
>>> >>       <plugins>
>>> >>         <plugin>
>>> >>           <groupId>org.eclipse.tycho</groupId>
>>> >>           <artifactId>target-platform-configuration</artifactId>
>>> >>           <version>${tycho-version}</version>
>>> >>           <configuration>
>>> >>             <dependency-resolution>
>>> >>               <optionalDependencies>ignore</optionalDependencies>
>>> >>               <extraRequirements combine.children="append">
>>> >>                 <requirement>
>>> >>                   <type>eclipse-plugin</type>
>>> >>                   <id>com.initplan.mplan.client.compatibility.rap</id>
>>> >>                   <versionRange>0.0.0</versionRange>
>>> >>                 </requirement>
>>> >>               </extraRequirements>
>>> >>             </dependency-resolution>
>>> >>           </configuration>
>>> >>         </plugin>
>>> >>       </plugins>
>>> >>     </build>
>>> >>   </profile>
>>> >> </profiles>
>>> >>
>>> >> Now the trick for defining dependencies to platform-specific plugins
>>> >> (such as org.eclipse.ui, and org.eclipse.rap.ui respectively) is to
>>> >> create a "compatibilty" plugin which optionally depends on those
>>> >> plugins and re-exports its dependencies. All other client plugins only
>>> >> depend then on the "compatibility" plugin. Additionally, there are two
>>> >> fragments (one for RCP, one for RAP) to this "compatibility" plugin in
>>> >> which I placed some helper code (e.g. a SingletonProvider
>>> >> implementation) that requires different implementation for RCP and RAP
>>> >> respectively. This approach is also described in the RAP
>>> >> Single-Sourcing Guide provided by EclipseSource here:
>>> >> http://eclipsesource.com/en/info/rcp-rap-single-sourcing-guideline/
>>> >>
>>> >> For selecting the proper Maven profile at build time, I just specify
>>> >> the "-P <profile>" option in my build scripts and the Jenkins
>>> >> configuration ("Goals" field) respectively. Alternatively, you can
>>> >> also activate a profile by configuring a particular system property
>>> >> (in my case "maven.profile") in your POMs and add the
>>> >> "-Dmaven.profile=<profile>" option to your JVM running the Maven/Tycho
>>> >> build.
>>> >>
>>> >> Hope this descriptions helps. If you have further questions, feel free
>>> >> to
>>> >> ask.
>>> >>
>>> >> Regards
>>> >> Timo
>>> >>
>>> >>
>>> >>
>>> >> 2012/10/18 Jay Jay Billings <jayjaybillings@xxxxxxxxx>:
>>> >> > Timo,
>>> >> >
>>> >> > I am working on a single source application too. Could you share
>>> >> > your
>>> >> whole
>>> >> > POM or at least the part that shows the profiles? Also, how do you
>>> >> select a
>>> >> > profile at build time?
>>> >> >
>>> >> > Jay
>>> >> >
>>> >> > On Oct 18, 2012 4:22 AM, "Timo Rohrberg" <rti.init@xxxxxxxxxxxxxx>
>>> >> wrote:
>>> >> >>
>>> >> >> Hello Thorsten,
>>> >> >>
>>> >> >> I guess, I had exactly the same problem in our single-sourcing
>>> >> >> RCP/RAP
>>> >> >> application. I solved it by adding so-called "extra requirements"
>>> >> >> definitions into my pom.xml configuration files to explicitely
>>> >> >> require
>>> >> >> the corresponding semi-optional dependencies (in my case
>>> >> >> org.eclipse.ui and org.eclipse.ui.views and the corresponding RAP
>>> >> >> replacements). I placed that "extra requirements" definitions into
>>> >> >> Maven profiles sections and select the appropriate profile for
>>> >> >> building my application in "RCP-" and "RAP-"mode respectively.
>>> >> >>
>>> >> >> The configuration of "extra dependencies" looks like this:
>>> >> >>
>>> >> >> <plugin>
>>> >> >>   <groupId>org.eclipse.tycho</groupId>
>>> >> >>   <artifactId>target-platform-configuration</artifactId>
>>> >> >>   <version>${tycho-version}</version>
>>> >> >>   <configuration>
>>> >> >>     <dependency-resolution>
>>> >> >>       <optionalDependencies>ignore</optionalDependencies>
>>> >> >>       <extraRequirements>
>>> >> >>         <requirement>
>>> >> >>           <type>eclipse-plugin</type>
>>> >> >>           <id>org.eclipse.rap.ui</id>
>>> >> >>           <versionRange>0.0.0</versionRange>
>>> >> >>         </requirement>
>>> >> >>         <requirement>
>>> >> >>           <type>eclipse-plugin</type>
>>> >> >>           <id>org.eclipse.rap.ui.views</id>
>>> >> >>           <versionRange>0.0.0</versionRange>
>>> >> >>         </requirement>
>>> >> >>       </extraRequirements>
>>> >> >>     </dependency-resolution>
>>> >> >>   </configuration>
>>> >> >> </plugin>
>>> >> >>
>>> >> >> If you are interested in more details about my setup which - after
>>> >> >> days of work and investigation - finally works quite smoothly, feel
>>> >> >> free to ask.
>>> >> >>
>>> >> >> Hope that helps.
>>> >> >>
>>> >> >> Regards
>>> >> >> Timo
>>> >> >>
>>> >> >>
>>> >> >> 2012/10/18 Thorsten Schlathoelter <tschlat@xxxxxx>:
>>> >> >> > Hi,
>>> >> >> > we have a single source RCP/RAP application that I am trying to
>>> >> >> > build
>>> >> >> > with tycho. The problem is that we need to mark specific ui
>>> >> >> > bundles
>>> >> as
>>> >> >> > optional because they are only present in either RAP or RCP
>>> >> >> > target
>>> >> platform.
>>> >> >> > E.g. org.eclipse.ui or org.eclipse.rap.ui. Actually these
>>> >> dependencies are
>>> >> >> > semi optional. Depending on the platform to be build one
>>> >> representation has
>>> >> >> > to be present.
>>> >> >> >
>>> >> >> > We need to configure tycho with
>>> >> >> >
>>> >> >> > <dependency-resolution>
>>> >> >> >    <optionalDependencies>ignore</optionalDependencies>
>>> >> >> > </dependency-resolution>
>>> >> >> >
>>> >> >> > in order to get the bundles resolved. But then when we try to
>>> >> compile,
>>> >> >> > the respective optional platform bundles are not pulled from p2
>>> >> >> > into
>>> >> the
>>> >> >> > maven repository. In the course this results in compile errors.
>>> >> >> > The
>>> >> next
>>> >> >> > problem is that the respective platform specific fragments do not
>>> >> compile
>>> >> >> > because they depend on optional required bundles of their host
>>> >> plugin.
>>> >> >> > Solving the fragment issue by adding the optional required
>>> >> >> > bundles
>>> >> from the
>>> >> >> > host to the fragment itself makes this post somewhat for the
>>> >> >> > records.
>>> >> >> > Because the fragment required bundle can be made non optional
>>> >> >> > thus
>>> >> the
>>> >> >> > dependencies are pulled from p2 and are available at compile time
>>> >> also for
>>> >> >> > the host. Nevertheless if no such fragment exists which pulls the
>>> >> >> > dependencies building single source RCP/RAP with tycho seems to
>>> >> >> > be
>>> >> >> > problematic.
>>> >> >> >
>>> >> >> > Any thoughts/hints on this?
>>> >> >> >
>>> >> >> > Regards,
>>> >> >> > Thorsten
>>> >> >> >
>>> >> >> > _______________________________________________
>>> >> >> > tycho-user mailing list
>>> >> >> > tycho-user@xxxxxxxxxxx
>>> >> >> > https://dev.eclipse.org/mailman/listinfo/tycho-user
>>> >> >> _______________________________________________
>>> >> >> tycho-user mailing list
>>> >> >> tycho-user@xxxxxxxxxxx
>>> >> >> https://dev.eclipse.org/mailman/listinfo/tycho-user
>>> >> >
>>> >> >
>>> >> > _______________________________________________
>>> >> > tycho-user mailing list
>>> >> > tycho-user@xxxxxxxxxxx
>>> >> > https://dev.eclipse.org/mailman/listinfo/tycho-user
>>> >> >
>>> >> _______________________________________________
>>> >> tycho-user mailing list
>>> >> tycho-user@xxxxxxxxxxx
>>> >> https://dev.eclipse.org/mailman/listinfo/tycho-user
>>> > _______________________________________________
>>> > tycho-user mailing list
>>> > tycho-user@xxxxxxxxxxx
>>> > https://dev.eclipse.org/mailman/listinfo/tycho-user
>>> _______________________________________________
>>> tycho-user mailing list
>>> tycho-user@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/tycho-user
>>
>>
>>
>> _______________________________________________
>> tycho-user mailing list
>> tycho-user@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/tycho-user
>>
>
>
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tycho-user
>


Back to the top