Skip to content

Commit 5ce6745

Browse files
try(build): 尝试兼容干净构建的 NuGet 包路径(编译通过,待验证) / Try supporting NuGet package paths in clean builds (build passed, validation pending)
中文: - 为 C++/WinRT 生成器和部署许可文件增加 NuGet 根目录回退,兼容原生辅助项目缺少 NuGetPackageRoot 以及自定义缓存路径无尾分隔符的情况 - 扩展部署打包契约,防止重新依赖仅在增量构建中可用的包路径属性 English: - Add NuGet-root fallbacks for the C++/WinRT generator and deployment license files, covering native helper projects without NuGetPackageRoot and custom cache paths without a trailing separator - Extend the deployment packaging contract to prevent renewed reliance on package-path properties available only in incremental builds 验证 / Validation: - cmake -S . -B .codex-probes\ci-clean-33084520119 -G "Visual Studio 18 2026" -A x64 -DBUILD_TESTING=ON(通过 / passed) - 使用独立空 NUGET_PACKAGES 构建 SnowDesktopSearchVisibility(通过 / passed with an isolated empty NUGET_PACKAGES directory) - 隔离构建 SnowDesktop、SnowDesktopSteamBridge、SnowDesktopWorkshopManager、snowwidget(通过并生成 SnowDesktop.exe / passed and produced SnowDesktop.exe) - deployment_packaging_contract(1/1 通过 / 1/1 passed) - core CTest suite(16/16 通过 / 16/16 passed) 限制 / Limitations: - scripts\build.bat 在执行约 7.5 秒后被用户中断,未完成标准构建验证;scripts\test.bat 未在本次最终状态运行 / scripts\build.bat was interrupted by the user after about 7.5 seconds, so standard build validation did not finish; scripts\test.bat was not run on the final state - GitHub Actions 干净运行器验证待上传后完成 / GitHub Actions validation on a clean runner remains pending after upload
1 parent 995884b commit 5ce6745

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

‎cmake/SnowDesktop.ShellView.props‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
<SnowDesktopShellProjectionDir>$(ProjectDir)generated\shellview-cppwinrt</SnowDesktopShellProjectionDir>
99
<SnowDesktopWindowsWinMD>$(WindowsSdkDir)UnionMetadata\$(WindowsTargetPlatformVersion)\Windows.winmd</SnowDesktopWindowsWinMD>
1010
<SnowDesktopShellWinMD>$(ProjectDir)generated\winmd\WindowsUdk.winmd</SnowDesktopShellWinMD>
11-
<SnowDesktopCppWinRTExecutable>$(NuGetPackageRoot)microsoft.windows.cppwinrt\$(SnowDesktopCppWinRtPackageVersion)\bin\cppwinrt.exe</SnowDesktopCppWinRTExecutable>
11+
<SnowDesktopNuGetPackageRoot Condition="'$(NuGetPackageRoot)' != ''">$(NuGetPackageRoot)</SnowDesktopNuGetPackageRoot>
12+
<SnowDesktopNuGetPackageRoot Condition="'$(SnowDesktopNuGetPackageRoot)' == '' and '$(RestorePackagesPath)' != ''">$(RestorePackagesPath)</SnowDesktopNuGetPackageRoot>
13+
<SnowDesktopNuGetPackageRoot Condition="'$(SnowDesktopNuGetPackageRoot)' == '' and '$(NUGET_PACKAGES)' != ''">$(NUGET_PACKAGES)</SnowDesktopNuGetPackageRoot>
14+
<SnowDesktopNuGetPackageRoot Condition="'$(SnowDesktopNuGetPackageRoot)' == ''">$(UserProfile)\.nuget\packages</SnowDesktopNuGetPackageRoot>
15+
<SnowDesktopCppWinRTExecutable>$(SnowDesktopNuGetPackageRoot)\microsoft.windows.cppwinrt\$(SnowDesktopCppWinRtPackageVersion)\bin\cppwinrt.exe</SnowDesktopCppWinRTExecutable>
1216
</PropertyGroup>
1317

1418
<Target Name="SnowDesktopGenerateShellViewProjection"

‎cmake/SnowDesktop.WinUI.props‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
<ManagedAssembly>false</ManagedAssembly>
1818
<DefaultLanguageSourceExtension>.cpp</DefaultLanguageSourceExtension>
1919
<XamlGeneratedOutputPath>$(ProjectDir)generated\xaml\$(Configuration)\</XamlGeneratedOutputPath>
20+
<SnowDesktopNuGetPackageRoot Condition="'$(NuGetPackageRoot)' != ''">$(NuGetPackageRoot)</SnowDesktopNuGetPackageRoot>
21+
<SnowDesktopNuGetPackageRoot Condition="'$(SnowDesktopNuGetPackageRoot)' == '' and '$(RestorePackagesPath)' != ''">$(RestorePackagesPath)</SnowDesktopNuGetPackageRoot>
22+
<SnowDesktopNuGetPackageRoot Condition="'$(SnowDesktopNuGetPackageRoot)' == '' and '$(NUGET_PACKAGES)' != ''">$(NUGET_PACKAGES)</SnowDesktopNuGetPackageRoot>
23+
<SnowDesktopNuGetPackageRoot Condition="'$(SnowDesktopNuGetPackageRoot)' == ''">$(UserProfile)\.nuget\packages</SnowDesktopNuGetPackageRoot>
2024
</PropertyGroup>
2125

2226
<!-- Windows App SDK self-contained C++ applications use the hybrid CRT:
@@ -190,6 +194,6 @@
190194
Lines="@(MicrosoftWindowsAppSDKAppxFragmentFiles)"
191195
Overwrite="true"
192196
Encoding="UTF-8" />
193-
<Exec Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -File &quot;$(SnowDesktopSourceDirectory)\scripts\write_deployment_manifest.ps1&quot; -TargetDirectory &quot;$(TargetDir).&quot; -FileList &quot;$(IntDir)SnowDesktop.deployment.items&quot; -FragmentList &quot;$(IntDir)SnowDesktop.appxfragments.items&quot; -WindowsAppSdkVersion &quot;$(SnowDesktopWindowsAppSdkPackageVersion)&quot; -CppWinRtVersion &quot;$(SnowDesktopCppWinRtPackageVersion)&quot; -WindowsAppSdkLicensePath &quot;$(NuGetPackageRoot)microsoft.windowsappsdk\$(SnowDesktopWindowsAppSdkPackageVersion)\license.txt&quot; -WindowsAppSdkNoticePath &quot;$(NuGetPackageRoot)microsoft.windowsappsdk\$(SnowDesktopWindowsAppSdkPackageVersion)\NOTICE.txt&quot; -CppWinRtLicensePath &quot;$(NuGetPackageRoot)microsoft.windows.cppwinrt\$(SnowDesktopCppWinRtPackageVersion)\LICENSE&quot; -WindowsMlLicensePath &quot;$(_WindowsMLLocalNativePath)\..\..\..\license.txt&quot; -WindowsMlNoticePath &quot;$(_WindowsMLLocalNativePath)\..\..\..\ThirdPartyNotices.txt&quot; -WebView2LicensePath &quot;$(PkgMicrosoft_Web_WebView2)\LICENSE.txt&quot; -WebView2NoticePath &quot;$(PkgMicrosoft_Web_WebView2)\NOTICE.txt&quot;" />
197+
<Exec Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -File &quot;$(SnowDesktopSourceDirectory)\scripts\write_deployment_manifest.ps1&quot; -TargetDirectory &quot;$(TargetDir).&quot; -FileList &quot;$(IntDir)SnowDesktop.deployment.items&quot; -FragmentList &quot;$(IntDir)SnowDesktop.appxfragments.items&quot; -WindowsAppSdkVersion &quot;$(SnowDesktopWindowsAppSdkPackageVersion)&quot; -CppWinRtVersion &quot;$(SnowDesktopCppWinRtPackageVersion)&quot; -WindowsAppSdkLicensePath &quot;$(SnowDesktopNuGetPackageRoot)\microsoft.windowsappsdk\$(SnowDesktopWindowsAppSdkPackageVersion)\license.txt&quot; -WindowsAppSdkNoticePath &quot;$(SnowDesktopNuGetPackageRoot)\microsoft.windowsappsdk\$(SnowDesktopWindowsAppSdkPackageVersion)\NOTICE.txt&quot; -CppWinRtLicensePath &quot;$(SnowDesktopNuGetPackageRoot)\microsoft.windows.cppwinrt\$(SnowDesktopCppWinRtPackageVersion)\LICENSE&quot; -WindowsMlLicensePath &quot;$(_WindowsMLLocalNativePath)\..\..\..\license.txt&quot; -WindowsMlNoticePath &quot;$(_WindowsMLLocalNativePath)\..\..\..\ThirdPartyNotices.txt&quot; -WebView2LicensePath &quot;$(PkgMicrosoft_Web_WebView2)\LICENSE.txt&quot; -WebView2NoticePath &quot;$(PkgMicrosoft_Web_WebView2)\NOTICE.txt&quot;" />
194198
</Target>
195199
</Project>

‎tests/deployment_packaging_contract_tests.cpp‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,32 @@ void TestPinnedToolchain(const std::string& cmake,
4545
std::string::npos &&
4646
shellViewProps.find("$(NuGetPackageRoot)") !=
4747
std::string::npos &&
48+
shellViewProps.find("$(RestorePackagesPath)") !=
49+
std::string::npos &&
50+
shellViewProps.find("$(NUGET_PACKAGES)") !=
51+
std::string::npos &&
52+
shellViewProps.find("$(UserProfile)\\.nuget\\packages") !=
53+
std::string::npos &&
4854
shellViewProps.find("SnowDesktopCppWinRTExecutable") !=
55+
std::string::npos &&
56+
shellViewProps.find("$(CppWinRTPackageDir)") ==
4957
std::string::npos,
50-
"clean builds resolve the pinned ShellView C++/WinRT generator from NuGet");
58+
"clean builds resolve the pinned ShellView C++/WinRT generator from explicit and default NuGet roots");
5159
}
5260

5361
void TestBuildManifest(const std::string& props,
5462
const std::string& writer)
5563
{
64+
Check(props.find("$(NuGetPackageRoot)") != std::string::npos &&
65+
props.find("$(RestorePackagesPath)") != std::string::npos &&
66+
props.find("$(NUGET_PACKAGES)") != std::string::npos &&
67+
props.find("$(UserProfile)\\.nuget\\packages") !=
68+
std::string::npos &&
69+
props.find("$(SnowDesktopNuGetPackageRoot)\\microsoft.windowsappsdk") !=
70+
std::string::npos &&
71+
props.find("$(SnowDesktopNuGetPackageRoot)\\microsoft.windows.cppwinrt") !=
72+
std::string::npos,
73+
"deployment licenses resolve from explicit and default NuGet roots");
5674
for (const char* item : {
5775
"@(MicrosoftWindowsAppSDKFiles)",
5876
"@(MicrosoftWindowsAppSDKFilesRes)",

0 commit comments

Comments
 (0)