mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
--noOverwrite
This commit is contained in:
parent
d93975d426
commit
b31da8fa49
2 changed files with 30 additions and 16 deletions
|
@ -27,23 +27,34 @@ public class Main {
|
|||
private final Properties wrapperProperties = new Properties();
|
||||
|
||||
private static int logLevel = 1;
|
||||
private boolean noOverwrite = false;
|
||||
|
||||
private void installAndLaunchMain(String[] argv) throws IOException, InterruptedException {
|
||||
List<String> kobaltArgv = new ArrayList<>();
|
||||
boolean noLaunch = false;
|
||||
for (int i = 0; i < argv.length; i++) {
|
||||
boolean passToKobalt = true;
|
||||
switch(argv[i]) {
|
||||
case "--no-launch":
|
||||
case "--noOverwrite":
|
||||
noOverwrite = true;
|
||||
passToKobalt = false;
|
||||
break;
|
||||
case "--noLaunch":
|
||||
noLaunch = true;
|
||||
break;
|
||||
case "--log":
|
||||
logLevel = Integer.parseInt(argv[i + 1]);
|
||||
kobaltArgv.add(argv[i]);
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
if (passToKobalt) {
|
||||
kobaltArgv.add(argv[i]);
|
||||
}
|
||||
}
|
||||
Path kobaltJarFile = installJarFile();
|
||||
if (! noLaunch) {
|
||||
launchMain(kobaltJarFile, argv);
|
||||
launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,6 +142,7 @@ public class Main {
|
|||
//
|
||||
// Extract all the zip files
|
||||
//
|
||||
if (! noOverwrite) {
|
||||
int retries = 0;
|
||||
while (retries < 2) {
|
||||
try {
|
||||
|
@ -144,11 +156,12 @@ public class Main {
|
|||
download(localZipFile.toFile(), wrapperVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Copy the wrapper files in the current kobalt/wrapper directory
|
||||
//
|
||||
if (! wrapperVersion.equals(version)) {
|
||||
if (! noOverwrite && ! wrapperVersion.equals(version)) {
|
||||
log(2, "Copying the wrapper files");
|
||||
for (String file : FILES) {
|
||||
Path from = Paths.get(zipOutputDir, file);
|
||||
|
@ -175,6 +188,7 @@ public class Main {
|
|||
}
|
||||
|
||||
private void extractZipFile(Path localZipFile, String zipOutputDir) throws IOException {
|
||||
log(2, "Extracting " + localZipFile);
|
||||
try (ZipFile zipFile = new ZipFile(localZipFile.toFile())) {
|
||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
|
|
|
@ -134,9 +134,9 @@ private class Main @Inject constructor(
|
|||
if (args.init) {
|
||||
//
|
||||
// --init: create a new build project and install the wrapper
|
||||
// Make sure the wrapper won't call us back with --no-launch
|
||||
// Make sure the wrapper won't call us back with --noLaunch
|
||||
//
|
||||
com.beust.kobalt.wrapper.Main.main(arrayOf("--no-launch") + argv)
|
||||
com.beust.kobalt.wrapper.Main.main(arrayOf("--noLaunch") + argv)
|
||||
projectGenerator.run(args)
|
||||
} else if (args.usage) {
|
||||
jc.usage()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue