Skip to content

Commit

Permalink
jars nicht immer neu fixen
Browse files Browse the repository at this point in the history
  • Loading branch information
FLUXparticle committed Apr 14, 2020
1 parent 57f17c3 commit 0a5379f
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/main/java/de/fluxparticle/jpackage/BuildImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,33 +187,37 @@ private List<String> processJars(List<String> classpathElements, Path modulesDir
}

private static String fix(Path modulesDir, String modulePath, Path jar) throws IOException, InterruptedException {
System.out.println("Fix: " + jar);

if (!jDeps(modulesDir, modulePath, jar)) {
return null;
}

String fileName = jar.getFileName().toString();
int splitVersion = fileName.lastIndexOf('-');
Path target = modulesDir.resolve(fileName);

String moduleName = fileName.substring(0, splitVersion).replace('-', '.');
if (Files.exists(target)) {
System.out.println("Already Fixed: " + fileName);
} else try {
System.out.println("Fix: " + jar);

Path mod = modulesDir.resolve(moduleName);
Path out = mod.resolve("classes");
if (!jDeps(modulesDir, modulePath, jar)) {
return null;
}

extract(jar, out);
int splitVersion = fileName.lastIndexOf('-');

Path file = mod.resolve("module-info.java");
String moduleName = fileName.substring(0, splitVersion).replace('-', '.');

if (!javaCompiler(modulePath, out, file)) {
return null;
}
Path mod = modulesDir.resolve(moduleName);
Path out = mod.resolve("classes");

Path target = modulesDir.resolve(fileName);
extract(jar, out);

pack(target, out);
Path file = mod.resolve("module-info.java");

System.out.println();
if (!javaCompiler(modulePath, out, file)) {
return null;
}

pack(target, out);
} finally {
System.out.println();
}

return target.toString();
}
Expand Down

0 comments on commit 0a5379f

Please sign in to comment.