mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
New zip structure.
This commit is contained in:
parent
947966286d
commit
2af7250659
2 changed files with 37 additions and 17 deletions
|
@ -135,10 +135,11 @@ val kobaltApp = project(kobaltPluginApi, wrapper) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zip {
|
zip {
|
||||||
include("kobaltw")
|
val dir = "kobalt-$version"
|
||||||
include(from("$buildDirectory/libs"), to("kobalt/wrapper"),
|
include(from("."), to("$dir/bin"), "kobaltw")
|
||||||
|
include(from("$buildDirectory/libs"), to("$dir/kobalt/wrapper"),
|
||||||
"$projectName-$version.jar")
|
"$projectName-$version.jar")
|
||||||
include(from("modules/wrapper/$buildDirectory/libs"), to("kobalt/wrapper"),
|
include(from("modules/wrapper/$buildDirectory/libs"), to("$dir/kobalt/wrapper"),
|
||||||
"$projectName-wrapper.jar")
|
"$projectName-wrapper.jar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,11 @@ public class Main {
|
||||||
System.exit(exitCode);
|
System.exit(exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final boolean DEV = false;
|
||||||
|
private static final int DEV_VERSION_INT = 650;
|
||||||
|
private static final String DEV_VERSION = "0." + DEV_VERSION_INT;
|
||||||
|
private static final String DEV_ZIP = "/Users/beust/kotlin/kobalt/kobaltBuild/libs/kobalt-" + DEV_VERSION + ".zip";
|
||||||
|
|
||||||
private static final String KOBALT_PROPERTIES = "kobalt.properties";
|
private static final String KOBALT_PROPERTIES = "kobalt.properties";
|
||||||
private static final String KOBALTW = "kobaltw";
|
private static final String KOBALTW = "kobaltw";
|
||||||
private static final String KOBALT_WRAPPER_PROPERTIES = "kobalt-wrapper.properties";
|
private static final String KOBALT_WRAPPER_PROPERTIES = "kobalt-wrapper.properties";
|
||||||
|
@ -123,19 +128,33 @@ public class Main {
|
||||||
return System.getProperty("os.name").contains("Windows");
|
return System.getProperty("os.name").contains("Windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Path installDistribution() throws IOException {
|
private static final String[] FILES = new String[] { KOBALTW, "kobalt/wrapper/" + FILE_NAME + "-wrapper.jar" };
|
||||||
Properties properties = maybeCreateProperties();
|
|
||||||
|
|
||||||
String version = properties.getProperty(PROPERTY_VERSION);
|
private Path installDistribution() throws IOException {
|
||||||
|
String wrapperVersion;
|
||||||
|
String version;
|
||||||
|
Path localZipFile;
|
||||||
|
if (DEV) {
|
||||||
|
version = DEV_VERSION;
|
||||||
|
wrapperVersion = DEV_VERSION;
|
||||||
|
localZipFile = Paths.get(DEV_ZIP);
|
||||||
|
} else {
|
||||||
|
Properties properties = maybeCreateProperties();
|
||||||
|
version = properties.getProperty(PROPERTY_VERSION);
|
||||||
initWrapperFile(version);
|
initWrapperFile(version);
|
||||||
String wrapperVersion = getWrapperVersion();
|
wrapperVersion = getWrapperVersion();
|
||||||
|
String fileName = FILE_NAME + "-" + wrapperVersion + ".zip";
|
||||||
|
Files.createDirectories(Paths.get(DISTRIBUTIONS_DIR));
|
||||||
|
localZipFile = Paths.get(DISTRIBUTIONS_DIR, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
log(2, "Wrapper version: " + wrapperVersion);
|
log(2, "Wrapper version: " + wrapperVersion);
|
||||||
|
|
||||||
String fileName = FILE_NAME + "-" + wrapperVersion + ".zip";
|
|
||||||
Files.createDirectories(Paths.get(DISTRIBUTIONS_DIR));
|
|
||||||
Path localZipFile = Paths.get(DISTRIBUTIONS_DIR, fileName);
|
|
||||||
String zipOutputDir = DISTRIBUTIONS_DIR + "/" + wrapperVersion;
|
String zipOutputDir = DISTRIBUTIONS_DIR + "/" + wrapperVersion;
|
||||||
|
boolean isNew = Float.parseFloat(version) * 1000 >= 650;
|
||||||
|
if (isNew) {
|
||||||
|
zipOutputDir += File.separator + "kobalt-" + version;
|
||||||
|
}
|
||||||
Path kobaltJarFile = Paths.get(zipOutputDir,
|
Path kobaltJarFile = Paths.get(zipOutputDir,
|
||||||
getWrapperDir().getPath() + "/" + FILE_NAME + "-" + wrapperVersion + ".jar");
|
getWrapperDir().getPath() + "/" + FILE_NAME + "-" + wrapperVersion + ".jar");
|
||||||
boolean downloadedZipFile = false;
|
boolean downloadedZipFile = false;
|
||||||
|
@ -166,16 +185,18 @@ public class Main {
|
||||||
//
|
//
|
||||||
// Copy the wrapper files in the current kobalt/wrapper directory
|
// Copy the wrapper files in the current kobalt/wrapper directory
|
||||||
//
|
//
|
||||||
|
|
||||||
if (! noOverwrite) {
|
if (! noOverwrite) {
|
||||||
log(2, "Copying the wrapper files");
|
log(2, "Copying the wrapper files");
|
||||||
for (String file : FILES) {
|
for (String file : FILES) {
|
||||||
Path to = Paths.get(new File(".").getAbsolutePath(), file);
|
Path to = Paths.get(file);
|
||||||
|
to.toFile().getAbsoluteFile().getParentFile().mkdirs();
|
||||||
|
|
||||||
if (Files.exists(to)) {
|
if (Files.exists(to)) {
|
||||||
log(2, to + " already exists, not overwriting it");
|
log(2, to + " already exists, not overwriting it");
|
||||||
continue;
|
continue;
|
||||||
} else if (file.equals(KOBALTW)) {
|
} else if (file.endsWith(KOBALTW)) {
|
||||||
generateKobaltW(to);
|
generateKobaltW(Paths.get(KOBALTW));
|
||||||
} else {
|
} else {
|
||||||
Path from = Paths.get(zipOutputDir, file);
|
Path from = Paths.get(zipOutputDir, file);
|
||||||
try {
|
try {
|
||||||
|
@ -211,7 +232,7 @@ public class Main {
|
||||||
}
|
}
|
||||||
log(2, "Generating " + KOBALTW + (envFile.exists() ? " with shebang" : "") + ".");
|
log(2, "Generating " + KOBALTW + (envFile.exists() ? " with shebang" : "") + ".");
|
||||||
|
|
||||||
content += "java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $*\n";
|
content += "java -jar $(dirname $0)/../kobalt/wrapper/kobalt-wrapper.jar $*\n";
|
||||||
|
|
||||||
Files.write(filePath, content.getBytes());
|
Files.write(filePath, content.getBytes());
|
||||||
|
|
||||||
|
@ -248,8 +269,6 @@ public class Main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String[] FILES = new String[] { KOBALTW, "kobalt/wrapper/" + FILE_NAME + "-wrapper.jar" };
|
|
||||||
|
|
||||||
private void download(File file, String version) throws IOException {
|
private void download(File file, String version) throws IOException {
|
||||||
for (int attempt = 0; attempt < 3; ++attempt) {
|
for (int attempt = 0; attempt < 3; ++attempt) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue