Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 400740 - [CBI] Source bundles containing libraries do not have correct folder structure
Summary: [CBI] Source bundles containing libraries do not have correct folder structure
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.3 M6   Edit
Assignee: Platform-Releng-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 400956
Blocks: 403098 403256
  Show dependency tree
 
Reported: 2013-02-13 17:21 EST by Curtis Windatt CLA
Modified: 2014-01-14 22:40 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2013-02-13 17:21:26 EST
I20130212-0811

org.eclipse.jdt.debug is split into two libraries jdi.jar and jdimodel.jar.  The source for the libraries is stored in two separate source folders.  When building the source bundle, the source for each librray should be placed into a separate folder (jdisrc and jdimodelsrc).

In the CBI based build, the source for both libraries is being placed at the root of the source bundle.

This breaks PDE plug-in import because we need to create separate source folders in the created project based on the libraries.  With the source at the root of the jar we have no idea what files are actually source for the bundle and what library they belong to.  Source attachments still work because JDT will fall back at looking at the root of the jar, but this will come with some performance penalty.

For another example see org.eclipse.pde.build.source
Comment 1 Jan Sievers CLA 2013-02-18 11:10:11 EST
(In reply to comment #0)
> I20130212-0811
> 
> org.eclipse.jdt.debug is split into two libraries jdi.jar and jdimodel.jar. 
> The source for the libraries is stored in two separate source folders. 

Actually I see 4 source folders total for the two jars in [1]
It seems that folders model/, jdi/, eval/ which make up jdimodel.jar are collapsed into one inside the source bundle.
For bug 400956, I am trying to figure out the algorithm for naming the source root inside the source jar.
Can you shed some light what PDE expects when importing?

Is there some naming convention to be followed for the source roots based on the corresponding nested jar name?


[1] http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/tree/org.eclipse.jdt.debug
Comment 2 Curtis Windatt CLA 2013-02-19 13:24:01 EST
(In reply to comment #1)
> (In reply to comment #0)
> > I20130212-0811
> > 
> > org.eclipse.jdt.debug is split into two libraries jdi.jar and jdimodel.jar. 
> > The source for the libraries is stored in two separate source folders. 
> 
> Actually I see 4 source folders total for the two jars in [1]
> It seems that folders model/, jdi/, eval/ which make up jdimodel.jar are
> collapsed into one inside the source bundle.
> For bug 400956, I am trying to figure out the algorithm for naming the
> source root inside the source jar.
> Can you shed some light what PDE expects when importing?
> 
> Is there some naming convention to be followed for the source roots based on
> the corresponding nested jar name?
> 
> 
> [1]
> http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/tree/org.eclipse.jdt.debug

The convention was to put the source for library foo.jar in a folder called foosrc.  The naming convention only matters to PDE plug-in import, which can be modified.  However, having source roots for the libraries (vs at bundle root) has performance impact.  PDE gets the source roots from the manifest file in the source bundle.  For example, here is the entry for jdt debug.

Eclipse-SourceBundle: org.eclipse.jdt.debug;version="3.8.0.v20130121-1
 85839";roots:="jdisrc,jdimodelsrc"
Comment 3 Jan Sievers CLA 2013-02-20 03:31:23 EST
(In reply to comment #2)
> (In reply to comment #1)
> > (In reply to comment #0)
> > > I20130212-0811
> > > 
> > > org.eclipse.jdt.debug is split into two libraries jdi.jar and jdimodel.jar. 
> > > The source for the libraries is stored in two separate source folders. 
> > 
> > Actually I see 4 source folders total for the two jars in [1]
> > It seems that folders model/, jdi/, eval/ which make up jdimodel.jar are
> > collapsed into one inside the source bundle.
> > For bug 400956, I am trying to figure out the algorithm for naming the
> > source root inside the source jar.
> > Can you shed some light what PDE expects when importing?
> > 
> > Is there some naming convention to be followed for the source roots based on
> > the corresponding nested jar name?
> > 
> > 
> > [1]
> > http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/tree/org.eclipse.jdt.debug
> 
> The convention was to put the source for library foo.jar in a folder called
> foosrc.  The naming convention only matters to PDE plug-in import, which can
> be modified.  However, having source roots for the libraries (vs at bundle
> root) has performance impact.  PDE gets the source roots from the manifest
> file in the source bundle.  For example, here is the entry for jdt debug.
> 
> Eclipse-SourceBundle: org.eclipse.jdt.debug;version="3.8.0.v20130121-1
>  85839";roots:="jdisrc,jdimodelsrc"

thanks Curtis. This matches what I had reverse-engineered from some example source bundles and implemented with bug 400956 now
Comment 4 Jan Sievers CLA 2013-03-13 05:33:37 EDT
@Thanh you need to configure distinctSourceRoots=true [1]

<plugin>
 <groupId>org.eclipse.tycho</groupId>
 <artifactId>tycho-source-plugin</artifactId>
 <version>${tycho-version}</version>
 <configuration>
  <distinctSourceRoots>true</distinctSourceRoots>
 </configuration>
</plugin>

in the parent pom to get desired behaviour for nested jar sources.

[1] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=e0a74423888b26d8ae968c5757c3a46874c5ac89
Comment 5 Thanh Ha CLA 2013-03-13 13:45:47 EDT
(In reply to comment #4)
> @Thanh you need to configure distinctSourceRoots=true [1]
> 

I released this into master:
http://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/commit/?id=96bb6ad3a50d9998eff6c3246cfcdcf6c8c68788


We should port this back to 3.8 and 4.2 I think.
Comment 6 David Williams CLA 2013-03-13 15:04:57 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > @Thanh you need to configure distinctSourceRoots=true [1]
> > 
> 
> I released this into master:
> http://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/
> commit/?id=96bb6ad3a50d9998eff6c3246cfcdcf6c8c68788
> 
> 
> We should port this back to 3.8 and 4.2 I think.

Yes, I suggest you "clone" this bug, and set its target to the 4.2.2+ so we can keep better track. (And, to me, 422+ means both 3.8.2 and 4.2.2, if there's a difference in streams, except for a few rare cases).
Comment 7 Dani Megert CLA 2013-03-14 02:59:14 EDT
(In reply to comment #6)
> (And, to me, 422+ means both 3.8.2 and 4.2.2, if
> there's a difference in streams, except for a few rare cases).

No, 3.8.2+ means that. 4.2.2+ only means 4.2.2 maintenance.
Comment 8 Dani Megert CLA 2013-03-14 03:01:07 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > (And, to me, 422+ means both 3.8.2 and 4.2.2, if
> > there's a difference in streams, except for a few rare cases).
> 
> No, 3.8.2+ means that. 4.2.2+ only means 4.2.2 maintenance.

Or, if that's too confusing, one can also have two separate bugs. Both approaches are taken by different components.
Comment 9 Thanh Ha CLA 2013-03-15 09:16:29 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > We should port this back to 3.8 and 4.2 I think.
> 
> Yes, I suggest you "clone" this bug, and set its target to the 4.2.2+ so we
> can keep better track. (And, to me, 422+ means both 3.8.2 and 4.2.2, if
> there's a difference in streams, except for a few rare cases).

Forgot to mention I created Bug 403256 as a clone of this bug.