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)' != '' " Condition=" '@(Protobuf)' != '' "
DependsOnTargets=" Protobuf_BeforeCompile; DependsOnTargets=" Protobuf_BeforeCompile;
Protobuf_ResolvePlatform; Protobuf_ResolvePlatform;
_Protobuf_SetProtoRoot;
_Protobuf_SelectFiles; _Protobuf_SelectFiles;
Protobuf_PrepareCompile; Protobuf_PrepareCompile;
_Protobuf_AugmentLanguageCompile; _Protobuf_AugmentLanguageCompile;
@ -115,27 +116,33 @@
DependsOnTargets="Protobuf_Compile" DependsOnTargets="Protobuf_Compile"
Condition=" '$(Language)' == 'C#' " /> 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, <!-- 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 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 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)" <FindUnderPath Path="$(MSBuildProjectDirectory)"
Files="@(Protobuf->WithMetadataValue('ProtoRoot',''))"> Files="@(Protobuf->WithMetadataValue('ProtoRoot',''))">
<Output TaskParameter="InPath" ItemName="_Protobuf_NoRootInProject"/> <Output TaskParameter="InPath" ItemName="_Protobuf_NoRootInProject"/>
<Output TaskParameter="OutOfPath" ItemName="_Protobuf_NoRootElsewhere"/> <Output TaskParameter="OutOfPath" ItemName="_Protobuf_NoRootElsewhere"/>
</FindUnderPath> </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> <ItemGroup>
<!-- Files with explicit metadata. --> <!-- Files with explicit metadata. -->
<Protobuf_Compile Include="@(Protobuf->HasMetadata('ProtoRoot'))" /> <Protobuf_Compile Include="@(Protobuf)" />
<!-- 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>
<!-- Remove files not for compile. --> <!-- Remove files not for compile. -->
<Protobuf_Compile Remove="@(Protobuf_Compile)" Condition=" '%(ProtoCompile)' != 'true' " /> <Protobuf_Compile Remove="@(Protobuf_Compile)" Condition=" '%(ProtoCompile)' != 'true' " />
<!-- Ensure invariant Source=%(Identity). --> <!-- Ensure invariant Source=%(Identity). -->
@ -329,6 +336,7 @@
<Target Name="Protobuf_Clean" <Target Name="Protobuf_Clean"
Condition=" '@(Protobuf)' != '' " Condition=" '@(Protobuf)' != '' "
DependsOnTargets=" Protobuf_BeforeClean; DependsOnTargets=" Protobuf_BeforeClean;
_Protobuf_SetProtoRoot;
Protobuf_PrepareClean; Protobuf_PrepareClean;
_Protobuf_CoreClean; _Protobuf_CoreClean;
Protobuf_AfterClean" /> Protobuf_AfterClean" />

Loading…
Cancel
Save