mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
Improve handling of failed dependency relocation
This commit is contained in:
1 file changed
+7
-4
@@ -90,17 +90,20 @@ public final class DependencyDownloader {
|
|||||||
ret.add(resolve);
|
ret.add(resolve);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Path output = resolve.resolveSibling(resolve.getFileName().toString().replace(".jar", "-relocated.jar"));
|
final Path relocated = resolve.resolveSibling(resolve.getFileName().toString().replace(".jar", "-relocated.jar"));
|
||||||
ret.add(output);
|
ret.add(relocated);
|
||||||
if (Files.isRegularFile(output)) {
|
if (Files.isRegularFile(relocated)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
doingWork.run();
|
doingWork.run();
|
||||||
|
final Path output = relocated.resolveSibling(relocated.getFileName().toString() + ".tmp");
|
||||||
|
Files.deleteIfExists(output);
|
||||||
final JarRelocator relocator = new JarRelocator(resolve.toFile(), output.toFile(), this.relocations);
|
final JarRelocator relocator = new JarRelocator(resolve.toFile(), output.toFile(), this.relocations);
|
||||||
//this.logger.info("relocating {}", resolve);
|
//this.logger.info("relocating {}", resolve);
|
||||||
relocator.run();
|
relocator.run();
|
||||||
|
Files.move(output, relocated);
|
||||||
//this.logger.info("done relocating {}", resolve);
|
//this.logger.info("done relocating {}", resolve);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException | IllegalArgumentException e) {
|
||||||
throw new RuntimeException("Exception resolving " + dep, e);
|
throw new RuntimeException("Exception resolving " + dep, e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in new issue
Block a user