diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index f591d5e1e..da1742bd2 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -9,23 +9,22 @@ Retrieves the local, Maven, and Bintray versions of the Java-Core build. Checks that the Maven and Bintray versions are aligned, trigger warning if not. Checks that the current local version is greater than those currently deployed. +.Parameter propertiesPath #> -.Parameter packageName -.Parameter propertiesPath Param( - [parameter(Mandatory = $true)] - [string]$packageName, - - [parameter(Mandatory = $true)] [string]$propertiesPath ) #Find the local version from the Gradle.Properties file +if($propertiesPath -eq "" -or $null -eq $propertiesPath) { + $propertiesPath = Join-Path -Path $PSScriptRoot -ChildPath "../gradle.properties" +} $file = get-item $propertiesPath $findLocalVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2 $findLocalVersions = $findLocalVersions -split "`r`n" +$packageName = ($file | Select-String -Pattern "mavenArtifactId").Line.Split("=")[1].Trim() $localMajor = $findLocalVersions[0].Substring($findLocalVersions[0].Length-1) $localMinor = $findLocalVersions[1].Substring($findLocalVersions[1].Length-1) @@ -60,9 +59,9 @@ if($mavenVersion -ne $bintrayVersion){ Write-Warning "The current Maven and Bintray versions are not the same" } #Success if Local version has been updated, Error otherwise. -if($localVersion -gt $bintrayVersion){ +if($localVersion -gt $bintrayVersion -and $localVersion -gt $mavenVersion){ Write-Host "The current pull request is of a greater version" } else{ Write-Error "The current local version is not updated. Please update the local version in the Gradle.Properties file." -} \ No newline at end of file +}