1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Update to new structure.

This commit is contained in:
Cedric Beust 2016-03-10 03:21:23 +04:00
parent 376fa40e10
commit 42cb7ff441
7 changed files with 16 additions and 18 deletions

View file

@ -136,7 +136,7 @@ val kobaltApp = project(kobaltPluginApi, wrapper) {
} }
zip { zip {
val dir = "kobalt-$version" val dir = "kobalt-$version"
include(from("."), to("$dir/bin"), "kobaltw") include(from("."), to("$dir"), "kobaltw")
include(from("$buildDirectory/libs"), to("$dir/kobalt/wrapper"), include(from("$buildDirectory/libs"), to("$dir/kobalt/wrapper"),
"$projectName-$version.jar") "$projectName-$version.jar")
include(from("modules/wrapper/$buildDirectory/libs"), to("$dir/kobalt/wrapper"), include(from("modules/wrapper/$buildDirectory/libs"), to("$dir/kobalt/wrapper"),

Binary file not shown.

View file

@ -1 +1 @@
kobalt.version=0.650 kobalt.version=0.661

View file

@ -26,7 +26,8 @@ class KFiles {
debug("Using kobalt jar $envJar") debug("Using kobalt jar $envJar")
return listOf(File(envJar).absolutePath) return listOf(File(envJar).absolutePath)
} else { } else {
val jar = joinDir(distributionsDir, Kobalt.version, "kobalt/wrapper/kobalt-" + Kobalt.version + ".jar") val jar = joinDir(distributionsDir, "kobalt-" + Kobalt.version,
"kobalt/wrapper/kobalt-" + Kobalt.version + ".jar")
val jarFile = File(jar) val jarFile = File(jar)
if (jarFile.exists()) { if (jarFile.exists()) {
return listOf(jarFile.absolutePath) return listOf(jarFile.absolutePath)

View file

@ -17,7 +17,7 @@ public class Main {
} }
private static final boolean DEV = false; private static final boolean DEV = false;
private static final int DEV_VERSION_INT = 650; private static final int DEV_VERSION_INT = 660;
private static final String DEV_VERSION = "0." + DEV_VERSION_INT; 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 DEV_ZIP = "/Users/beust/kotlin/kobalt/kobaltBuild/libs/kobalt-" + DEV_VERSION + ".zip";
@ -150,12 +150,12 @@ public class Main {
log(2, "Wrapper version: " + wrapperVersion); log(2, "Wrapper version: " + wrapperVersion);
String zipOutputDir = DISTRIBUTIONS_DIR + "/" + wrapperVersion;
boolean isNew = Float.parseFloat(version) * 1000 >= 650; boolean isNew = Float.parseFloat(version) * 1000 >= 650;
if (isNew) {
zipOutputDir += File.separator + "kobalt-" + version; String fromZipOutputDir = DISTRIBUTIONS_DIR + File.separator + "kobalt-" + version;
} String toZipOutputDir = DISTRIBUTIONS_DIR;
Path kobaltJarFile = Paths.get(zipOutputDir, Path kobaltJarFile = Paths.get(toZipOutputDir,
isNew ? "kobalt-" + version : "",
getWrapperDir().getPath() + "/" + FILE_NAME + "-" + wrapperVersion + ".jar"); getWrapperDir().getPath() + "/" + FILE_NAME + "-" + wrapperVersion + ".jar");
boolean downloadedZipFile = false; boolean downloadedZipFile = false;
if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) { if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) {
@ -170,7 +170,7 @@ public class Main {
int retries = 0; int retries = 0;
while (retries < 2) { while (retries < 2) {
try { try {
extractZipFile(localZipFile, zipOutputDir); extractZipFile(localZipFile, toZipOutputDir);
break; break;
} catch (ZipException e) { } catch (ZipException e) {
retries++; retries++;
@ -192,13 +192,10 @@ public class Main {
Path to = Paths.get(file); Path to = Paths.get(file);
to.toFile().getAbsoluteFile().getParentFile().mkdirs(); to.toFile().getAbsoluteFile().getParentFile().mkdirs();
if (Files.exists(to)) { if (file.endsWith(KOBALTW)) {
log(2, to + " already exists, not overwriting it");
continue;
} else if (file.endsWith(KOBALTW)) {
generateKobaltW(Paths.get(KOBALTW)); generateKobaltW(Paths.get(KOBALTW));
} else { } else {
Path from = Paths.get(zipOutputDir, file); Path from = Paths.get(fromZipOutputDir, file);
try { try {
if (isWindows() && to.toFile().exists()) { if (isWindows() && to.toFile().exists()) {
log(2, " Windows detected, not overwriting " + to); log(2, " Windows detected, not overwriting " + to);
@ -232,7 +229,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());

View file

@ -41,7 +41,7 @@ class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapperPropert
val latestVersionString = latestVersionFuture.get() val latestVersionString = latestVersionFuture.get()
val latestVersion = Versions.toLongVersion(latestVersionString) val latestVersion = Versions.toLongVersion(latestVersionString)
val current = Versions.toLongVersion(Kobalt.version) val current = Versions.toLongVersion(Kobalt.version)
val distFile = File(KFiles.joinDir(KFiles.distributionsDir, latestVersionString)) val distFile = File(KFiles.distributionsDir)
if (latestVersion > current) { if (latestVersion > current) {
if (distFile.exists()) { if (distFile.exists()) {
log(1, "**** Version $latestVersionString is installed, you can switch to it with " + log(1, "**** Version $latestVersionString is installed, you can switch to it with " +

View file

@ -1 +1 @@
kobalt.version=0.650 kobalt.version=0.661