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 "Orbit Source Bundles"

(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Created from [https://bugs.eclipse.org/bugs/show_bug.cgi?id=184026 bug 184026].
+
Originally created from [https://bugs.eclipse.org/bugs/show_bug.cgi?id=184026 bug 184026] and then updated to describe the changes for JAR'd source bundles as per [https://bugs.eclipse.org/bugs/show_bug.cgi?id=206596 bug 206596].
 +
 
 
===What you need to do===
 
===What you need to do===
 
If you have bundles in Orbit and you would like to have source bundles automatically generated for you, here are the things that you have to do:
 
If you have bundles in Orbit and you would like to have source bundles automatically generated for you, here are the things that you have to do:
 
   * put your bundles in the structure below
 
   * put your bundles in the structure below
 
   * add a map file entry for your source bundle
 
   * add a map file entry for your source bundle
 
We highly recommend the usage of the script attached at the bottom of this page, since it will create the right shape and do almost all the necessary steps.
 
  
 
===Bundle structure===
 
===Bundle structure===
In order to leverage the automatic infrastructure, avoid the profusion of projects in CVS and simplify management, it is recommended that you store the source bundles in the same project than its binary counter part. This is achieved by creating a sub-folder called "source-bundle" in the project. This folder will be setup like any other bundle with a manifest.mf, build.properties, etc... The zip files containing the source should follow a strict structure (see example below) and should be named after the entries specified in the BundleClasspath of the manifest.mf.  
+
In order to leverage the automatic infrastructure, avoid the profusion of projects in CVS and simplify management, it is recommended that you store the source bundles in the same project than its binary counter part. This is achieved by creating a sub-folder called "source-bundle" in the project. This folder will be setup like any other bundle with a manifest.mf, build.properties, etc...  
  
 
<pre>
 
<pre>
 
{plugin_root}
 
{plugin_root}
 +
about_files/
 
META-INF/MANIFEST.MF
 
META-INF/MANIFEST.MF
plugin.xml
+
about.html
plugin.properties
+
 
build.properties
 
build.properties
 +
plugin.properties
 
{class_files}
 
{class_files}
 
...
 
...
 
source-bundle/
 
source-bundle/
 +
about_files/
 
META-INF/MANIFEST.MF
 
META-INF/MANIFEST.MF
plugin.xml
+
about.html
 
build.properties
 
build.properties
customCallbacks.xml
+
plugin.properties
 
...
 
...
src/{plugin_id}_{version}/src.zip
+
{source_files}
 
</pre>
 
</pre>
  
Example for junit 3.8.2
+
Example for javax.servlet 2.4
  
 
<pre>
 
<pre>
org.junit
+
javax.servlet
 +
about_files/
 
META-INF/MANIFEST.MF
 
META-INF/MANIFEST.MF
plugin.properties
+
about.html
 
build.properties
 
build.properties
junit.jar
+
javax/servlet/{dot_class_files}
 +
plugin.properties
 
source-bundle/
 
source-bundle/
 +
about_files/
 
META-INF/MANIFEST.MF
 
META-INF/MANIFEST.MF
plugin.xml
+
about.html
 
build.properties
 
build.properties
customCallbacks.xml
+
plugin.properties
src/org.junit_3.8.2/junitsrc.zip
+
javax/servlet/{dot_java_files}
 
</pre>
 
</pre>
  
===customCallbacks.xml===
+
===MANIFEST.MF===
Edit the customCallbacks.xml and add the following target.
+
In the old Eclipse method, source bundles were contributed to Eclipse by using an extension point. In the new method, you will need to add a new bundle header to your bundle manifest to tell Eclipse that your bundle is a source bundle and to specify the id and version of the host bundle.  
 
+
 
<pre>
 
<pre>
<target name="post.gather.bin.parts">
+
Eclipse-SourceBundle: my.bundle.id;version="1.0.0.qualifier"
<echo message="${target.folder}" />
+
<echo message="${build.result.folder}" />
+
<pathconvert property="binaryBundleId">
+
<path>
+
<fileset dir="${target.folder}/src" includes="**" />
+
</path>
+
<regexpmapper from=".*\\(.*)_(.*)\\.*" to="\1" />
+
</pathconvert>
+
<pathconvert property="sourceFolderVersion">
+
<path>
+
<fileset dir="${target.folder}/src" includes="**" />
+
</path>
+
<regexpmapper from=".*\\(.*_.*)\\.*" to="\1" />
+
</pathconvert>
+
<move todir="${target.folder}/src/${binaryBundleId}_${bundleVersion}">
+
<fileset dir="${target.folder}/src/${sourceFolderVersion}" includes="**" />
+
</move>
+
</target>
+
 
+
 
</pre>
 
</pre>
 +
This is the format for the most common case; where the bundle source is unzipped at the root of the source bundle.
 +
 +
====Multiple Roots====
 +
If you have multiple folders in your source bundle which specify source, then you must tell Eclipse that there are multiple roots. This can be the case for instance if you ship an un-JAR'd bundle with multiple source zip files that you don't want to merge into a single directory structure.
 +
<pre>
 +
Eclipse-SourceBundle: my.bundle.id;version="1.0.0.qualifier";roots:="folder1,folder2"
 +
</pre>
  
 
===build.properties===
 
===build.properties===
Add the following entries to the build.properties of the source bundle.
+
The build.properties file for the source bundle is pretty simple, just include all the files you want in your bundle. For instance:
 
<pre>
 
<pre>
customBuildCallbacks=customCallbacks.xml
+
bin.includes = about.html,\
customBuildCallbacks.inheritall=true             
+
              about_files/,\
 +
              plugin.properties,\
 +
              META-INF/,\
 +
              javax/
 
</pre>
 
</pre>
  
  
===Utility to generate source bundles===
 
Given an orbit bundle loaded in your workspace, the attached script will generate a corresponding source bundle following the shape described above.
 
To use the utility:
 
* import the archive in your workspace
 
* edit the build.xml to refer to the location of the bundle for which source is being generated
 
* execute the script
 
 
http://wiki.eclipse.org/index.php/Image:SourceGen.zip
 
 
[[Category : Orbit]]
 
[[Category : Orbit]]

Revision as of 14:13, 29 February 2008

Originally created from bug 184026 and then updated to describe the changes for JAR'd source bundles as per bug 206596.

What you need to do

If you have bundles in Orbit and you would like to have source bundles automatically generated for you, here are the things that you have to do:

 * put your bundles in the structure below
 * add a map file entry for your source bundle

Bundle structure

In order to leverage the automatic infrastructure, avoid the profusion of projects in CVS and simplify management, it is recommended that you store the source bundles in the same project than its binary counter part. This is achieved by creating a sub-folder called "source-bundle" in the project. This folder will be setup like any other bundle with a manifest.mf, build.properties, etc...

{plugin_root}
	about_files/
	META-INF/MANIFEST.MF
	about.html
	build.properties
	plugin.properties
	{class_files}
	...
	source-bundle/
		about_files/
		META-INF/MANIFEST.MF
		about.html
		build.properties
		plugin.properties
		...
		{source_files}

Example for javax.servlet 2.4

javax.servlet
	about_files/
	META-INF/MANIFEST.MF
	about.html
	build.properties
	javax/servlet/{dot_class_files}
	plugin.properties
	source-bundle/
		about_files/
		META-INF/MANIFEST.MF
		about.html
		build.properties
		plugin.properties
		javax/servlet/{dot_java_files}

MANIFEST.MF

In the old Eclipse method, source bundles were contributed to Eclipse by using an extension point. In the new method, you will need to add a new bundle header to your bundle manifest to tell Eclipse that your bundle is a source bundle and to specify the id and version of the host bundle.

Eclipse-SourceBundle: my.bundle.id;version="1.0.0.qualifier"

This is the format for the most common case; where the bundle source is unzipped at the root of the source bundle.

Multiple Roots

If you have multiple folders in your source bundle which specify source, then you must tell Eclipse that there are multiple roots. This can be the case for instance if you ship an un-JAR'd bundle with multiple source zip files that you don't want to merge into a single directory structure.

Eclipse-SourceBundle: my.bundle.id;version="1.0.0.qualifier";roots:="folder1,folder2"

build.properties

The build.properties file for the source bundle is pretty simple, just include all the files you want in your bundle. For instance:

bin.includes = about.html,\
               about_files/,\
               plugin.properties,\
               META-INF/,\
               javax/

Back to the top