aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Tools/Grpc.Tools.csproj
blob: 8edfb848d72b370a11a8db552fd69b93fd0a92c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="..\Grpc.Core\Version.csproj.include" />

  <PropertyGroup>
    <AssemblyName>Protobuf.MSBuild</AssemblyName>
    <Version>$(GrpcCsharpVersion)</Version>
    <!-- If changing targets, change also paths in Google.Protobuf.Tools.targets. -->
    <TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
  </PropertyGroup>

  <!-- This is copied verbatim from Grpc.Core/Common.csproj.include. Other settings
       in that file conflict with the intent of this build, as it cannot be signed,
       and may not compile Grpc.Core/Version.cs, as that file references constants
       in Grpc.Core.dll.
       TODO(kkm): Refactor imports. -->
  <PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
    <!-- Workaround for https://github.com/dotnet/sdk/issues/335 -->
    <FrameworkPathOverride Condition="Exists('/usr/lib/mono/4.5-api')">/usr/lib/mono/4.5-api</FrameworkPathOverride>
    <FrameworkPathOverride Condition="Exists('/usr/local/lib/mono/4.5-api')">/usr/local/lib/mono/4.5-api</FrameworkPathOverride>
    <FrameworkPathOverride Condition="Exists('/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api')">/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api</FrameworkPathOverride>
  </PropertyGroup>

  <PropertyGroup Label="Asset root folders. TODO(kkm): Change with package separation.">
    <!-- TODO(kkm): Rework whole section when splitting packages.  -->
    <!-- GRPC: ../../third_party/protobuf/src/google/protobuf/  -->
    <!-- GPB:  ../src/google/protobuf/ -->
    <Assets_ProtoInclude>../../../third_party/protobuf/src/google/protobuf/</Assets_ProtoInclude>

    <!-- GPB:  protoc\ -->
    <!-- GRPC: protoc_plugins\protoc_ -->
    <Assets_ProtoCompiler>../protoc_plugins/protoc_</Assets_ProtoCompiler>

    <!-- GRPC: protoc_plugins\ -->
    <Assets_GrpcPlugins>../protoc_plugins/</Assets_GrpcPlugins>
  </PropertyGroup>

  <PropertyGroup>
    <_NetStandard>False</_NetStandard>
    <_NetStandard Condition=" $(TargetFramework.StartsWith('netstandard')) or $(TargetFramework.StartsWith('netcore')) ">True</_NetStandard>

    <!-- So we do not hardcode an exact version into #if's. -->
    <DefineConstants Condition="$(_NetStandard)">$(DefineConstants);NETSTANDARD</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Label="NuGet package definition" Condition=" '$(Configuration)' == 'Release' ">
    <!-- TODO(kkm): Change to "build\" after splitting. -->
    <BuildOutputTargetFolder>build\_protobuf\</BuildOutputTargetFolder>
    <DevelopmentDependency>true</DevelopmentDependency>
    <NoPackageAnalysis>true</NoPackageAnalysis>
    <PackageId>Grpc.Tools</PackageId>
    <Description>gRPC and Protocol Buffer compiler for managed C# and native C++ projects.

Add this package to a project that contains .proto files to be compiled to code.
It contains the compilers, include files and project system integration for gRPC
and Protocol buffer service description files necessary to build them on Windows,
Linux and MacOS. Managed runtime is supplied separately in the Grpc.Core package.</Description>
    <Copyright>Copyright 2018 gRPC authors</Copyright>
    <Authors>gRPC authors</Authors>
    <PackageLicenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</PackageLicenseUrl>
    <PackageProjectUrl>https://github.com/grpc/grpc</PackageProjectUrl>
    <PackageTags>gRPC RPC protocol HTTP/2</PackageTags>
  </PropertyGroup>

  <ItemGroup Label="NuGet package assets">
    <None Pack="true" PackagePath="build\" Include="build\**\*.xml; build\**\*.props; build\**\*.targets;" />

    <!-- Protobuf assets (for Google.Protobuf.Tools) -->
    <_ProtoAssetName Include="any;api;descriptor;duration;empty;field_mask;
                              source_context;struct;timestamp;type;wrappers" />
    <_Asset PackagePath="build/native/include/google/protobuf/" Include="@(_ProtoAssetName->'$(Assets_ProtoInclude)%(Identity).proto')" />

    <!-- TODO(kkm): GPB builds assets into "macosx", GRPC into "macos". -->
    <_Asset PackagePath="build/native/bin/windows/protoc.exe" Include="$(Assets_ProtoCompiler)windows_x86/protoc.exe" />
    <_Asset PackagePath="build/native/bin/linux_x86/protoc" Include="$(Assets_ProtoCompiler)linux_x86/protoc" />
    <_Asset PackagePath="build/native/bin/linux_x64/protoc" Include="$(Assets_ProtoCompiler)linux_x64/protoc" />
    <_Asset PackagePath="build/native/bin/macosx_x86/protoc" Include="$(Assets_ProtoCompiler)macos_x86/protoc" /> <!-- GPB: macosx-->
    <_Asset PackagePath="build/native/bin/macosx_x64/protoc" Include="$(Assets_ProtoCompiler)macos_x64/protoc" /> <!-- GPB: macosx-->

    <!-- gRPC assets (for Grpc.Tools) -->
    <_Asset PackagePath="build/native/bin/windows/grpc_csharp_plugin.exe" Include="$(Assets_GrpcPlugins)protoc_windows_x86/grpc_csharp_plugin.exe" />
    <_Asset PackagePath="build/native/bin/linux_x86/grpc_csharp_plugin" Include="$(Assets_GrpcPlugins)protoc_linux_x86/grpc_csharp_plugin" />
    <_Asset PackagePath="build/native/bin/linux_x64/grpc_csharp_plugin" Include="$(Assets_GrpcPlugins)protoc_linux_x64/grpc_csharp_plugin" />
    <_Asset PackagePath="build/native/bin/macosx_x86/grpc_csharp_plugin" Include="$(Assets_GrpcPlugins)protoc_macos_x86/grpc_csharp_plugin" />
    <_Asset PackagePath="build/native/bin/macosx_x64/grpc_csharp_plugin" Include="$(Assets_GrpcPlugins)protoc_macos_x64/grpc_csharp_plugin" />

    <None Include="@(_Asset)" Pack="true" Visible="false" />
  </ItemGroup>

  <ItemGroup Condition="!$(_NetStandard)">
    <Reference Include="Microsoft.Build.Framework" Pack="false" />
    <Reference Include="Microsoft.Build.Utilities.v4.0" Pack="false" />
  </ItemGroup>

  <ItemGroup Condition="$(_NetStandard)">
    <PackageReference Include="Microsoft.Build.Framework; Microsoft.Build.Utilities.Core" Version="15.6.85" />
    <!--  Set PrivateAssets="All" on all items, even those implicitly added,
          so that they do not become dependencies of this package. -->
    <PackageReference Update="@(PackageReference)" PrivateAssets="All" />
  </ItemGroup>

</Project>