Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set PackageVersion in MSBuild to allow different versions at pack time #10124

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ Invoke-BuildStep 'Signing the binaries' {
-skip:$SkipArtifacts `
-ev +BuildErrors

$packageVersions = "/p:CommonPackageVersion=$CommonPackageVersion;GalleryPackageVersion=$GalleryPackageVersion;JobsPackageVersion=$JobsPackageVersion"

Invoke-BuildStep 'Creating common artifacts' {
$CommonPackages = $CommonProjects | Where-Object { $_.IsSrc }
$CommonPackages | ForEach-Object {
New-ProjectPackage $_.Path -Configuration $Configuration -BuildNumber $BuildNumber -Version $CommonPackageVersion
New-ProjectPackage $_.Path -Configuration $Configuration -Symbols -Options $packageVersions
}
} `
-skip:($SkipCommon -or $SkipArtifacts) `
Expand All @@ -160,7 +162,7 @@ Invoke-BuildStep 'Creating gallery artifacts' { `
"src\NuGetGallery.Core\NuGetGallery.Core.csproj",
"src\NuGetGallery.Services\NuGetGallery.Services.csproj"
$GalleryProjects | ForEach-Object {
New-ProjectPackage (Join-Path $PSScriptRoot $_) -Configuration $Configuration -BuildNumber $BuildNumber -Version $GalleryPackageVersion -Branch $Branch -Symbols
New-ProjectPackage (Join-Path $PSScriptRoot $_) -Configuration $Configuration -Symbols -Options $packageVersions
}

$GalleryNuspecProjects =
Expand Down Expand Up @@ -197,7 +199,7 @@ Invoke-BuildStep 'Creating jobs artifacts' {
"src\Validation.ScanAndSign.Core\Validation.ScanAndSign.Core.csproj",
"src\Validation.Symbols.Core\Validation.Symbols.Core.csproj"
$JobsProjects | ForEach-Object {
New-ProjectPackage (Join-Path $PSScriptRoot $_) -Configuration $Configuration -BuildNumber $BuildNumber -Version $JobsPackageVersion -Branch $Branch -Symbols
New-ProjectPackage (Join-Path $PSScriptRoot $_) -Configuration $Configuration -Symbols -Options $packageVersions
}

$JobsNuspecProjects =
Expand Down
9 changes: 8 additions & 1 deletion build/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,8 @@ Function New-ProjectPackage {
[string]$Branch,
[switch]$IncludeReferencedProjects,
[switch]$Sign,
[switch]$BinLog
[switch]$BinLog,
[string[]]$Options
)
Trace-Log "Creating package from @""$TargetFilePath"""

Expand All @@ -789,6 +790,8 @@ Function New-ProjectPackage {
}
elseif ($ReleaseLabel) {
$PackageVersion = Get-PackageVersion $ReleaseLabel $BuildNumber
} else {
$PackageVersion = $null
}

if ($PackageVersion) {
Expand All @@ -811,6 +814,10 @@ Function New-ProjectPackage {
$opts += "/bl"
}

if ($Options) {
$opts += $Options
}

if (-not (Test-Path $Artifacts)) {
New-Item $Artifacts -Type Directory
}
Expand Down
3 changes: 2 additions & 1 deletion src/Catalog/NuGet.Services.Metadata.Catalog.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\SdkProjects.props" />

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<Description>Create, edit, or read the package metadata catalog.</Description>
<PackageTags>nuget;services;search;catalog;metadata;collector</PackageTags>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\SdkProjects.props" />

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Jobs.Common/NuGet.Jobs.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<RootNamespace>NuGet.Jobs</RootNamespace>
<Description>Common infrastructure for running the NuGetGallery back-end jobs.</Description>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/NuGet.Protocol.Catalog/NuGet.Protocol.Catalog.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\SdkProjects.props" />

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<Description>A .NET library for consuming the NuGet API's catalog resource.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\SdkProjects.props" />

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<Description>Push NuGetGallery DB packages or catalog leaves to Azure Search.</Description>
<PackageTags>nuget azure search catalog leaf details incremental collector</PackageTags>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Services.Build/NuGet.Services.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Shared component to assist NuGet build scripts.</Description>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Shared configuration management NuGet services.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\SdkProjects.props" />

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Interfaces used for NuGet services</Description>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/NuGet.Services.Cursor/NuGet.Services.Cursor.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\SdkProjects.props" />

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Shared cursor classes</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\SdkProjects.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(GalleryPackageVersion)</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<Description>Core support library for NuGet database migration</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(GalleryPackageVersion)</PackageVersion>
<Description>Entities used for NuGet services</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Dynamic feature toggles</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>A framework to access the NuGet incident API.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Key vault access for NuGet services</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Common license expression code</Description>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Services.Logging/NuGet.Services.Logging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Shared server-side logging component for NuGet services.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Components shared between the front-end and back-end concerning email messaging</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Logic shared between the front-end and back-end concerning asynchronous messaging</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\SdkProjects.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<Description>Monitor the package metadata catalog.</Description>
Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Services.Owin/NuGet.Services.Owin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Shared OWIN code for the NuGet projects</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Integration with Azure Service Bus</Description>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Services.Sql/NuGet.Services.Sql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Azure SQL access for NuGet services</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Contract to store NuGet service status in tables.</Description>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Services.Status/NuGet.Services.Status.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>A framework to produce and consume status reported about NuGet services.</Description>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Services.Storage/NuGet.Services.Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Shared server-side storage component for NuGet services</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Infrastructure to unit test Entity Framework entities.</Description>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Services.V3/NuGet.Services.V3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<Description>Common infrastructure for V3 back-end jobs, including catalog abstractions and dependency injection setup.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>User-visible issues emitted by NuGet services</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(CommonPackageVersion)</PackageVersion>
<Description>Logic shared between the front-end and back-end concerning asynchronous validation</Description>

<!--
Expand Down
1 change: 1 addition & 0 deletions src/NuGetGallery.Core/NuGetGallery.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(GalleryPackageVersion)</PackageVersion>
<RootNamespace>NuGetGallery</RootNamespace>
<Description>Core support library for NuGet Gallery Frontend and Backend</Description>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/NuGetGallery.Services/NuGetGallery.Services.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\SdkProjects.props" />

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(GalleryPackageVersion)</PackageVersion>
<Description>Services library for NuGet Gallery Frontend and Backend</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<PackageId>NuGet.Stats.LogInterpretation</PackageId>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/Validation.Common.Job/Validation.Common.Job.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<RootNamespace>NuGet.Jobs.Validation</RootNamespace>
<AssemblyName>NuGet.Services.Validation.Common.Job</AssemblyName>
<Description>Common job infrastructure for validation jobs and basic dependency injection setup.</Description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\SdkProjects.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<RootNamespace>NuGet.Jobs.Validation.ContentScan</RootNamespace>
<AssemblyName>NuGet.Jobs.Validation.ContentScan.Core</AssemblyName>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\SdkProjects.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<RootNamespace>NuGet.Jobs.Validation.ScanAndSign</RootNamespace>
<AssemblyName>NuGet.Jobs.Validation.ScanAndSign.Core</AssemblyName>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\SdkProjects.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(JobsPackageVersion)</PackageVersion>
<RootNamespace>NuGet.Jobs.Validation.Symbols.Core</RootNamespace>
<AssemblyName>NuGet.Jobs.Validation.Symbols.Core</AssemblyName>
</PropertyGroup>
Expand Down