From c7d8c7ab8e0422b2aede88c091e980943b2c6f80 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 12:25:22 -0700 Subject: [PATCH 01/12] Update buildAndPackage.yml for Azure Pipelines --- .azure-pipelines/buildAndPackage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml index ad8e81eea..5f4ffa68c 100644 --- a/.azure-pipelines/buildAndPackage.yml +++ b/.azure-pipelines/buildAndPackage.yml @@ -82,6 +82,7 @@ steps: settings.gradle gradle.properties **/gradle/wrapper/* + Scripts/getLatestVersion.ps1 TargetFolder: '$(Build.ArtifactStagingDirectory)/' - task: PublishBuildArtifacts@1 From 569671320394aaf49832c48ae9bb4bdc6dd57e7d Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 12:25:55 -0700 Subject: [PATCH 02/12] Update buildAndPackage.yml for Azure Pipelines --- .azure-pipelines/buildAndPackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml index 5f4ffa68c..e725bdc77 100644 --- a/.azure-pipelines/buildAndPackage.yml +++ b/.azure-pipelines/buildAndPackage.yml @@ -82,7 +82,7 @@ steps: settings.gradle gradle.properties **/gradle/wrapper/* - Scripts/getLatestVersion.ps1 + scripts/getLatestVersion.ps1 TargetFolder: '$(Build.ArtifactStagingDirectory)/' - task: PublishBuildArtifacts@1 From 6b70c1926d4ed3f4cb5b5414b85752a4cf8ab037 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 12:26:31 -0700 Subject: [PATCH 03/12] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index cdd049d0e..b839343e8 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -41,7 +41,7 @@ steps: - task: PowerShell@2 condition: and(failed(), eq(variables['Build.SourceBranchName'], 'dev')) inputs: - filePath: '$(System.DefaultWorkingDirectory)\Scripts\validateMavenVersion.ps1' + filePath: '$(System.DefaultWorkingDirectory)\scripts\validateMavenVersion.ps1' pwsh: true arguments: '-packageName "$(PACKAGE_NAME)" -propertiesPath "$(PROPERTIES_PATH)"' From 493d910657c7380660d96ea009ab4cbd718da804 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Thu, 25 Jun 2020 12:38:36 -0700 Subject: [PATCH 04/12] update script and rename folder from Scripts to scripts --- Scripts/validateMavenVersion.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index 282567a45..a3d81dc84 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -43,6 +43,14 @@ $bintrayAPIurl = "https://api.bintray.com/search/packages?name=$packageName" $jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json $bintrayVersion = [version]$jsonResult.latest_version +#If the api calls return empty then this library cannot be compared to the online versions +#may proceed with the pull request +if(($mavenVersion -eq $null) -and ($bintrayVersion -eq $null)) +{ + Write-Information "This package does not exist yet in the online repository, therefore there are no versions to compare." + return +} + #Inform host of current Maven and Bintray versions write-host 'The current version in the Maven central repository is:' $mavenVersion write-host 'The current version in the Bintray central repository is:' $bintrayVersion From 6f42cede94275451188189ea938fcb2161e8def0 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Thu, 25 Jun 2020 12:42:11 -0700 Subject: [PATCH 05/12] add getLatestVersion script --- Scripts/getLatestVersion.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Scripts/getLatestVersion.ps1 diff --git a/Scripts/getLatestVersion.ps1 b/Scripts/getLatestVersion.ps1 new file mode 100644 index 000000000..e69de29bb From eae025a51982b3d7e0885ee42ef806be29226e76 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Thu, 25 Jun 2020 13:13:38 -0700 Subject: [PATCH 06/12] update the scripts --- Scripts/getLatestVersion.ps1 | 31 +++++++++++++++++++++++++++++++ Scripts/validateMavenVersion.ps1 | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Scripts/getLatestVersion.ps1 b/Scripts/getLatestVersion.ps1 index e69de29bb..515408f88 100644 --- a/Scripts/getLatestVersion.ps1 +++ b/Scripts/getLatestVersion.ps1 @@ -0,0 +1,31 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +<# +.Synopsis + Retrieve the latest version of the library +.Description + Retrieves the latest version specified in the Gradle.Properties file + Uses the retrieved values to update the enviornment variable VERSION_STRING +#> + +.Parameter propertiesPath + +Param( + [parameter(Mandatory = $true)] + [string]$propertiesPath, +) + +#Retrieve the current version from the Gradle.Properties file given the specified path +$file = get-item $propertiesPath +$findVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2 +$findVersions = $findVersions -split "`r`n" + +$majorVersion = $findVersions[0].Substring($findVersions[0].Length-1) +$minorVersion = $findVersions[1].Substring($findVersions[1].Length-1) +$patchVersion = $findVersions[2].Substring($findVersions[2].Length-1) +$version = "$majorVersion.$minorVersion.$patchVersion" + +#Update the VERSION_STRING env variable and inform the user +Write-Host "##vso[task.setVariable variable=VERSION_STRING]$($version)"; +Write-Host "Updated the VERSION_STRING enviornment variable with the current Gradle.Properties, $version" \ No newline at end of file diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index a3d81dc84..f591d5e1e 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -52,8 +52,8 @@ if(($mavenVersion -eq $null) -and ($bintrayVersion -eq $null)) } #Inform host of current Maven and Bintray versions -write-host 'The current version in the Maven central repository is:' $mavenVersion -write-host 'The current version in the Bintray central repository is:' $bintrayVersion +Write-Host 'The current version in the Maven central repository is:' $mavenVersion +Write-Host 'The current version in the Bintray central repository is:' $bintrayVersion #Warn in case Maven and Bintray versions are not the same. if($mavenVersion -ne $bintrayVersion){ From 3eee981424ef742a1abcf09e746c561e6da0debe Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 13:14:17 -0700 Subject: [PATCH 07/12] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index b839343e8..cdd049d0e 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -41,7 +41,7 @@ steps: - task: PowerShell@2 condition: and(failed(), eq(variables['Build.SourceBranchName'], 'dev')) inputs: - filePath: '$(System.DefaultWorkingDirectory)\scripts\validateMavenVersion.ps1' + filePath: '$(System.DefaultWorkingDirectory)\Scripts\validateMavenVersion.ps1' pwsh: true arguments: '-packageName "$(PACKAGE_NAME)" -propertiesPath "$(PROPERTIES_PATH)"' From 062a8d59a2d5c0ef6140db719c4dcbeaeca5364f Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 13:15:02 -0700 Subject: [PATCH 08/12] Update buildAndPackage.yml for Azure Pipelines --- .azure-pipelines/buildAndPackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml index e725bdc77..5f4ffa68c 100644 --- a/.azure-pipelines/buildAndPackage.yml +++ b/.azure-pipelines/buildAndPackage.yml @@ -82,7 +82,7 @@ steps: settings.gradle gradle.properties **/gradle/wrapper/* - scripts/getLatestVersion.ps1 + Scripts/getLatestVersion.ps1 TargetFolder: '$(Build.ArtifactStagingDirectory)/' - task: PublishBuildArtifacts@1 From 127776005ded50ab6fbf6595d93f771de1af76c1 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 14:26:05 -0700 Subject: [PATCH 09/12] Update buildAndPackage.yml for Azure Pipelines --- .azure-pipelines/buildAndPackage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml index 5f4ffa68c..d398126dc 100644 --- a/.azure-pipelines/buildAndPackage.yml +++ b/.azure-pipelines/buildAndPackage.yml @@ -23,6 +23,7 @@ trigger: - gradlew.bat - readme.md - settings.gradle + - Scripts/* pr: none From ff942d7adc8dd191f3f0a44a985b0903414a1125 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 14:37:34 -0700 Subject: [PATCH 10/12] Update prValidate.yml for Azure Pipelines add "Scripts/*" in pr: - paths: - exclude: within prValidate.yml --- .azure-pipelines/prValidate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index cdd049d0e..0b3502285 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -18,6 +18,7 @@ pr: - gradlew.bat - readme.md - settings.gradle + - Scripts/* trigger: none # disable triggers based on commits. From 5ca7be82e12a97dfe2c517c59496851a222ed808 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 15:03:10 -0700 Subject: [PATCH 11/12] Update prValidate.yml --- .azure-pipelines/prValidate.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index 0b3502285..f546b47b6 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -1,4 +1,8 @@ -# Build and test Java Core to make sure a valid pull request is being made + +#Copyright (c) Microsoft Corporation. All rights reserved. +#Licensed under the MIT License. +#Build and test Java Core to make sure a valid pull request is being made +#Validate that the versions dont conflict with those online in case a pull request is made to main or master pr: branches: include: @@ -63,4 +67,4 @@ steps: title: '$(Build.DefinitionName) failure notification' text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. ' condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) - enabled: true \ No newline at end of file + enabled: true From 2b0f46bf2fe776572722a843800e8fd293fe4df7 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 25 Jun 2020 15:03:28 -0700 Subject: [PATCH 12/12] Update prValidate.yml --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index f546b47b6..64bbf4c0b 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -1,8 +1,8 @@ - #Copyright (c) Microsoft Corporation. All rights reserved. #Licensed under the MIT License. #Build and test Java Core to make sure a valid pull request is being made #Validate that the versions dont conflict with those online in case a pull request is made to main or master + pr: branches: include: