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"

Line 1: Line 1:
 
Created from [https://bugs.eclipse.org/bugs/show_bug.cgi?id=184026 bug 184026].
 
Created from [https://bugs.eclipse.org/bugs/show_bug.cgi?id=184026 bug 184026].
 
===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, this is what 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
* add your bundle (NOT your source bundle) to the feature
+
 
 +
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.
 +
 
<pre>
 
<pre>
 
{plugin_root}
 
{plugin_root}
Line 22: Line 25:
 
...
 
...
 
src/{plugin_id}_{version}/src.zip
 
src/{plugin_id}_{version}/src.zip
 +
</pre>
 +
 +
Example for junit 3.8.2
 +
 +
<pre>
 +
org.junit
 +
META-INF/MANIFEST.MF
 +
plugin.properties
 +
build.properties
 +
junit.jar
 +
source-bundle/
 +
META-INF/MANIFEST.MF
 +
plugin.xml
 +
build.properties
 +
customCallbacks.xml
 +
src/org.junit_3.8.2/junitsrc.zip
 
</pre>
 
</pre>
  
 
===customCallbacks.xml===
 
===customCallbacks.xml===
 +
Edit the customCallbacks.xml and add the following target.
 +
 
<pre>
 
<pre>
<?xml version="1.0" encoding="UTF-8"?>
 
<project name="customCallbacks" default="post.gather.bin.parts" basedir=".">
 
 
<target name="post.gather.bin.parts">
 
<target name="post.gather.bin.parts">
 
<echo message="${target.folder}" />
 
<echo message="${target.folder}" />
Line 47: Line 66:
 
</move>
 
</move>
 
</target>
 
</target>
</project>
+
 
 
</pre>
 
</pre>
  
 
===build.properties===
 
===build.properties===
 +
Add the following entries to the build.properties of the source bundle.
 
<pre>
 
<pre>
 
customBuildCallbacks=customCallbacks.xml
 
customBuildCallbacks=customCallbacks.xml
Line 63: Line 83:
 
* edit the build.xml to refer to the location of the bundle for which source is being generated
 
* edit the build.xml to refer to the location of the bundle for which source is being generated
 
* execute the script
 
* execute the script
 
+
 
http://wiki.eclipse.org/index.php/Image:SourceGen.zip
 
http://wiki.eclipse.org/index.php/Image:SourceGen.zip
 
[[Category : Orbit]]
 
[[Category : Orbit]]

Revision as of 11:17, 22 May 2007

Created from bug 184026.

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

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

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.

{plugin_root}
	META-INF/MANIFEST.MF
	plugin.xml
	plugin.properties
	build.properties
	{class_files}
	...
	source-bundle/
		META-INF/MANIFEST.MF
		plugin.xml
		build.properties
		customCallbacks.xml
		...
		src/{plugin_id}_{version}/src.zip

Example for junit 3.8.2

org.junit
	META-INF/MANIFEST.MF
	plugin.properties
	build.properties
	junit.jar
	source-bundle/
		META-INF/MANIFEST.MF
		plugin.xml
		build.properties
		customCallbacks.xml
		src/org.junit_3.8.2/junitsrc.zip

customCallbacks.xml

Edit the customCallbacks.xml and add the following target.

	<target name="post.gather.bin.parts">
		<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>

build.properties

Add the following entries to the build.properties of the source bundle.

customBuildCallbacks=customCallbacks.xml
customBuildCallbacks.inheritall=true               


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

Copyright © Eclipse Foundation, Inc. All Rights Reserved.