Skip to content

Commit

Permalink
Avoid needless re-transformation of tools
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Dec 31, 2024
1 parent 407a4df commit 4273bbb
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@

public class ToolDaemonExecutor implements AutoCloseable {
public static void execute(Path jar, Path logFile, String[] args, Context context, boolean classpathScoped) {
Path transformedJar;
try {
transformedJar = transform(jar, context);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
String mainClass;
try (var jarFile = new JarInputStream(Files.newInputStream(transformedJar))) {
try (var jarFile = new JarInputStream(Files.newInputStream(jar))) {
var manifest = jarFile.getManifest();
mainClass = manifest.getMainAttributes().getValue("Main-Class");
} catch (IOException e) {
Expand All @@ -55,7 +49,7 @@ public static void execute(Path jar, Path logFile, String[] args, Context contex
if (mainClass == null) {
throw new RuntimeException("No Main-Class attribute in manifest");
}
execute(List.of(transformedJar), mainClass, logFile, args, context, classpathScoped);
execute(List.of(jar), mainClass, logFile, args, context, classpathScoped);
}

public static void execute(Collection<Path> classpath, String mainClass, Path logFile, String[] args, Context context, boolean classpathScoped) {
Expand Down

0 comments on commit 4273bbb

Please sign in to comment.