mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Added annotated directive to autoGitTag.
This commit is contained in:
parent
c6e15739e8
commit
792fa88674
2 changed files with 8 additions and 5 deletions
|
@ -6,10 +6,10 @@ import com.google.inject.Inject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class Git @Inject constructor() {
|
class Git @Inject constructor() {
|
||||||
fun maybeTagRelease(project: Project, uploadResult: TaskResult, auto: Boolean, tag: String, message: String) : TaskResult {
|
fun maybeTagRelease(project: Project, uploadResult: TaskResult, auto: Boolean, annotated: Boolean, tag: String, message: String) : TaskResult {
|
||||||
val result =
|
val result =
|
||||||
if (uploadResult.success && auto) {
|
if (uploadResult.success && auto) {
|
||||||
val tagSuccess = tagRelease(project, auto, tag, message)
|
val tagSuccess = tagRelease(project, auto, annotated, tag, message)
|
||||||
if (! tagSuccess) {
|
if (! tagSuccess) {
|
||||||
TaskResult(false, "Couldn't tag the project")
|
TaskResult(false, "Couldn't tag the project")
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +21,7 @@ class Git @Inject constructor() {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tagRelease(project: Project, auto: Boolean, tag: String, message: String) : Boolean {
|
private fun tagRelease(project: Project, auto: Boolean, annotated: Boolean, tag: String, message: String) : Boolean {
|
||||||
val version = if (tag.isNullOrBlank()) project.version else tag
|
val version = if (tag.isNullOrBlank()) project.version else tag
|
||||||
val success = try {
|
val success = try {
|
||||||
log(2, "Tagging this release as \"$version\"")
|
log(2, "Tagging this release as \"$version\"")
|
||||||
|
@ -31,7 +31,7 @@ class Git @Inject constructor() {
|
||||||
.findGitDir()
|
.findGitDir()
|
||||||
.build()
|
.build()
|
||||||
val git = org.eclipse.jgit.api.Git(repo)
|
val git = org.eclipse.jgit.api.Git(repo)
|
||||||
val ref = git.tag().setName(version).setMessage(message).call()
|
val ref = git.tag().setAnnotated(annotated).setName(version).setMessage(message).call()
|
||||||
git.push().setPushTags().call()
|
git.push().setPushTags().call()
|
||||||
true
|
true
|
||||||
} catch(ex: Exception) {
|
} catch(ex: Exception) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ class PublishPlugin @Inject constructor(val files: KFiles, val factory: PomGener
|
||||||
private fun autoGitTag(project: Project, uploadResult: TaskResult, config: AutoGitTagConfig?) : TaskResult {
|
private fun autoGitTag(project: Project, uploadResult: TaskResult, config: AutoGitTagConfig?) : TaskResult {
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
with(config) {
|
with(config) {
|
||||||
return git.maybeTagRelease(project, uploadResult, auto, tag, message)
|
return git.maybeTagRelease(project, uploadResult, auto, annotated, tag, message)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return TaskResult()
|
return TaskResult()
|
||||||
|
@ -219,6 +219,9 @@ data class AutoGitTagConfig(val project: Project) {
|
||||||
@Directive
|
@Directive
|
||||||
var auto: Boolean = true
|
var auto: Boolean = true
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
var annotated: Boolean = false
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
var tag : String = project.version!!
|
var tag : String = project.version!!
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue