< prev index next >

test/jdk/tools/lib/tests/Helper.java

Print this page
rev 51977 : [mq]: 8211350-no-jprt


  50     private final Path jmodssrc;
  51     private final Path jarssrc;
  52     private final Path explodedmodsclasses;
  53     private final Path jmodsclasses;
  54     private final Path jarsclasses;
  55     private final Path jmods;
  56     private final Path jars;
  57     private final Path images;
  58     private final Path explodedmods;
  59     private final Path stdjmods;
  60     private final Path extracted;
  61     private final Path recreated;
  62 
  63     private final Map<String, List<String>> moduleClassDependencies = new HashMap<>();
  64     private final Map<String, List<String>> moduleDependencies = new HashMap<>();
  65     private final List<String> bootClasses;
  66     private final FileSystem fs;
  67 
  68     public static Helper newHelper() throws IOException {
  69         Path jdkHome = Paths.get(System.getProperty("test.jdk"));
  70         // JPRT not yet ready for jmods
  71         if (!Files.exists(jdkHome.resolve("jmods"))) {
  72             System.err.println("Test not run, NO jmods directory");
  73             return null;
  74         }
  75         return new Helper(jdkHome);
  76     }
  77 
  78     private Helper(Path jdkHome) throws IOException {
  79         this.stdjmods = jdkHome.resolve("jmods").normalize();
  80         if (!Files.exists(stdjmods)) {
  81             throw new IOException("Standard jMods do not exist.");
  82         }
  83         this.fs = FileSystems.getFileSystem(URI.create("jrt:/"));
  84 
  85         Path javabase = fs.getPath("/modules/java.base");
  86         this.bootClasses = Files.find(javabase, Integer.MAX_VALUE,
  87                 (file, attrs) -> file.toString().endsWith(".class"))
  88                 .map(Object::toString)
  89                 .map(s -> s.substring("/modules".length()))
  90                 .collect(Collectors.toList());
  91 
  92         if (bootClasses.isEmpty()) {
  93             throw new AssertionError("No boot class to check against");




  50     private final Path jmodssrc;
  51     private final Path jarssrc;
  52     private final Path explodedmodsclasses;
  53     private final Path jmodsclasses;
  54     private final Path jarsclasses;
  55     private final Path jmods;
  56     private final Path jars;
  57     private final Path images;
  58     private final Path explodedmods;
  59     private final Path stdjmods;
  60     private final Path extracted;
  61     private final Path recreated;
  62 
  63     private final Map<String, List<String>> moduleClassDependencies = new HashMap<>();
  64     private final Map<String, List<String>> moduleDependencies = new HashMap<>();
  65     private final List<String> bootClasses;
  66     private final FileSystem fs;
  67 
  68     public static Helper newHelper() throws IOException {
  69         Path jdkHome = Paths.get(System.getProperty("test.jdk"));

  70         if (!Files.exists(jdkHome.resolve("jmods"))) {
  71             throw new IOException("NO jmods directory in " + jdkHome);

  72         }
  73         return new Helper(jdkHome);
  74     }
  75 
  76     private Helper(Path jdkHome) throws IOException {
  77         this.stdjmods = jdkHome.resolve("jmods").normalize();
  78         if (!Files.exists(stdjmods)) {
  79             throw new IOException("Standard jMods do not exist.");
  80         }
  81         this.fs = FileSystems.getFileSystem(URI.create("jrt:/"));
  82 
  83         Path javabase = fs.getPath("/modules/java.base");
  84         this.bootClasses = Files.find(javabase, Integer.MAX_VALUE,
  85                 (file, attrs) -> file.toString().endsWith(".class"))
  86                 .map(Object::toString)
  87                 .map(s -> s.substring("/modules".length()))
  88                 .collect(Collectors.toList());
  89 
  90         if (bootClasses.isEmpty()) {
  91             throw new AssertionError("No boot class to check against");


< prev index next >