< prev index next >

test/jdk/tools/jpackage/helpers/JPackageHelper.java

Print this page




 381             }
 382             throw ex;
 383         }
 384 
 385         if (retVal != 0) {
 386             if (jarLog.exists()) {
 387                 System.err.println(Files.readString(jarLog.toPath()));
 388             }
 389             throw new AssertionError("jar exited with error: " + retVal);
 390         }
 391     }
 392 
 393     public static void createHelloModule() throws Exception {
 394         createModule("Hello.java", "input", "hello", null, true);
 395     }
 396 
 397     public static void createHelloModule(ModuleArgs moduleArgs) throws Exception {
 398         createModule("Hello.java", "input", "hello", moduleArgs, true);
 399     }
 400 
 401     public static void createOtherModule() throws Exception {
 402         createModule("Other.java", "input-other", "other", null, false);
 403     }
 404 
 405     private static void createModule(String javaFile, String inputDir, String aName,
 406             ModuleArgs moduleArgs, boolean createModularJar) throws Exception {
 407         int retVal;
 408 
 409         File input = new File(inputDir);
 410         if (!input.exists()) {
 411             input.mkdir();
 412         }
 413 
 414         File module = new File("module" + File.separator + "com." + aName);
 415         if (!module.exists()) {
 416             module.mkdirs();
 417         }
 418 
 419         File javacLog = new File("javac.log");
 420         try {
 421             List<String> args = new ArrayList<>();
 422             args.add(JAVAC.toString());
 423             args.add("-d");
 424             args.add("module" + File.separator + "com." + aName);




 381             }
 382             throw ex;
 383         }
 384 
 385         if (retVal != 0) {
 386             if (jarLog.exists()) {
 387                 System.err.println(Files.readString(jarLog.toPath()));
 388             }
 389             throw new AssertionError("jar exited with error: " + retVal);
 390         }
 391     }
 392 
 393     public static void createHelloModule() throws Exception {
 394         createModule("Hello.java", "input", "hello", null, true);
 395     }
 396 
 397     public static void createHelloModule(ModuleArgs moduleArgs) throws Exception {
 398         createModule("Hello.java", "input", "hello", moduleArgs, true);
 399     }
 400 




 401     private static void createModule(String javaFile, String inputDir, String aName,
 402             ModuleArgs moduleArgs, boolean createModularJar) throws Exception {
 403         int retVal;
 404 
 405         File input = new File(inputDir);
 406         if (!input.exists()) {
 407             input.mkdir();
 408         }
 409 
 410         File module = new File("module" + File.separator + "com." + aName);
 411         if (!module.exists()) {
 412             module.mkdirs();
 413         }
 414 
 415         File javacLog = new File("javac.log");
 416         try {
 417             List<String> args = new ArrayList<>();
 418             args.add(JAVAC.toString());
 419             args.add("-d");
 420             args.add("module" + File.separator + "com." + aName);


< prev index next >