mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Fix #93.
This commit is contained in:
parent
949fc353d8
commit
2db5df1897
1 changed files with 65 additions and 57 deletions
|
@ -93,26 +93,28 @@ private class Main @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)")
|
if (! args.update) {
|
||||||
|
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)")
|
||||||
|
|
||||||
// Check for new version
|
// Check for new version
|
||||||
try {
|
try {
|
||||||
val latestVersionString = latestVersionFuture.get(1, TimeUnit.SECONDS)
|
val latestVersionString = latestVersionFuture.get(1, TimeUnit.SECONDS)
|
||||||
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.joinDir(KFiles.distributionsDir, latestVersionString))
|
||||||
if (latestVersion > current) {
|
if (latestVersion > current) {
|
||||||
if (distFile.exists()) {
|
if (distFile.exists()) {
|
||||||
log(1, "**** Version $latestVersionString is installed")
|
log(1, "**** Version $latestVersionString is installed")
|
||||||
} else {
|
} else {
|
||||||
listOf("", "New Kobalt version available: $latestVersionString",
|
listOf("", "New Kobalt version available: $latestVersionString",
|
||||||
"To update, run ./kobaltw --update", "").forEach {
|
"To update, run ./kobaltw --update", "").forEach {
|
||||||
log(1, "**** $it")
|
log(1, "**** $it")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch(ex: TimeoutException) {
|
||||||
|
log(2, "Didn't get the new version in time, skipping it")
|
||||||
}
|
}
|
||||||
} catch(ex: TimeoutException) {
|
|
||||||
log(2, "Didn't get the new version in time, skipping it")
|
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -146,55 +148,61 @@ private class Main @Inject constructor(
|
||||||
} else if (args.serverMode) {
|
} else if (args.serverMode) {
|
||||||
server.run()
|
server.run()
|
||||||
} else {
|
} else {
|
||||||
if (!buildFile.exists()) {
|
// Update doesn't require to parse the build file
|
||||||
error(buildFile.path.toFile().path + " does not exist")
|
if (args.update) {
|
||||||
|
// --update
|
||||||
|
updateKobalt.updateKobalt()
|
||||||
} else {
|
} else {
|
||||||
val allProjects = buildFileCompilerFactory.create(listOf(buildFile), pluginInfo)
|
//
|
||||||
.compileBuildFiles(args)
|
// Everything below requires to parse the build file first
|
||||||
|
//
|
||||||
|
if (!buildFile.exists()) {
|
||||||
|
error(buildFile.path.toFile().path + " does not exist")
|
||||||
|
} else {
|
||||||
|
val allProjects = buildFileCompilerFactory.create(listOf(buildFile), pluginInfo)
|
||||||
|
.compileBuildFiles(args)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now that we have projects, add all the repos from repo contributors that need a Project
|
// Now that we have projects, add all the repos from repo contributors that need a Project
|
||||||
//
|
//
|
||||||
allProjects.forEach { project ->
|
allProjects.forEach { project ->
|
||||||
pluginInfo.repoContributors.forEach {
|
pluginInfo.repoContributors.forEach {
|
||||||
it.reposFor(project).forEach {
|
it.reposFor(project).forEach {
|
||||||
Kobalt.addRepo(it)
|
Kobalt.addRepo(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Run all their dependencies through the IDependencyInterceptors
|
|
||||||
//
|
|
||||||
runClasspathInterceptors(allProjects)
|
|
||||||
|
|
||||||
log(2, "Final list of repos:\n " + Kobalt.repos.joinToString("\n "))
|
|
||||||
|
|
||||||
if (args.dependency != null) {
|
|
||||||
// --resolve
|
|
||||||
resolveDependency.run(args.dependency as String)
|
|
||||||
} else if (args.tasks) {
|
|
||||||
// --tasks
|
|
||||||
displayTasks()
|
|
||||||
} else if (args.checkVersions) {
|
|
||||||
// --checkVersions
|
|
||||||
checkVersions.run(allProjects)
|
|
||||||
} else if (args.download) {
|
|
||||||
// -- download
|
|
||||||
updateKobalt.downloadKobalt()
|
|
||||||
} else if (args.update) {
|
|
||||||
// --update
|
|
||||||
updateKobalt.updateKobalt()
|
|
||||||
} else {
|
|
||||||
//
|
//
|
||||||
// Launch the build
|
// Run all their dependencies through the IDependencyInterceptors
|
||||||
//
|
//
|
||||||
val runTargetResult = taskManager.runTargets(args.targets, allProjects)
|
runClasspathInterceptors(allProjects)
|
||||||
if (result == 0) {
|
|
||||||
result = runTargetResult.exitCode
|
log(2, "Final list of repos:\n " + Kobalt.repos.joinToString("\n "))
|
||||||
|
|
||||||
|
if (args.dependency != null) {
|
||||||
|
// --resolve
|
||||||
|
resolveDependency.run(args.dependency as String)
|
||||||
|
} else if (args.tasks) {
|
||||||
|
// --tasks
|
||||||
|
displayTasks()
|
||||||
|
} else if (args.checkVersions) {
|
||||||
|
// --checkVersions
|
||||||
|
checkVersions.run(allProjects)
|
||||||
|
} else if (args.download) {
|
||||||
|
// -- download
|
||||||
|
updateKobalt.downloadKobalt()
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Launch the build
|
||||||
|
//
|
||||||
|
val runTargetResult = taskManager.runTargets(args.targets, allProjects)
|
||||||
|
if (result == 0) {
|
||||||
|
result = runTargetResult.exitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
log(2, "Timings:\n " + runTargetResult.messages.joinToString("\n "))
|
||||||
}
|
}
|
||||||
|
|
||||||
log(2, "Timings:\n " + runTargetResult.messages.joinToString("\n "))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue