Skip to content

Commit

Permalink
Merge branch '85'
Browse files Browse the repository at this point in the history
  • Loading branch information
GladeDiviney committed Oct 30, 2020
2 parents 35adebc + 54dac43 commit 8aa028f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,23 @@ class AndroidGitVersion implements Plugin<Project> {
void apply(Project project) {
project.extensions.create("androidGitVersion", AndroidGitVersionExtension, project)
project.task('androidGitVersion') {
group = 'Build'
description = 'Print version name and version code'
doLast {
println "androidGitVersion.name\t${project.extensions.androidGitVersion.name()}"
println "androidGitVersion.code\t${project.extensions.androidGitVersion.code()}"
}
}
project.task('androidGitVersionName') {
group = 'Build'
description = 'Print version name'
doLast {
println project.extensions.androidGitVersion.name()
}
}
project.task('androidGitVersionCode') {
group = 'Build'
description = 'Print version code'
doLast {
println project.extensions.androidGitVersion.code()
}
Expand Down
15 changes: 15 additions & 0 deletions src/test/groovy/com/gladed/androidgitversion/MainTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,19 @@ class MainTest extends AndroidGitVersionTest {
plugin.flush()
assertEquals(1002004, plugin.code())
}

void testTaskNames() {
plugin // Touch the plugin so it's loaded
def androidGitVersion = project.getTasksByName("androidGitVersion", true).first()
assertEquals("Build", androidGitVersion.group)
assertEquals("Print version name and version code", androidGitVersion.description)

def androidGitVersionName = project.getTasksByName("androidGitVersionName", true).first()
assertEquals("Build", androidGitVersionName.group)
assertEquals("Print version name", androidGitVersionName.description)

def androidGitVersionCode = project.getTasksByName("androidGitVersionCode", true).first()
assertEquals("Build", androidGitVersionCode.group)
assertEquals("Print version code", androidGitVersionCode.description)
}
}

0 comments on commit 8aa028f

Please sign in to comment.