Skip to content

Commit 6465a6f

Browse files
committed
- fixes an issue where maven version would not be compared
1 parent b04bbb7 commit 6465a6f

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎Scripts/validateMavenVersion.ps1‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,22 @@
99
Retrieves the local, Maven, and Bintray versions of the Java-Core build.
1010
Checks that the Maven and Bintray versions are aligned, trigger warning if not.
1111
Checks that the current local version is greater than those currently deployed.
12+
.Parameter propertiesPath
1213
#>
1314

14-
.Parameter packageName
15-
.Parameter propertiesPath
1615

1716
Param(
18-
[parameter(Mandatory = $true)]
19-
[string]$packageName,
20-
21-
[parameter(Mandatory = $true)]
2217
[string]$propertiesPath
2318
)
2419

2520
#Find the local version from the Gradle.Properties file
21+
if($propertiesPath -eq "" || $null -eq $propertiesPath) {
22+
$propertiesPath = Join-Path -Path $PSScriptRoot -ChildPath "../gradle.properties"
23+
}
2624
$file = get-item $propertiesPath
2725
$findLocalVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2
2826
$findLocalVersions = $findLocalVersions -split "`r`n"
27+
$packageName = ($file | Select-String -Pattern "mavenArtifactId").Line.Split("=")[1].Trim()
2928

3029
$localMajor = $findLocalVersions[0].Substring($findLocalVersions[0].Length-1)
3130
$localMinor = $findLocalVersions[1].Substring($findLocalVersions[1].Length-1)
@@ -60,7 +59,7 @@ if($mavenVersion -ne $bintrayVersion){
6059
Write-Warning "The current Maven and Bintray versions are not the same"
6160
}
6261
#Success if Local version has been updated, Error otherwise.
63-
if($localVersion -gt $bintrayVersion){
62+
if($localVersion -gt $bintrayVersion && $localVersion -gt $mavenVersion){
6463
Write-Host "The current pull request is of a greater version"
6564
}
6665
else{

0 commit comments

Comments
 (0)