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

Fix load order of ProjectStaging and restrict package version validation to only official builds #6041

Merged
merged 10 commits into from
Mar 26, 2025
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
13 changes: 13 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@
<!-- Enable the Evaluation report builds on all CI builds -->
<PropertyGroup>
<EnableEvaluationReportBuild Condition="'$(ContinuousIntegrationBuild)'=='true'">true</EnableEvaluationReportBuild>

<!--
ProjectStaging.props depends on the $(Stage) property, which is defined in the project file.
It also controls $(SuppressFinalPackageVersion) which controls how versions are defined in Arcade's Version.BeforeCommonTargets.targets.

Normally, we'd import custom props in Directory.Build.props but it is imported before the project.
We can't move the props into ProjectStaging.targets as it is imported after Version.BeforeCommonTargets.targets
is imported, which is too late. This allows us to import the props at the right time.
-->
<BeforeMicrosoftNETSdkTargets>
$(BeforeMicrosoftNETSdkTargets);
$(MSBuildThisFileDirectory)\eng\MSBuild\ProjectStaging.props
</BeforeMicrosoftNETSdkTargets>
</PropertyGroup>

<!-- Common properties -->
Expand Down
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ trigger:
- dev
- release/*
- internal/release/*
- validation/*
paths:
include:
- '*'
Expand Down Expand Up @@ -74,7 +75,7 @@ variables:
- name: Build.Arcade.VSIXOutputPath
value: $(Build.Arcade.ArtifactsPath)VSIX

- ${{ if or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), eq(variables['Build.Reason'], 'Manual')) }}:
- ${{ if or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/validation/'), eq(variables['Build.Reason'], 'Manual')) }}:
- name: PostBuildSign
value: false
- ${{ else }}:
Expand Down
28 changes: 28 additions & 0 deletions eng/MSBuild/ProjectStaging.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project>

<PropertyGroup>
<!-- Amend the description based on stage -->
<Description Condition="'$(Stage)' == 'dev'">Experimental package. $(Description)</Description>
<Description Condition="'$(Stage)' == 'obsolete'">Obsolete Package. $(Description)</Description>

<!--
In 8.0, we shipped Microsoft.AspNetCore.Testing package as stable even when it was in the dev stage, so we
keep it as stable for compatiblity.
-->
<_IsStable Condition="('$(Stage)' != 'dev' and '$(Stage)' != 'preview') Or '$(MSBuildProjectName)' == 'Microsoft.AspNetCore.Testing'">true</_IsStable>

<!--
When DotNetFinalVersionKind is set to 'release' (only for the release branches),
the build will produce stable outputs for 'Shipping' packages.
-->
<DotNetFinalVersionKind Condition=" '$(StabilizePackageVersion)' == 'true' And '$(DotNetFinalVersionKind)' == '' And '$(_IsStable)' == 'true' ">release</DotNetFinalVersionKind>

<!-- Preview packages: do not use stable branding and do not warn about lack of [Experimental] -->
<NoWarn Condition="'$(Stage)' == 'dev' or '$(Stage)' == 'preview'">$(NoWarn);LA0003</NoWarn>
<!--
Makes it such that the package version won't be stabilized even when the rest of the repo is going stable.
https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Versioning.md#package-version
-->
<SuppressFinalPackageVersion Condition=" '$(_IsStable)' != 'true' ">true</SuppressFinalPackageVersion>
</PropertyGroup>
</Project>
23 changes: 12 additions & 11 deletions eng/MSBuild/ProjectStaging.targets
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project>

<PropertyGroup>
<!-- Preview packages: do not use stable branding and do not warn about lack of [Experimental] -->
<SuppressFinalPackageVersion Condition="'$(Stage)' == 'preview'">true</SuppressFinalPackageVersion>
<NoWarn Condition="'$(Stage)' == 'preview'">$(NoWarn);LA0003</NoWarn>
</PropertyGroup>

<!-- Produce errors if we don't have all the right properties defined -->
<Target Name="_CheckPropsExist" Condition="'$(IsPackable)' == 'true' and '$(Stage)' != '' and $(Stage) != 'transport'" BeforeTargets="Build">
<Error Condition="'$(Stage)' != 'dev' AND '$(Stage)' != 'normal' AND '$(Stage)' != 'obsolete' AND '$(Stage)' != 'preview'" Text="Stage property must be dev|normal|obsolete|preview" />
Expand All @@ -22,10 +16,17 @@
<Error Condition="'$(MinMutationScore)' != 'n/a' AND ('$(MinMutationScore)' &lt; 50)" Text="MinMutationScore property must be >= 50 for normal stage." />
</Target>

<!-- Amend the description based on stage -->
<PropertyGroup>
<Description Condition="'$(Stage)' == 'dev'">Experimental package. $(Description)</Description>
<Description Condition="'$(Stage)' == 'obsolete'">Obsolete Package. $(Description)</Description>
</PropertyGroup>
<!--
Produce errors if we don't have all the right property values for non-production stages.

Note, that Arcade resets $(_PreReleaseLabel) to "ci" for non-official builds, which breaks the validation.
See Arcade SDK/Version.BeforeCommonTargets.targets for more details.
-->
<Target Name="_ValidateVersion" AfterTargets="GenerateNuspec" Condition=" '$(OfficialBuild)' == 'true' and '$(_IsStable)' != 'true' ">
<PropertyGroup>
<_ExpectedVersionSuffix>$(_PreReleaseLabel)$(_BuildNumberLabels)</_ExpectedVersionSuffix>
</PropertyGroup>

<Error Condition=" '$(VersionSuffix)' != '$(_ExpectedVersionSuffix)' " Text="Unexpected package version suffix. Expected suffix for '$(Stage)' stage: '$(_ExpectedVersionSuffix)', received: '$(VersionSuffix)'." />
</Target>
</Project>
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<ApiCompatBaselineVersion>9.3.0</ApiCompatBaselineVersion>
<AssemblyVersion>$(MajorVersion).$(MinorVersion).0.0</AssemblyVersion>
<!--
When DotNetFinalVersionKind is set to 'release', this branch will produce stable outputs for 'Shipping' packages
When StabilizePackageVersion is set to 'true', this branch will produce stable outputs for 'Shipping' packages
-->
<DotNetFinalVersionKind />
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
<!-- Enabling this rule will cause build failures on undocumented public APIs. -->
<SkipArcadeNoWarnCS1591>true</SkipArcadeNoWarnCS1591>
</PropertyGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</PropertyGroup>

<PropertyGroup>
<Stage>dev</Stage>
<MinCodeCoverage>67</MinCodeCoverage>
<MinMutationScore>85</MinMutationScore>
</PropertyGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
</PropertyGroup>

<PropertyGroup>
<Stage>dev</Stage>
<StageDevDiagnosticId>EXTEXP0014</StageDevDiagnosticId>
<MinCodeCoverage>100</MinCodeCoverage>
<MinMutationScore>100</MinMutationScore>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
Expand All @@ -8,7 +8,6 @@

<PropertyGroup>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>82</MinCodeCoverage>
<MinMutationScore>0</MinMutationScore>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
Expand All @@ -8,7 +8,6 @@

<PropertyGroup>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>86</MinCodeCoverage>
<MinMutationScore>0</MinMutationScore>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<PropertyGroup>
<Workstream>AIEval</Workstream>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>8</MinCodeCoverage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<PropertyGroup>
<Workstream>AIEval</Workstream>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<EnablePackageValidation>false</EnablePackageValidation>
<!-- The evaluators in this assembly need AI and the tests that cover them are not being run in CI at the moment. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<PropertyGroup>
<Workstream>AIEval</Workstream>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>88</MinCodeCoverage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<PropertyGroup>
<Workstream>AIEval</Workstream>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>66</MinCodeCoverage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<PropertyGroup>
<Workstream>AIEval</Workstream>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>56</MinCodeCoverage>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
Expand All @@ -8,7 +8,6 @@

<PropertyGroup>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>78</MinCodeCoverage>
<MinMutationScore>0</MinMutationScore>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
Expand All @@ -8,7 +8,6 @@

<PropertyGroup>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>49</MinCodeCoverage>
<MinMutationScore>0</MinMutationScore>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
Expand All @@ -10,7 +10,6 @@

<PropertyGroup>
<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>89</MinCodeCoverage>
<MinMutationScore>0</MinMutationScore>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
</PropertyGroup>

<PropertyGroup>
<Stage>dev</Stage>
<StageDevDiagnosticId>EXTEXP0015</StageDevDiagnosticId>
<MinCodeCoverage>76</MinCodeCoverage>
<MinMutationScore>75</MinMutationScore>
</PropertyGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
</PropertyGroup>

<PropertyGroup>
<Stage>dev</Stage>
<StageDevDiagnosticId>EXTEXP0016</StageDevDiagnosticId>
<MinCodeCoverage>100</MinCodeCoverage>
<MinMutationScore>90</MinMutationScore>
</PropertyGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
</PropertyGroup>

<PropertyGroup>
<Stage>dev</Stage>
<StageDevDiagnosticId>EXTEXP0017</StageDevDiagnosticId>
<MinCodeCoverage>100</MinCodeCoverage>
<MinMutationScore>80</MinMutationScore>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<TargetFrameworks />

<Stage>transport</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<IsShipping>false</IsShipping>

<PackageDescription>Internal transport package to provide dotnet-api-docs with the reference assemblies and compiler generated documentation files from dotnet/extensions.</PackageDescription>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<PackageTags>dotnet-new;templates;ai</PackageTags>

<Stage>preview</Stage>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<Workstream>AI</Workstream>
<MinCodeCoverage>0</MinCodeCoverage>
<MinMutationScore>0</MinMutationScore>
Expand Down
Loading