summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-10-02 18:06:08 +0300
committerArtur Signell <artur@vaadin.com>2012-10-02 18:06:08 +0300
commit21308eedc68c59048b9bd46f1c609680c3ee0738 (patch)
tree2e067557c9a5ba9fd708f468439066953514d9de
parent88dbeb172c52bb5963616b67729618d55a8eb6b6 (diff)
downloadvaadin-framework-21308eedc68c59048b9bd46f1c609680c3ee0738.tar.gz
vaadin-framework-21308eedc68c59048b9bd46f1c609680c3ee0738.zip
Removed hard coded package names from export metadata generator (#9612)
Change-Id: I860d9241e270a2a96796b4800f0bbbc808e2e710
-rw-r--r--buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java43
-rw-r--r--common.xml3
2 files changed, 33 insertions, 13 deletions
diff --git a/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java b/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java
index 0deebdc9a1..be7d502baa 100644
--- a/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java
+++ b/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java
@@ -1,10 +1,12 @@
package com.vaadin.buildhelpers;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Vector;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
@@ -24,13 +26,12 @@ import java.util.jar.Manifest;
* @author magi
*/
public class GeneratePackageExports {
- public static final String VAADIN_PACKAGE_PATH_PREFIX = "com/vaadin/";
- public static final String GOOGLE_PACKAGE_PATH_PREFIX = "com/google/";
public static void main(String[] args) {
- if (args.length < 1) {
- System.err.println("Invalid number of parameters\n"
- + "Usage: java -cp .. GenerateManifest <package.jar>");
+ if (args.length < 2) {
+ System.err
+ .println("Invalid number of parameters\n"
+ + "Usage: java -cp .. GenerateManifest <package.jar> <accepted package prefixes>");
System.exit(1);
}
@@ -44,18 +45,35 @@ public class GeneratePackageExports {
System.exit(1);
}
+ // Accepted packages
+ List<String> acceptedPackagePrefixes = new ArrayList<String>();
+ for (int i = 1; i < args.length; i++) {
+ acceptedPackagePrefixes.add(args[i]);
+ }
+
// List the included Java packages
HashSet<String> packages = new HashSet<String>();
for (Enumeration<JarEntry> it = jar.entries(); it.hasMoreElements();) {
JarEntry entry = it.nextElement();
- if ((entry.getName().startsWith(VAADIN_PACKAGE_PATH_PREFIX) || entry
- .getName().startsWith(GOOGLE_PACKAGE_PATH_PREFIX))
- && entry.getName().endsWith(".class")) {
- int lastSlash = entry.getName().lastIndexOf('/');
- String pkg = entry.getName().substring(0, lastSlash)
- .replace('/', '.');
- packages.add(pkg);
+ if (!entry.getName().endsWith(".class")) {
+ continue;
}
+
+ boolean accept = false;
+ for (String prefix : acceptedPackagePrefixes) {
+ if (entry.getName().startsWith(prefix)) {
+ accept = true;
+ break;
+ }
+ }
+ if (!accept) {
+ continue;
+ }
+
+ int lastSlash = entry.getName().lastIndexOf('/');
+ String pkg = entry.getName().substring(0, lastSlash)
+ .replace('/', '.');
+ packages.add(pkg);
}
// List theme packages
@@ -148,5 +166,4 @@ public class GeneratePackageExports {
System.exit(status);
}
}
-
}
diff --git a/common.xml b/common.xml
index a854ef4358..ffaf27b735 100644
--- a/common.xml
+++ b/common.xml
@@ -194,6 +194,9 @@
JAR -->
<java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes">
<arg value="${jar}" />
+ <arg value="com/vaadin" />
+ <arg value="com/google" />
+
<classpath refid="vaadin.buildhelpers.classpath" />
</java>
</target>