launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java
branchclosure
changeset 1583 89b6b369c13d
parent 1552 5a840853d1a8
child 1586 d4ee65642d8d
     1.1 --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java	Sun May 11 08:05:27 2014 +0200
     1.2 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java	Wed May 21 23:42:24 2014 +0200
     1.3 @@ -49,21 +49,8 @@
     1.4      throws IOException {
     1.5          List<String> arr = new ArrayList<>();
     1.6          List<String> classes = new ArrayList<>();
     1.7 -        Set<String> exported = new HashSet<String>();
     1.8          Set<String> keep = new HashSet<String>(testClasses);
     1.9 -        listJAR(jar, classes, arr, exported, keep);
    1.10 -        List<String> root = new ArrayList<>();
    1.11 -        for (String c : classes) {
    1.12 -            if (keep.contains(c)) {
    1.13 -                root.add(c);
    1.14 -                continue;
    1.15 -            }
    1.16 -            int slash = c.lastIndexOf('/');
    1.17 -            String pkg = c.substring(0, slash + 1);
    1.18 -            if (exported.contains(pkg)) {
    1.19 -                root.add(c);
    1.20 -            }
    1.21 -        }
    1.22 +        listJAR(jar, classes, arr, keep);
    1.23          
    1.24          StringWriter w = new StringWriter();
    1.25          try {
    1.26 @@ -77,7 +64,7 @@
    1.27              
    1.28              Bck2Brwsr.newCompiler()
    1.29                  .addClasses(classes.toArray(new String[0]))
    1.30 -                .addRootClasses(root.toArray(new String[0]))
    1.31 +                .addExported(keep.toArray(new String[0]))
    1.32                  .addResources(arr.toArray(new String[0]))
    1.33                  .library(true)
    1.34                  .resources(new JarRes())
    1.35 @@ -138,7 +125,7 @@
    1.36      
    1.37      private static void listJAR(
    1.38          JarFile j, List<String> classes,
    1.39 -        List<String> resources, Set<String> exported, Set<String> keep
    1.40 +        List<String> resources, Set<String> keep
    1.41      ) throws IOException {
    1.42          Enumeration<JarEntry> en = j.entries();
    1.43          while (en.hasMoreElements()) {
    1.44 @@ -172,10 +159,10 @@
    1.45              }
    1.46          }
    1.47          String exp = j.getManifest().getMainAttributes().getValue("Export-Package");
    1.48 -        if (exp != null && exported != null) {
    1.49 +        if (exp != null && keep != null) {
    1.50              for (String def : exp.split(",")) {
    1.51                  for (String sep : def.split(";")) {
    1.52 -                    exported.add(sep.replace('.', '/') + "/");
    1.53 +                    keep.add(sep.replace('.', '/') + "/");
    1.54                      break;
    1.55                  }
    1.56              }
    1.57 @@ -209,12 +196,12 @@
    1.58          {
    1.59              URL u = r.get(InterruptedException.class.getName().replace('.', '/') + ".class", 0);
    1.60              JarURLConnection juc = (JarURLConnection)u.openConnection();
    1.61 -            listJAR(juc.getJarFile(), classes, arr, null, null);
    1.62 +            listJAR(juc.getJarFile(), classes, arr, null);
    1.63          }
    1.64          {
    1.65              URL u = r.get(Bck2Brwsr.class.getName().replace('.', '/') + ".class", 0);
    1.66              JarURLConnection juc = (JarURLConnection)u.openConnection();
    1.67 -            listJAR(juc.getJarFile(), classes, arr, null, null);
    1.68 +            listJAR(juc.getJarFile(), classes, arr, null);
    1.69          }
    1.70  
    1.71          Bck2Brwsr.newCompiler().addRootClasses(classes.toArray(new String[0]))