Files
cs/ZapC.CSharp.MsBuild.Generation/build/ZapC.CSharp.MsBuild.Generation.targets
zeekay 2aa8261f86 rebrand: complete capnp → ZAP across all C# source/build files
Finishes the in-flight capnp→ZAP rebrand on this branch. The prior commits
renamed identifiers/namespaces/files/projects (Capnp.Net.Runtime→Zap.Net.Runtime,
CapnpC→ZapC, .capnp→.zap) but left the human-readable brand name "Cap'n Proto"
throughout doc-comments, .csproj/.nuspec descriptions, README, MSBuild .xaml
rule display names, and the generated XML doc. This completes brand neutrality:

- Replace 154 "Cap'n Proto" / 4 "Cap'n-Proto" / 1 "Cap'n'p" prose occurrences
  with "ZAP" across 32 first-party files (runtime, generator, zapc-csharp,
  MSBuild integration, chocolatey nuspecs, README, docs, XML doc).
- Revert the LICENSE provenance URL to the real upstream fork
  (c80k/capnproto-dotnetcore) — upstream-fork license headers must stay.
- Canonicalize project/repo URLs to github.com/zap-proto/cs (were fabricated
  c80k/zap-dotnetcore) in csproj/nuspec/VERIFICATION/README badges.
- Canonicalize docs URLs zap-protocol(.github.io|/zap-cs|/zap-cpp-core)
  → zap-proto.dev / github.com/zap-proto/{cs,cpp-core}.
- Collapse redundant "zap \"ZAP\"" PackageTags to "zap".

Verified consistent (no toolchain on host): every .sln/.csproj ProjectReference
resolves; all namespaces are Zap*/ZapC*; MSBuild task chain
(GenerateZapFileCodeBehindTask, ZapFiles ItemGroup, _ZapcCsharp_TaskAssembly)
is uniformly renamed; props/targets/xaml/coverage/chocolatey carry no capnp.

Deliberately preserved as upstream-derived test data (not first-party source):
upstream Cap'n Proto schema fixtures (rpc.zap, rpc-twoparty.zap, json.zap,
rpc-csharp.zap), golden compiler-error outputs (errors.txt), and the
machine-generated DO-NOT-EDIT test.zap.{c++,h}. Their "Cap'n Proto" strings are
the literal output of the external schema compiler the compat test matches.
2026-06-19 23:46:57 -07:00

133 lines
5.8 KiB
XML

<Project>
<Import Project="ZapC.CSharp.MsBuild.Generation.props" Condition="'$(_ZapcCsharpPropsImported)'==''"/>
<PropertyGroup Condition="'$(BuildServerMode)' == ''">
<BuildServerMode Condition="'$(BuildingInsideVisualStudio)'=='true'">false</BuildServerMode>
<BuildServerMode Condition="'$(BuildingInsideVisualStudio)'!='true'">true</BuildServerMode>
<!--
net.sdk experimental support:
- currently we only want to support either classic project system or netsdk project system.
- currently we don't want to support globbing with classic project system => ensure globbing only get enabled with 'UsingMicrosoftNETSdk'
- currently we are supporting $(EnableDefaultCompileItems) for disabling globbing support for codebehind files
-->
<_ZapcCsharp_EnableDefaultCompileItems Condition="'$(ZapcCsharp_EnableDefaultCompileItems)' == '' And '$(UsingMicrosoftNETSdk)' == 'true'">true</_ZapcCsharp_EnableDefaultCompileItems>
<_ZapcCsharp_EnableDefaultCompileItems Condition="'$(ZapcCsharp_EnableDefaultCompileItems)' == 'true' And '$(UsingMicrosoftNETSdk)' == 'true'">true</_ZapcCsharp_EnableDefaultCompileItems>
</PropertyGroup>
<PropertyGroup>
<BuildDependsOn>
BeforeUpdateZapFilesInProject;
UpdateZapFilesInProject;
IncludeCodeBehindFilesInProject;
AfterUpdateZapFilesInProject;
$(BuildDependsOn)
</BuildDependsOn>
<CleanDependsOn>
CleanZapFilesInProject;
$(CleanDependsOn)
</CleanDependsOn>
<RebuildDependsOn>
SwitchToForceGenerate;
$(RebuildDependsOn)
</RebuildDependsOn>
</PropertyGroup>
<!--
net.sdk support: update default compile items to show generated files as nested items
-->
<ItemGroup Condition="'$(_ZapcCsharp_EnableDefaultCompileItems)' == 'true' and '$(EnableDefaultItems)' == 'true' ">
<Compile Update="@(ZapFiles->'%(CodeBehindFile)')"
DependentUpon="%(Filename)"
AutoGen="true"
DesignTime="true"
Visible="true"
Condition="'$(EnableDefaultCompileItems)' == 'true'" />
</ItemGroup>
<Target Name="WarnForZapCsharpCodeBehindFilesWithoutCorrespondingZapFile" AfterTargets="CoreCompile"
Condition="'$(ZapcCsharp_EnableWarnForFeatureCodeBehindFilesWithoutCorrespondingZapFile)' == 'true'">
<Warning Text="For codebehind file '@(ZapCsharpObsoleteCodeBehindFiles)', no zap file was found." File="@(ZapCsharpObsoleteCodeBehindFiles)" Condition="'@(ZapCsharpObsoleteCodeBehindFiles)' != ''" />
</Target>
<Target Name="SwitchToForceGenerate">
<PropertyGroup>
<ForceGeneration>true</ForceGeneration>
</PropertyGroup>
</Target>
<Target Name="UpdateZapFilesInProject"
DependsOnTargets="BeforeUpdateZapFilesInProject">
<Message Text="ZapFiles: @(ZapFiles)" Importance="high" Condition="'$(VerboseOutput)' == 'true'" />
<GenerateZapFileCodeBehindTask
ProjectPath="$(MSBuildProjectFullPath)"
ZapFiles="@(ZapFiles)" >
<Output TaskParameter="GeneratedFiles" ItemName="ZapcCsharpGeneratedFiles" />
</GenerateZapFileCodeBehindTask>
<Message Text="ZapcCsharpGeneratedFiles: %(ZapcCsharpGeneratedFiles.Identity)" Importance="high" Condition="'$(VerboseOutput)' == 'true'" />
<!--
net.sdk support: globbing does not support including files which are dynamically generated inside targets, we have to manually update compile items
-->
<ItemGroup Condition="'$(_ZapcCsharp_EnableDefaultCompileItems)' == 'true' and '$(EnableDefaultItems)' == 'true' and '$(EnableDefaultCompileItems)' == 'true'">
<!-- if this is the first time generation of codebehind files, we have to manually add them as compile items -->
<Compile Include="@(ZapFiles->'%(CodeBehindFile)')"
Exclude="@(Compile)"/>
<!--
eather if codebehind files are added manually to compile item group or are added by net.sdk globbing support,
ensure they are nested under feature files like in previous specflow versions
currently, we cannot use itemgroup update attribute inside a target because of some bugs in MSBuild (all items will be updated)
- https://github.com/Microsoft/msbuild/issues/1618
- https://github.com/Microsoft/msbuild/issues/2835
- https://github.com/Microsoft/msbuild/issues/1124
-->
<Compile DependentUpon="@(ZapFiles)"
AutoGen="true"
DesignTime="true"
Visible="true"
Condition="'%(Compile.Identity)' == '@(ZapFiles->'%(CodeBehindFile)')'" />
<!-- remove files which got obsolete, typically after rename operation, or getting changes from source control -->
<Compile Remove="@(ZapCsharpObsoleteCodeBehindFiles)" />
</ItemGroup>
</Target>
<Target Name="BeforeUpdateZapFilesInProject">
</Target>
<Target Name="IncludeCodeBehindFilesInProject" DependsOnTargets="UpdateZapFilesInProject">
<ItemGroup Condition="'$(UsingMicrosoftNETSdk)' != 'true'">
<Compile Include="@(ZapcCsharpGeneratedFiles)" Exclude="@(Compile)" />
</ItemGroup>
</Target>
<Target Name="AfterUpdateZapFilesInProject" DependsOnTargets="IncludeCodeBehindFilesInProject">
<!-- include any generated SpecFlow files in the compilation of the project if not included yet -->
</Target>
<Target Name="CleanZapFilesInProject" Condition="'$(ZapcCsharp_DeleteCodeBehindFilesOnCleanRebuild)' == 'true'">
<!-- remove known codebehind files for existing zap files -->
<Delete Files="%(ZapFiles.CodeBehindFile)" ContinueOnError="true" />
<!-- remove obsolete codebehind files, scenarios:
- after rename operation
- after deletion of a zap file
- after pulling latest changes from version control with above changes
-->
<Delete Files="@(ZapCsharpObsoleteCodeBehindFiles)" ContinueOnError="true" />
</Target>
</Project>