System.err
.println("Invalid number of parameters\n"
+ "Usage: java -cp .. GenerateManifest <package.jar> <accepted package prefixes>\n"
- + "Use -Dvaadin.version to specify the version to be used for the packages");
+ + "Use -Dvaadin.version to specify the version to be used for the packages\n"
+ + "Use -DincludeNumberPackages=1 to include package names which start with a number (not 100% OSGi compatible)");
System.exit(1);
}
acceptedPackagePrefixes.add(args[i]);
}
+ boolean includeNumberPackages = false;
+ if ("1".equals(System.getProperty("includeNumberPackages"))) {
+ includeNumberPackages = true;
+ }
+
// List the included Java packages
- HashSet<String> packages = getPackages(jar, acceptedPackagePrefixes);
+ HashSet<String> packages = getPackages(jar, acceptedPackagePrefixes,
+ includeNumberPackages);
// Avoid writing empty Export-Package attribute
if (packages.isEmpty()) {
}
private static HashSet<String> getPackages(JarFile jar,
- List<String> acceptedPackagePrefixes) {
+ List<String> acceptedPackagePrefixes, boolean includeNumberPackages) {
HashSet<String> packages = new HashSet<String>();
Pattern startsWithNumber = Pattern.compile("\\.\\d");
String pkg = entry.getName().substring(0, lastSlash)
.replace('/', '.');
- if (startsWithNumber.matcher(pkg).find()) {
+ if (!includeNumberPackages && startsWithNumber.matcher(pkg).find()) {
continue;
}
<target name="jar" depends="default-widgetset">
<antcall target="common.jar">
<param name="osgi.extra.package.prefixes" value="VAADIN/widgetsets/" />
+ <param name="osgi.includeNumberPackages" value="1" />
<reference torefid="extra.jar.includes" refid="jar.includes" />
</antcall>
</target>
<param name="bundle-name" value="${module.name}" />
<param name="bundle-symbolic" value="${module.symbolic}" />
<param name="bundle-vendor" value="${vaadin.vendor}" />
+ <param name="includeNumberPackages" value="${osgi.includeNumberPackages}" />
</antcall>
</target>
<fail unless="bundle-symbolic" message="No bundle-symbolic parameter given" />
<fail unless="bundle-version" message="No bundle-version parameter given" />
<fail unless="bundle-vendor" message="No bundle-vendor parameter given" />
-
+ <fail unless="includeNumberPackages" message="No includeNumberPackages parameter given" />
<property name="bundle-manifestversion" value="2" />
<jar file="${jar}" update="true">
<arg line="com/vaadin com/google ${osgi.extra.package.prefixes}" />
<classpath refid="buildhelpers.classpath" />
<jvmarg value="-Dvaadin.version=${vaadin.version}" />
+ <jvmarg value="-DincludeNumberPackages=${includeNumberPackages}" />
</java>
</target>