Files
AtomUI/build/PackageValidation.props
2026-09-30 13:27:02 +08:00

53 lines
3.6 KiB
XML

<Project>
<!--
Package-version validation compares the C# public API of the packages about to be released
against the previously released baseline packages (ApiCompat, IL level). It covers lib/
assemblies and cross-target-framework consistency.
It does NOT see changes to tools/, buildTransitive/, build/ or the target-framework set.
Package-layout breaks are covered by scripts/verification/verify-package-layout.ps1, which
the release flow runs alongside this validation. Both layers are required: see
docs/engineering/workflows/release-preparation.md.
Validation is opt-in per invocation: pass
AtomUIPackageValidationBaselineVersion=<previously released version> as an MSBuild property.
The release script sets it from the previous release tag. Ordinary development builds stay
fast and require no baseline packages.
The baseline package must already be in the package cache. Restore with the same property
before packing, because the release flow packs with no-build and that skips restore. Use:
dotnet restore <project> with AtomUIPackageValidationBaselineVersion=<version>.
-->
<PropertyGroup Condition="'$(AtomUIPackageValidationBaselineVersion)' != ''">
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">true</EnablePackageValidation>
<PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$(AtomUIPackageValidationBaselineVersion)</PackageValidationBaselineVersion>
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
<!-- The SDK prepends _GetReferencePathFromInnerProjects when it imports its package
validation targets, so this extension runs after the per-TFM items exist. -->
<RunPackageValidationDependsOn>AtomUIAddAvaloniaPackageValidationReferences;$(RunPackageValidationDependsOn)</RunPackageValidationDependsOn>
</PropertyGroup>
<!-- AvaloniaAccessUnstablePrivateApis removes the Avalonia facade during reference resolution,
then adds the real split assemblies only immediately before CoreCompile. ApiCompat stops at
ResolveReferences, so append the same implementation assemblies to its already-collected
per-TFM reference paths. Avalonia uses its net8.0 implementation surface for AtomUI's
net10.0 release TFM. -->
<Target Name="AtomUIAddAvaloniaPackageValidationReferences"
Condition="'$(AtomUIPackageValidationBaselineVersion)' != '' and '$(AvaloniaAccessUnstablePrivateApis)' == 'true'">
<PropertyGroup>
<_AtomUIAvaloniaPackageValidationFramework>net8.0</_AtomUIAvaloniaPackageValidationFramework>
</PropertyGroup>
<ItemGroup>
<_AtomUIAvaloniaPackageValidationReference
Include="$(NuGetPackageRoot)avalonia/$(AvaloniaVersion)/lib/$(_AtomUIAvaloniaPackageValidationFramework)/*.dll" />
</ItemGroup>
<Error Condition="'@(_AtomUIAvaloniaPackageValidationReference)' == ''"
Text="Package validation could not find Avalonia implementation assemblies under '$(NuGetPackageRoot)avalonia/$(AvaloniaVersion)/lib/$(_AtomUIAvaloniaPackageValidationFramework)'." />
<ItemGroup>
<PackageValidationReferencePath Update="@(PackageValidationReferencePath)">
<ReferencePath>%(PackageValidationReferencePath.ReferencePath),@(_AtomUIAvaloniaPackageValidationReference->'%(FullPath)', ',')</ReferencePath>
</PackageValidationReferencePath>
</ItemGroup>
</Target>
</Project>