File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright (c) Microsoft Corporation. All rights reserved.
2+ # Licensed under the MIT License.
3+
4+ <#
5+ . Synopsis
6+ Retrieve the latest version of the library
7+ . Description
8+ Retrieves the latest version specified in the Gradle.Properties file
9+ Uses the retrieved values to update the enviornment variable VERSION_STRING
10+ . Parameter propertiesPath
11+ #>
12+ Param (
13+ [string ]$propertiesPath
14+ )
15+
16+ # Retrieve the current version from the Gradle.Properties file given the specified path
17+ if ($propertiesPath -eq " " -or $null -eq $propertiesPath ) {
18+ $propertiesPath = Join-Path - Path $PSScriptRoot - ChildPath " ../gradle.properties"
19+ }
20+ $file = get-item $propertiesPath
21+ $findVersions = $file | Select-String - Pattern " mavenMajorVersion" - Context 0 , 2
22+ $findVersions = $findVersions -split " `r`n "
23+
24+ $majorVersion = $findVersions [0 ].Substring($findVersions [0 ].Length- 1 )
25+ $minorVersion = $findVersions [1 ].Substring($findVersions [1 ].Length- 1 )
26+ $patchVersion = $findVersions [2 ].Substring($findVersions [2 ].Length- 1 )
27+ $version = " $majorVersion .$minorVersion .$patchVersion "
28+
29+ # Update the VERSION_STRING env variable and inform the user
30+ Write-Host " ##vso[task.setVariable variable=VERSION_STRING]$ ( $version ) " ;
31+ Write-Host " Updated the VERSION_STRING enviornment variable with the current Gradle.Properties, $version "
You can’t perform that action at this time.
0 commit comments