-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding the config plugin to allow offsets given a certain branch or t…
…ag matches a regex
- Loading branch information
Brian Amesbury
committed
Feb 12, 2019
1 parent
f96a42c
commit 97d8095
Showing
13 changed files
with
352 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
git-version/src/main/kotlin/com/moonlitdoor/git/version/GitVersionConfigPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.moonlitdoor.git.version | ||
|
||
import com.moonlitdoor.git.version.extensions.BranchOffsetNestedExtension | ||
import com.moonlitdoor.git.version.extensions.MoonlitDoorExtension | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
@Suppress("Unused") | ||
class GitVersionConfigPlugin : Plugin<Project> { | ||
|
||
override fun apply(project: Project) { | ||
project.extensions.create(MoonlitDoorExtension.EXTENSION_NAME, MoonlitDoorExtension::class.java).offsets = project.container(BranchOffsetNestedExtension::class.java) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ion/src/main/kotlin/com/moonlitdoor/git/version/extensions/BranchOffsetNestedExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.moonlitdoor.git.version.extensions | ||
|
||
import org.gradle.internal.impldep.com.google.common.annotations.VisibleForTesting | ||
|
||
open class BranchOffsetNestedExtension(var name: String) { | ||
|
||
@VisibleForTesting | ||
constructor(name: String, offset: Int) : this(name) { | ||
this.offset = offset | ||
} | ||
|
||
var offset = 0 | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
git-version/src/main/kotlin/com/moonlitdoor/git/version/extensions/MoonlitDoorExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.moonlitdoor.git.version.extensions | ||
|
||
import groovy.lang.Closure | ||
import org.gradle.api.NamedDomainObjectContainer | ||
|
||
open class MoonlitDoorExtension { | ||
|
||
companion object { | ||
const val EXTENSION_NAME = "mld" | ||
} | ||
|
||
lateinit var offsets: NamedDomainObjectContainer<BranchOffsetNestedExtension> | ||
|
||
@Suppress("unused") | ||
fun offsets(action: Closure<BranchOffsetNestedExtension>) { | ||
offsets.configure(action) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.