Skip to content

Commit

Permalink
Merge pull request #112 from tom-foyle/main
Browse files Browse the repository at this point in the history
Remove String check to support semantic-release version numbers
  • Loading branch information
tom-foyle authored Mar 14, 2022
2 parents c504c45 + 3fc0dcb commit 9f4ed9c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/kotlin/com/ibm/cics/cbgp/BuildBundleTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ open class BuildBundleTask : DefaultTask() {

private fun getProjectVersionNumber(): VersionNumber {
val pv = project.version
if (pv is String) {
val versionNumber = VersionNumber.parse(pv.toString())
if (!VersionNumber.UNKNOWN.equals(versionNumber)) {
return versionNumber
}
val versionNumber = VersionNumber.parse(pv.toString())
if (!VersionNumber.UNKNOWN.equals(versionNumber)) {
return versionNumber
}
throw GradleException("Project version number '$pv' could not be parsed into MAJOR.MINOR.MICRO.PATCH format")
}
Expand Down
15 changes: 15 additions & 0 deletions src/test/groovy/com/ibm/cics/cbgp/GoldenPathTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ class GoldenPathTests extends AbstractTest {
checkBundleArchiveFile()
}

def "Test version number"() {

given:
rootProjectName = bundleProjectName = "version"
projectVersion = "1.2.3"

copyTestProject()

when:
runGradleAndSucceed([BundlePlugin.DEPLOY_TASK_NAME])

then:
checkBundleArchiveFile()
}

@Unroll
def "Test standalone #type project"(String type) {

Expand Down
25 changes: 25 additions & 0 deletions src/test/resources/version/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugins {
id 'com.ibm.cics.bundle'
}

version = new org.gradle.util.VersionNumber(1, 2, 3, null)

repositories {
mavenCentral()
}

cicsBundle {
build {
defaultJVMServer = project.jvmsWlp
}
deploy {
url = project.url
cicsplex = project.cicsplex
region = project.region
bunddef = 'GRADLEV'
csdgroup = project.csdgroup
username = project.username
password = project.password
insecure = project.insecure
}
}
1 change: 1 addition & 0 deletions src/test/resources/version/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'version'

0 comments on commit 9f4ed9c

Please sign in to comment.