Skip to content

Commit 7402e69

Browse files
EvangelinkCopilot
andcommitted
Include adapter asset policy in native Bazel packages
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent b590f31 commit 7402e69

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

‎docs/decisions/mstest-adapter-lib-assets.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,3 +1777,27 @@ VSTest satellite-duplication behavior remain unverified.
17771777
/bl:"$probe\build6.binlog" /v:minimal
17781778
# Exit 0; native compilation emitted missing-assembly and runtime-directives warnings.
17791779
```
1780+
1781+
### Native Bazel package follow-up
1782+
1783+
The shared non-SDK policy introduced a required import in the portable
1784+
`buildTransitive` targets. The experimental native Bazel package has its own
1785+
file mapping and must ship the same helper beside those targets for each
1786+
portable TFM. Leaving it out breaks consumer evaluation; making the import
1787+
optional would silently omit the policy. The native package validator checks
1788+
the helper in each package framework alongside the existing target files.
1789+
1790+
At source revision `b590f31afcd74a184aa95bac7f2c7cd69f6cf43d`, with only
1791+
the new validator assertion applied,
1792+
`pwsh -NoLogo -NoProfile -File .\eng\bazel\validate-mstest-packages.ps1
1793+
-OutputRoot artifacts\bazel-mstest-review-red` built the native package
1794+
closure but exited 1 on the intended missing
1795+
`buildTransitive/net10.0/MSTest.TestAdapter.AssetPolicy.targets` entry.
1796+
With the file mapping added, the identical validator using
1797+
`-OutputRoot artifacts\bazel-mstest-review-green` exited 0. It verified the
1798+
helper for net10.0 and net11.0, then published and ran both real package
1799+
consumers: each passed all three named cases, exercised the intended failure
1800+
and empty-result exits, and the net11 MSBuild driver passed the same three
1801+
cases and its intentional failure check. The green native adapter package
1802+
SHA-256 was
1803+
`58B210FD0D79002CA74CBB3176D7F6F96D5DF509569A872F8F05ED351E599C80`.

‎eng/bazel/mstest-packages.bzl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def native_mstest_packages():
210210
filename = "MSTest.TestAdapter." + extension
211211
_asset(adapter_files, "adapter_build_" + suffix + "_" + extension, adapter_project + "/build/" + framework + "/" + filename, "build/" + framework + "/" + filename)
212212
_asset(adapter_files, "adapter_transitive_" + suffix + "_" + extension, adapter_project + "/buildTransitive/common/" + filename, "buildTransitive/" + framework + "/" + filename)
213+
_asset(adapter_files, "adapter_asset_policy_" + suffix, adapter_project + "/buildTransitive/MSTest.TestAdapter.AssetPolicy.targets", "buildTransitive/" + framework + "/MSTest.TestAdapter.AssetPolicy.targets")
213214
_asset(adapter_files, "adapter_parallelize_" + suffix, adapter_project + "/buildTransitive/Parallelize.targets", "buildTransitive/" + framework + "/Parallelize.targets")
214215

215216
_package(

‎eng/bazel/validate-mstest-packages.ps1‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function Assert-PackageLayout($Archive, $Metadata, [string] $Id) {
126126
$null = Get-ZipHash $Archive "build/$framework/MSTest.TestAdapter.$extension"
127127
$null = Get-ZipHash $Archive "buildTransitive/$framework/MSTest.TestAdapter.$extension"
128128
}
129+
$null = Get-ZipHash $Archive "buildTransitive/$framework/MSTest.TestAdapter.AssetPolicy.targets"
129130
$null = Get-ZipHash $Archive "buildTransitive/$framework/Parallelize.targets"
130131
if (@($Archive.Entries | Where-Object { $_.FullName -like 'buildTransitive/*.dll' -or $_.FullName -like '*/_localization/*' }).Count) {
131132
throw 'The adapter must ship its assemblies and satellites as lib assets, not build payloads.'

0 commit comments

Comments
 (0)