Skip to content

Commit

Permalink
SCAN4NET-34 Change version to 9.0.0-rc (#2170)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-paidis-sonarsource authored Sep 3, 2024
1 parent 58d1bd0 commit 6afe704
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion AssemblyInfo.Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

[assembly: AssemblyVersion("9.0.0")]
[assembly: AssemblyFileVersion("9.0.0.0")]
[assembly: AssemblyInformationalVersion("Version:9.0.0.0 Branch:not-set Sha1:not-set")]
[assembly: AssemblyInformationalVersion("Version:9.0.0-rc.0 Branch:not-set Sha1:not-set")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SonarSource and Microsoft")]
[assembly: AssemblyCopyright("Copyright © SonarSource and Microsoft 2015-2023")]
Expand Down
2 changes: 1 addition & 1 deletion nuspec/netcoreglobaltool/dotnet-sonarscanner.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>dotnet-sonarscanner</id>
<version>9.0.0</version>
<version>9.0.0-rc</version>
<title>SonarScanner for .NET</title>
<authors>SonarSource,Microsoft</authors>
<projectUrl>https://redirect.sonarsource.com/doc/msbuild-sq-runner.html</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-packages.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
param ($sourcesDirectory)

[xml]$versionProps = Get-Content "$env:BUILD_SOURCESDIRECTORY\scripts\version\Version.props"
$leakPeriodVersion = $versionProps.Project.PropertyGroup.MainVersion
$leakPeriodVersion = $versionProps.Project.PropertyGroup.MainVersion + $versionProps.Project.PropertyGroup.PrereleaseSuffix

$artifactsFolder = "$env:BUILD_SOURCESDIRECTORY\\build"
$version = $leakPeriodVersion + '.' + $env:BUILD_BUILDID
Expand Down
4 changes: 2 additions & 2 deletions scripts/promote-project-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
$versionFilePath = "$env:BUILD_SOURCESDIRECTORY\scripts\version\Version.props"
Write-Host "Reading the Sonar project version from '${versionFilePath}' ..."

# Read the version from the file
# Read the version and the prerelease suffix (if any) from the file
[xml]$versionProps = Get-Content "$versionFilePath"
$sonarProjectVersion = $versionProps.Project.PropertyGroup.MainVersion
$sonarProjectVersion = $versionProps.Project.PropertyGroup.MainVersion + $versionProps.Project.PropertyGroup.PrereleaseSuffix
Write-Host "Sonar project version is '${sonarProjectVersion}'"
# Set the variable to it can be used by other tasks
Write-Host "##vso[task.setvariable variable=SONAR_PROJECT_VERSION]$sonarProjectVersion"
2 changes: 1 addition & 1 deletion scripts/version/ChangeVersion.proj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<GlobalToolNuspec Include="$(SolutionRoot)\nuspec\netcoreglobaltool\dotnet-sonarscanner.nuspec">
<Find>(?&lt;=&lt;version&gt;)([^&lt;]*)</Find>
<ReplaceWith>$(MainVersion)</ReplaceWith>
<ReplaceWith>$(MainVersion)$(PrereleaseSuffix)</ReplaceWith>
<ExpectedMatchCount>1</ExpectedMatchCount>
</GlobalToolNuspec>
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions scripts/version/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<PropertyGroup>
<MainVersion>9.0.0</MainVersion>
<BuildNumber>0</BuildNumber>
<PrereleaseSuffix>-rc</PrereleaseSuffix>
<Sha1>not-set</Sha1>
<BranchName>not-set</BranchName>
<FullVersion>$(MainVersion).$(BuildNumber)</FullVersion>
<AssemblyVersion>$(MainVersion)</AssemblyVersion>
<AssemblyFileVersion>$(FullVersion)</AssemblyFileVersion>
<AssemblyInformationalVersion>Version:$(FullVersion) Branch:$(BranchName) Sha1:$(Sha1)</AssemblyInformationalVersion>
<AssemblyFileVersion>$(MainVersion).$(BuildNumber)</AssemblyFileVersion>
<AssemblyInformationalVersion>Version:$(MainVersion)$(PreReleaseSuffix).$(BuildNumber) Branch:$(BranchName) Sha1:$(Sha1)</AssemblyInformationalVersion>
</PropertyGroup>
</Project>
17 changes: 14 additions & 3 deletions scripts/version/set-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ This script allows to set the specified version in all required files.

[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, Position = 1)]
[Parameter(Mandatory = $True)]
[ValidatePattern("^\d{1,3}\.\d{1,3}\.\d{1,3}$")]
[string]$version
[string]$version,

[Parameter(Mandatory = $False)]
[ValidatePattern("^alpha|beta|rc$")] # see https://learn.microsoft.com/en-us/nuget/concepts/package-versioning?tabs=semver20sort#pre-release-versions
[string]$prereleaseSuffix = ""
)

Set-StrictMode -version 2.0
Expand All @@ -22,6 +26,13 @@ function Set-VersionForDotNet() {
$versionPropsFile = Resolve-Path "Version.props"
$xml = [xml](Get-Content $versionPropsFile)
$xml.Project.PropertyGroup.MainVersion = $version
if (-not [string]::IsNullOrWhiteSpace($prereleaseSuffix)) {
$xml.Project.PropertyGroup.PrereleaseSuffix = "-" + $prereleaseSuffix
}
else {
$xml.Project.PropertyGroup.PrereleaseSuffix = ""
}

$xml.Save($versionPropsFile)
msbuild "ChangeVersion.proj"
Test-ExitCode "ERROR: Change version FAILED."
Expand All @@ -37,7 +48,7 @@ try {
if ($fixedVersion.EndsWith(".0")) {
$fixedVersion = $version.Substring(0, $version.Length - 2)
}

Set-VersionForDotNet

exit 0
Expand Down

0 comments on commit 6afe704

Please sign in to comment.