Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Manifest file editing for library plug-ins
Manifest file editing for library plug-ins [message #282445] Fri, 11 March 2005 17:45 Go to next message
Eclipse UserFriend
Hi

I would like to create a library plugin ala junit but for fit and using
the osgi format for 3.1 and beyond. How do I transform the following
into the Manifest file?

<runtime>
<library name="fit.jar">
<export name="*"/>
</library>
</runtime>

thank you.

-H
Re: Manifest file editing for library plug-ins [message #282753 is a reply to message #282445] Fri, 18 March 2005 16:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chaves.inf.no.ufsc.spam.br

The Plug-in Manifest editor has an option that generates the manifest
automatically. See the Runtime tab.

Rafael

Hugo A. Garica wrote:
> Hi
>
> I would like to create a library plugin ala junit but for fit and using
> the osgi format for 3.1 and beyond. How do I transform the following
> into the Manifest file?
>
> <runtime>
> <library name="fit.jar">
> <export name="*"/>
> </library>
> </runtime>
>
> thank you.
>
> -H
Re: Manifest file editing for library plug-ins [message #282903 is a reply to message #282753] Wed, 23 March 2005 08:41 Go to previous messageGo to next message
Eclipse UserFriend
Yeah - if You are referring to "Export the entire Library" radio, it is
disabled when using osgi manifest file...

Rafael Chaves kirjutas mulle ühel talvisel päeval midagi seesugust:
> The Plug-in Manifest editor has an option that generates the manifest
> automatically. See the Runtime tab.
>
> Rafael
>
> Hugo A. Garica wrote:
>
>> Hi
>>
>> I would like to create a library plugin ala junit but for fit and
>> using the osgi format for 3.1 and beyond. How do I transform the
>> following into the Manifest file?
>>
>> <runtime>
>> <library name="fit.jar">
>> <export name="*"/>
>> </library>
>> </runtime>
>>
>> thank you.
>>
>> -H

--
Roland Tepp
Re: Manifest file editing for library plug-ins [message #282936 is a reply to message #282445] Wed, 23 March 2005 23:44 Go to previous message
Eclipse UserFriend
Originally posted by: ifedorenko.rogers.com

This is a multi-part message in MIME format.
--------------080809020606040003080001
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Here is how I solved this problem

1. generated Manifest.mf using plugin manifest editor
2. ran attached program from plugin's root directory


Hugo A. Garica wrote:
> Hi
>
> I would like to create a library plugin ala junit but for fit and using
> the osgi format for 3.1 and beyond. How do I transform the following
> into the Manifest file?
>
> <runtime>
> <library name="fit.jar">
> <export name="*"/>
> </library>
> </runtime>
>
> thank you.
>
> -H

--------------080809020606040003080001
Content-Type: text/plain;
name="GenerateManifest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="GenerateManifest.java"

package test.eclipse.manifest;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class GenerateManifest {
public static void main(String[] args) throws IOException {
InputStream is = new FileInputStream("META-INF/MANIFEST.MF");
Manifest m;
try {
m = new Manifest(is);
} finally {
is.close();
}
Attributes a = m.getMainAttributes();
String o = a.getValue("Bundle-ClassPath");
StringTokenizer st = new StringTokenizer(o, ",");
Set<String> packages = new HashSet<String>();
while (st.hasMoreTokens()) {
addPackages(packages, st.nextToken());
}
StringBuilder sb = new StringBuilder();
for (String p : packages) {
sb.append(p).append(',');
}
a.putValue("Provide-Package", sb.substring(0, sb.length() - 1));
OutputStream os = new FileOutputStream("META-INF/MANIFEST.MF");
try {
m.write(os);
} finally {
os.close();
}
}

private static void addPackages(Set<String> packages, String filename) throws IOException {
ZipFile jar = new ZipFile(filename);
Enumeration entries = jar.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
if (entry.isDirectory()) {
String dir = entry.getName();
packages.add(dir.substring(0, dir.length() - 1).replace('/', '.'));
}
}
}
}

--------------080809020606040003080001--
Previous Topic:erratic response to Text.setFocus
Next Topic:Combo selection problems in wizard in RCP
Goto Forum:
  


Current Time: Sat Sep 13 17:05:03 EDT 2025

Powered by FUDForum. Page generated in 0.04019 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top