8215900: Without --files args, only jars in the top level of --input are added to class-path JDK-8200758-branch
authorherrick
Mon, 07 Jan 2019 16:41:59 -0500
branchJDK-8200758-branch
changeset 57097 6e5eb7855fe2
parent 57096 d06bec27f8c9
child 57098 fd4868c5fca1
8215900: Without --files args, only jars in the top level of --input are added to class-path Reviewed-by: almatvee
src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java	Mon Jan 07 16:39:30 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java	Mon Jan 07 16:41:59 2019 -0500
@@ -803,19 +803,8 @@
             }
         }
         fileNames.forEach(file -> deployParams.addResource(baseDir, file));
-        setClasspath(fileNames);
-    }
 
-    private void setClasspath(List<String> inputfiles) {
-        String classpath = "";
-        for (String file : inputfiles) {
-            if (file.endsWith(".jar")) {
-                classpath += file;
-                classpath += File.pathSeparator;
-            }
-        }
-        deployParams.addBundleArgument(
-                StandardBundlerParam.CLASSPATH.getID(), classpath);
+        deployParams.setClasspath();
     }
 
     static boolean isCLIOption(String arg) {
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java	Mon Jan 07 16:39:30 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java	Mon Jan 07 16:41:59 2019 -0500
@@ -276,6 +276,19 @@
                 baseDir, new LinkedHashSet<>(expandFileset(file))));
     }
 
+    void setClasspath() {
+        String classpath = "";
+        for (RelativeFileSet resource : resources) {
+             for (String file : resource.getIncludedFiles()) {
+                 if (file.endsWith(".jar")) {
+                     classpath += file + File.pathSeparator;
+                 }
+             }
+        }
+        addBundleArgument(
+                StandardBundlerParam.CLASSPATH.getID(), classpath);
+    }
+
     private static File createFile(final File baseDir, final String path) {
         final File testFile = new File(path);
         return testFile.isAbsolute() ?
@@ -603,7 +616,8 @@
 
     @Override
     public String toString() {
-        return "DeployParams{" + "outdir=" + outdir + '}';
+        return "DeployParams {" + "output: " + outdir
+                + " resources: {" + resources + "}}";
     }
 
 }
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java	Mon Jan 07 16:39:30 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java	Mon Jan 07 16:41:59 2019 -0500
@@ -37,17 +37,10 @@
  */
 class RelativeFileSet {
 
-    private String mode;
-    private String os;
-    private String arch;
-
     private File basedir;
     private Set<String> files = new LinkedHashSet<>();
 
     RelativeFileSet(RelativeFileSet copy) {
-        mode = copy.mode;
-        os = copy.os;
-        arch = copy.arch;
         basedir = copy.basedir;
         files = new LinkedHashSet<>(copy.files);
     }
@@ -112,41 +105,10 @@
         return files;
     }
 
-    void dump() {
-        Log.verbose("\n=========\nBasedir: " + basedir + "\n");
-        for (String fname : files) {
-            Log.verbose("  " + fname);
-        }
-        Log.verbose("\n========");
-    }
-
-    String getMode() {
-        return mode;
-    }
-
-    void setMode(String mode) {
-        this.mode = mode;
-    }
-
-    String getOs() {
-        return os;
-    }
-
-    void setOs(String os) {
-        this.os = os;
-    }
-
-    String getArch() {
-        return arch;
-    }
-
-    void setArch(String arch) {
-        this.arch = arch;
-    }
-
     @Override
     public String toString() {
-        return "RelativeFileSet{basedir:" + basedir + ", files:" + files + "}";
+        return "RelativeFileSet {basedir:" + basedir
+                + ", files: {" + files + ")}";
     }
 
 }