Skip to content

Commit

Permalink
UseProtoGenerate优化,只在开发环境生成Proto
Browse files Browse the repository at this point in the history
  • Loading branch information
yilei committed Aug 20, 2019
1 parent 0be560b commit e3ae28f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 16 deletions.
10 changes: 7 additions & 3 deletions src/Grpc.Extension/Grpc.Extension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>1.3.2</Version>
<Version>1.3.3</Version>
<Description>一个基于GRPC的简单微服务框架
1.服务注册和发现
2.服务自动负载均衡
Expand All @@ -15,14 +15,18 @@
<Product>Grpc.Extensions</Product>
<Company />
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<AssemblyVersion>1.3.2.0</AssemblyVersion>
<FileVersion>1.3.2.0</FileVersion>
<AssemblyVersion>1.3.3.0</AssemblyVersion>
<FileVersion>1.3.3.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>\Grpc.Extension.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>\Grpc.Extension.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspectCore.Extensions.Reflection" Version="1.0.1" />
<PackageReference Include="Consul" Version="0.7.2.6" />
Expand Down
56 changes: 46 additions & 10 deletions src/Grpc.Extension/Grpc.Extension.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/Grpc.Extension/Internal/ServerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using Grpc.Core;
using Grpc.Core.Interceptors;
Expand Down Expand Up @@ -129,9 +130,9 @@ private ServerBuilder UseGrpcService(IEnumerable<IGrpcService> grpcServices)
/// <returns></returns>
public ServerBuilder UseProtoGenerate(string dir,bool spiltProto = true)
{
#if DEBUG
ProtoGenerator.Gen(dir, spiltProto);
#endif
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
ProtoGenerator.Gen(dir, spiltProto);

return this;
}

Expand Down

0 comments on commit e3ae28f

Please sign in to comment.