Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 389762 - Add support to tycho-source-feature-plugin to allow including non-source bundles
Summary: Add support to tycho-source-feature-plugin to allow including non-source bundles
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Igor Fedorenko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 377190
  Show dependency tree
 
Reported: 2012-09-17 16:22 EDT by Thanh Ha CLA
Modified: 2021-04-28 16:55 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thanh Ha CLA 2012-09-17 16:22:38 EDT
There are some source features in Eclipse Platform that need to include non-source bundles. As shown in [1] org.eclipse.platform.source and org.eclipse.jdt.source features include org.eclipse.platform.doc.isv and org.eclipse.jdt.doc.isv respectively. We need support in Tycho to allow these bundles to be included.


[1] http://git.eclipse.org/c/platform/eclipse.platform.releng.git/tree/features/org.eclipse.sdk/build.properties
Comment 1 David Williams CLA 2012-09-17 20:17:47 EDT
While it would be nice to duplicate SDK build exactly, I am actually unsure of the reason that doc bundles have to be in source features. That doesn't seem quite right, conceptually. 

It seems the important thing is that they are in the "SDK feature". Perhaps this was a short cut taken some time in the past? (Since, for example, there is not a JDT SDK feature?) But, those more familiar with history and packaging needs might better understand why its this way.
Comment 2 Mickael Istria CLA 2012-09-18 02:07:09 EDT
As a workaround, you can create your source-feature "mamnually" containing source bundles (generated by Tycho) and others, instead of relying on tycho-source-feature-plugin.
Tycho-source-feature-plugin is useful for default behaviour, but in such cases where the behaviorr is not the default one, it may be better to rely on a feature.xml rather than on this plugin.
Comment 3 Paul Webster CLA 2012-09-18 13:24:51 EDT
I'm hoping including another plugin is not more of a stretch than excluding one (although as I write that, obviously not the same :-).  The more of this that can be generated, the better.

If I specify a source feature that references a lot of plugins that don't (yet) exist I thought maven and/or tycho would fail with unresolved dependencies.

PW
Comment 4 Mickael Istria CLA 2012-09-18 13:34:15 EDT
(In reply to comment #3)
> I'm hoping including another plugin is not more of a stretch than excluding
> one (although as I write that, obviously not the same :-).  The more of this
> that can be generated, the better.

I agree this request makes sense.

> If I specify a source feature that references a lot of plugins that don't
> (yet) exist I thought maven and/or tycho would fail with unresolved
> dependencies.

*I think*, tycho-source-plugim comes with a SourceP2MetadataProvider component which makes that Tycho know that source bundle WILL exist when resolving dependencies.
So it works.
Comment 5 Igor Fedorenko CLA 2012-09-22 11:50:44 EDT
I've proposed two related changes to tycho and tycho-extras that introduce new experimental (!) <plugins> source feature plugin parameter. 


Here is an example pom.xml configuration


      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <dependency-resolution>
            <extraRequirements>
              <!-- this guarantees proper reactor build order  -->
              <requirement>
                <type>eclipse-plugin</type>
                <id>extra.sourcefeature.bundle</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
            </extraRequirements>
          </dependency-resolution>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.eclipse.tycho.extras</groupId>
        <artifactId>tycho-source-feature-plugin</artifactId>
        <version>${tycho-extras-version}</version>
        <executions>
          <execution>
            <id>source-feature</id>
            <phase>package</phase>
            <goals>
              <goal>source-feature</goal>
            </goals>
            <configuration>
              <plugins>
                <plugin id="extra.sourcefeature.bundle" versionRange="0.0.0" />
              </plugins>
            </configuration>
          </execution>
        </executions>
      </plugin>


Note that the same plugin has to be specified both in tycho-source-feature-plugin and target-platform-configuration configuration blocks. This is necessary to guarantee proper multi-module build order.


Also note that at this point I consider this new parameter experimental and it can be removed from future tycho versions without prio notice if it proves to be problematic and causing confusion to tycho users and extra support overhead for tycho developers.

tycho change
https://git.eclipse.org/r/7874

tycho-extras change
https://git.eclipse.org/r/7875
Comment 6 Igor Fedorenko CLA 2012-09-28 13:44:14 EDT
Merge the changes. The next successful tycho/tycho-extras 0.16 build should support source feature <plugins> configuration
Comment 7 Paul Webster CLA 2012-10-02 16:21:49 EDT
(In reply to comment #6)
> Merge the changes. The next successful tycho/tycho-extras 0.16 build should
> support source feature <plugins> configuration

It looks like the last snapshot pushed up was 20120918.  Will there be another one soon?

PW
Comment 8 Igor Fedorenko CLA 2012-10-02 19:12:35 EDT
There was a hiccup in out build system. New version of tycho-extras should be deployed now.
Comment 9 Laurent Goubet CLA 2012-12-17 11:09:50 EST
This is marked as "fixed" ... but as I see it, the subject of this bug does not match the fix that's been pushed (or I don't understand how)?

I have a feature F1 that includes plug-ins "P1" and "P2" ... and a third plugin that does not hold sources (a documentation plugin, for example), let's call it P3.

Using tycho-source-feature on F1, in addition with tycho-source-plugin on P1 and P2 so that their sources are generated, I would expect F1.source to contain P1.source and P2.source; then either ignore or include P3, included by F1 but for which no source plugin _can_ be generated (it only contains documentation, no source at all). In stead, it simply fails in exception, telling me that its "Missing sources for plugins [P3_3.3.1.201212171551]" (you can look at the console of my latest test for more on the stack trace : https://hudson.eclipse.org/hudson/view/Modeling/job/m2t-acceleo-master/287/consoleFull ).

So, how can I tell my source feature to include (or exclude for that matter) the non-source bundle "P3" ? Am I forced to create my own source feature including only the source plugins that could be generated?
Comment 10 Paul Webster CLA 2012-12-17 12:46:25 EST
(In reply to comment #9)
> This is marked as "fixed" ... but as I see it, the subject of this bug does
> not match the fix that's been pushed (or I don't understand how)?

we use this functionality in http://git.eclipse.org/c/platform/eclipse.platform.releng.git/tree/features/org.eclipse.platform-feature/pom.xml?h=R4_2_maintenance#n60

Our platform feature does not contain our isv.doc, but we want our platform.source feature to contain it.

The other option (if your doc is in your regular feature) is to exclude it  from the source feature like we do with our user.doc -  http://git.eclipse.org/c/platform/eclipse.platform.releng.git/tree/features/org.eclipse.platform-feature/pom.xml?h=R4_2_maintenance#n64

PW
Comment 11 Laurent Goubet CLA 2012-12-18 03:16:30 EST
Paul,

Thanks for the pointers, seems like I indeed did not understand "how" this was fixed :).

I cannot launch any build atm (error 400 from hudson), but I'll try the exclusion filters from my source feature generation.
Comment 12 Mickael Istria CLA 2012-12-18 03:18:45 EST
(In reply to comment #11)
> I cannot launch any build atm (error 400 from hudson),

Do you really need hudson to get "mvn verify" to work? If yes, that's not a very good thing, you should spend some time one making builds working locally.
My 2c ;)
Comment 13 Laurent Goubet CLA 2012-12-18 03:34:01 EST
Mickael,

My builds do work locally yes, though I was too lazy to fire a command line :p.

And not being able to fire hudson builds would have been a real issue today since I have two M4 to build (that was only a cookies issue fortunately).
Comment 14 Laurent Goubet CLA 2012-12-18 03:52:35 EST
And the exclusion filters work for my use case too. For any other that could stumble on this bug while searching "how to exclude non-source bundles from source feature generation", here is what should be added to the pom.xml of the incriminated feature :

  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho.extras</groupId>
        <artifactId>tycho-source-feature-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <id>source-feature</id>
            <goals>
              <goal>source-feature</goal>
            </goals>
            <configuration>
              <excludes>
                <!-- ID of the non-source bundle(s) to exclude from the generated source feature -->
                <plugin id="org.eclipse.acceleo.doc"/>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>