Use intermediate group Protobuf_Rooted

pull/22895/head
Kraemer, Benjamin 5 years ago
parent eb8c6189ea
commit aae5e4c236
  1. 28
      src/csharp/Grpc.Tools/build/_protobuf/Google.Protobuf.Tools.targets

@ -120,21 +120,23 @@
<!-- Guess .proto root for the files. Whenever the root is set for a file explicitly,
leave it as is. Otherwise, for files under the project directory, set the root
to "." for the project's directory, as it is the current when compiling; for the
files outside of project directory, use each .proto file's directory as the root
or Protobuf_ProtoRoot if set. -->
files outside of project directory, use each .proto file's directory as the root. -->
<FindUnderPath Path="$(MSBuildProjectDirectory)"
Files="@(Protobuf->WithMetadataValue('ProtoRoot',''))">
<Output TaskParameter="InPath" ItemName="_Protobuf_NoRootInProject"/>
<Output TaskParameter="OutOfPath" ItemName="_Protobuf_NoRootElsewhere"/>
</FindUnderPath>
<ItemGroup>
<Protobuf>
<!-- In-project files will have ProtoRoot='.'. -->
<ProtoRoot Condition=" '%(ProtoRoot)' == '' and '@(_Protobuf_NoRootInProject)' != '' ">.</ProtoRoot>
<!-- Out-of-project files will have respective ProtoRoot='%(RelativeDir)'. -->
<ProtoRoot Condition=" '%(ProtoRoot)' == '' and '@(_Protobuf_NoRootElsewhere)' != '' ">%(RelativeDir)</ProtoRoot>
</Protobuf>
<!-- Files with explicit metadata. -->
<Protobuf_Rooted Include="@(Protobuf->HasMetadata('ProtoRoot'))" />
<!-- In-project files will have ProtoRoot='.'. -->
<Protobuf_Rooted Include="@(_Protobuf_NoRootInProject)">
<ProtoRoot>.</ProtoRoot>
</Protobuf_Rooted>
<!-- Out-of-project files will have respective ProtoRoot='%(RelativeDir)'. -->
<Protobuf_Rooted Include="@(_Protobuf_NoRootElsewhere)">
<ProtoRoot>%(RelativeDir)</ProtoRoot>
</Protobuf_Rooted>
</ItemGroup>
</Target>
@ -142,7 +144,7 @@
<Target Name="_Protobuf_SelectFiles">
<ItemGroup>
<!-- Files with explicit metadata. -->
<Protobuf_Compile Include="@(Protobuf)" />
<Protobuf_Compile Include="@(Protobuf_Rooted)" />
<!-- Remove files not for compile. -->
<Protobuf_Compile Remove="@(Protobuf_Compile)" Condition=" '%(ProtoCompile)' != 'true' " />
<!-- Ensure invariant Source=%(Identity). -->
@ -354,15 +356,15 @@
Protobuf_ExpectedOutputs with all possible output. An option is to include
all existing outputs using Include with a wildcard, if you know where to look.
Note this is like Protobuf_PrepareCompile, but uses @(Protobuf) regardless
Note this is like Protobuf_PrepareCompile, but uses @(Protobuf_Rooted) regardless
of the Compile metadata, to remove all possible outputs. Plugins should err
on the side of overextending the Protobuf_ExpectedOutputs here.
All ExpectedOutputs will be removed. -->
<Target Name="Protobuf_PrepareClean" Condition=" '@(Protobuf)' != '' ">
<Target Name="Protobuf_PrepareClean" Condition=" '@(Protobuf_Rooted)' != '' ">
<!-- Predict expected names. -->
<ProtoCompilerOutputs Condition=" '$(Language)' == 'C#' "
Protobuf="@(Protobuf)"
Protobuf="@(Protobuf_Rooted)"
Generator="$(Protobuf_Generator)">
<Output TaskParameter="PossibleOutputs" ItemName="Protobuf_ExpectedOutputs" />
</ProtoCompilerOutputs>

Loading…
Cancel
Save