(String jarDir)
| 38 | } |
| 39 | |
| 40 | public static void parseJar(String jarDir) throws IOException { |
| 41 | boolean reuse = Config.reuse; |
| 42 | Path targetPath = Path.of(Config.targetPath); |
| 43 | if (!reuse) { |
| 44 | logger.info("[+] removing cache"); |
| 45 | try (Stream<Path> paths = Files.list(targetPath)) { |
| 46 | paths.forEach(path -> { |
| 47 | try { |
| 48 | if (path.toFile().isDirectory()) { |
| 49 | FileUtils.deleteDirectory(path.toFile()); |
| 50 | } else { |
| 51 | FileUtils.delete(path.toFile()); |
| 52 | } |
| 53 | } catch (Exception e) { |
| 54 | logger.warn(e); |
| 55 | } |
| 56 | }); |
| 57 | } catch (Exception e) { |
| 58 | logger.warn(e); |
| 59 | } |
| 60 | } |
| 61 | logger.info("[+] processing jars"); |
| 62 | List<Path> jars = JarUtil.getJarFiles(Path.of(jarDir)); |
| 63 | for (Path jar : jars) { |
| 64 | // init service discovery |
| 65 | ServiceUtil.parseService(jar); |
| 66 | // unzip jars to extract classes and lib |
| 67 | if (!reuse) { |
| 68 | JarUtil.extractJar(jar, targetPath); |
| 69 | } |
| 70 | } |
| 71 | for (Path jar : jars) { |
| 72 | ServiceUtil.parseService(jar); |
| 73 | } |
| 74 | if (!reuse) { |
| 75 | logger.info("[+] moving mapper"); |
| 76 | JarUtil.moveMapper(targetPath); |
| 77 | logger.info("[+] moving classes"); |
| 78 | JarUtil.unsafeMoveClasses(targetPath); |
| 79 | } |
| 80 | logger.info("[+] starter end"); |
| 81 | } |
| 82 | |
| 83 | } |
no test coverage detected