Fix CPP cleanup

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

@ -100,6 +100,7 @@
Condition=" '@(Protobuf)' != '' "
DependsOnTargets=" Protobuf_BeforeCompile;
Protobuf_ResolvePlatform;
_Protobuf_SetProtoRoot;
_Protobuf_SelectFiles;
Protobuf_PrepareCompile;
_Protobuf_AugmentLanguageCompile;
@ -115,27 +116,33 @@
DependsOnTargets="Protobuf_Compile"
Condition=" '$(Language)' == 'C#' " />
<Target Name="_Protobuf_SelectFiles">
<Target Name="_Protobuf_SetProtoRoot">
<!-- 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. -->
files outside of project directory, use each .proto file's directory as the root
or Protobuf_ProtoRoot if set. -->
<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>
</ItemGroup>
</Target>
<!-- Select files that should be compiled. -->
<Target Name="_Protobuf_SelectFiles">
<ItemGroup>
<!-- Files with explicit metadata. -->
<Protobuf_Compile Include="@(Protobuf->HasMetadata('ProtoRoot'))" />
<!-- In-project files will have ProtoRoot='.'. -->
<Protobuf_Compile Include="@(_Protobuf_NoRootInProject)">
<ProtoRoot>.</ProtoRoot>
</Protobuf_Compile>
<!-- Out-of-project files will have respective ProtoRoot='%(RelativeDir)'. -->
<Protobuf_Compile Include="@(_Protobuf_NoRootElsewhere)">
<ProtoRoot>%(RelativeDir)</ProtoRoot>
</Protobuf_Compile>
<Protobuf_Compile Include="@(Protobuf)" />
<!-- Remove files not for compile. -->
<Protobuf_Compile Remove="@(Protobuf_Compile)" Condition=" '%(ProtoCompile)' != 'true' " />
<!-- Ensure invariant Source=%(Identity). -->
@ -329,6 +336,7 @@
<Target Name="Protobuf_Clean"
Condition=" '@(Protobuf)' != '' "
DependsOnTargets=" Protobuf_BeforeClean;
_Protobuf_SetProtoRoot;
Protobuf_PrepareClean;
_Protobuf_CoreClean;
Protobuf_AfterClean" />

Loading…
Cancel
Save