Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Resolve release types to strings before checking the validity. Fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewprenger committed Jul 23, 2016
1 parent 11994f5 commit c7181bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Nov 22 21:23:57 CST 2015
#Sat Jul 23 13:53:39 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class CurseArtifact implements Serializable {
check(changelogType != null, "The changelogType was null for project $id")
check(changelog != null, "The changelog was not set for project $id")
check(releaseType != null, "The releaseType was not set for project $id")
releaseType = Util.resolveString(releaseType)
check(CurseGradlePlugin.VALID_RELEASE_TYPES.contains(releaseType), "Invalid release type ($releaseType) for project $id. Valid options are: $CurseGradlePlugin.VALID_RELEASE_TYPES")
curseRelations.each { it.validate(id) }
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/groovy/com/matthewprenger/cursegradle/Util.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class Util {
*/
static String resolveString(Object obj) {
checkNotNull(obj)

while(obj instanceof Closure) {
obj = ((Closure)obj).call()
}

if (obj instanceof String) {
return (String) obj
}
Expand Down

0 comments on commit c7181bb

Please sign in to comment.