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

Merge branch 'master' of github.com:cbeust/kobalt

This commit is contained in:
Cedric Beust 2017-03-16 21:51:05 -07:00
commit 12c4a84160
10 changed files with 111 additions and 62 deletions

View file

@ -8,7 +8,7 @@ object Constants {
val BUILD_FILE_NAME = "Build.kt"
val BUILD_FILE_DIRECTORY = "kobalt/src"
val BUILD_FILE_PATH = KFiles.joinDir(BUILD_FILE_DIRECTORY, BUILD_FILE_NAME)
val KOTLIN_COMPILER_VERSION = "1.1.0"
val KOTLIN_COMPILER_VERSION = "1.1.1"
internal val DEFAULT_REPOS = listOf<String>(
// "https://maven-central.storage.googleapis.com/",

View file

@ -58,10 +58,12 @@ class CompilerDescription(override val name: String, override val sourceDirecto
if (info.sourceFiles.isNotEmpty()) {
compiler.compile(project, context, info)
} else {
warn("Couldn't find any source files to compile")
warn("$name cdouldn't find any source files to compile")
TaskResult()
}
return result
}
override fun toString() = name + " compiler"
}

View file

@ -139,8 +139,14 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors,
* Should probably make exclusion more generic (full on string) or allow exclusion to be specified
* formally by groupId or artifactId.
*/
fun isDependencyExcluded(dep: IClasspathDependency, excluded: List<IClasspathDependency>)
= excluded.any { excluded -> dep.id.startsWith(excluded.id) }
fun isDependencyExcluded(dep: IClasspathDependency, excluded: List<IClasspathDependency>): Boolean {
excluded.any { excluded -> dep.id.startsWith(excluded.id) }.let { result ->
if (result) {
context.logger.log(project?.name ?: "", 2, " Excluding dependency $dep")
}
return result
}
}
// Dependencies get reordered by transitiveClosure() but since we just added a bunch of new ones,
// we need to reorder them again in case we're adding dependencies that are already present

View file

@ -6,10 +6,10 @@ import com.google.inject.Inject
import java.io.File
class Git @Inject constructor() {
fun maybeTagRelease(project: Project, uploadResult: TaskResult, autoGitTag: Boolean) : TaskResult {
fun maybeTagRelease(project: Project, uploadResult: TaskResult, auto: Boolean, tag: String, message: String) : TaskResult {
val result =
if (uploadResult.success && autoGitTag) {
val tagSuccess = tagRelease(project)
if (uploadResult.success && auto) {
val tagSuccess = tagRelease(project, auto, tag, message)
if (! tagSuccess) {
TaskResult(false, "Couldn't tag the project")
} else {
@ -21,20 +21,21 @@ class Git @Inject constructor() {
return result
}
private fun tagRelease(project: Project) : Boolean {
private fun tagRelease(project: Project, auto: Boolean, tag: String, message: String) : Boolean {
val version = if (tag.isNullOrBlank()) project.version else tag
val success = try {
log(2, "Tagging this release as \"${project.version}\"")
log(2, "Tagging this release as \"$version\"")
val repo = org.eclipse.jgit.storage.file.FileRepositoryBuilder()
.setGitDir(File(KFiles.joinDir(project.directory, ".git")))
.readEnvironment()
.findGitDir()
.build()
val git = org.eclipse.jgit.api.Git(repo)
val ref = git.tag().setName(project.version).call()
val ref = git.tag().setName(version).setMessage(message).call()
git.push().setPushTags().call()
true
} catch(ex: Exception) {
warn("Couldn't create tag ${project.version}: ${ex.message}", ex)
warn("Couldn't create tag ${version}: ${ex.message}", ex)
false
}