Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Scripts/validateMavenVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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."
}
}