aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorGravatar kkm <kkm@smartaction.com>2018-02-04 17:50:39 -0800
committerGravatar kkm <kkm@smartaction.com>2018-06-21 19:56:23 -0700
commita93e3d275335f3a95f9d2a69da26281d282d46f9 (patch)
tree2722f705539fc13840b8d1f35304ef4b205c545b /templates
parent7a2a8ca4ba2cd505961ac43c656cc0a7a33c7bb0 (diff)
Add Grpc.Tools MsBuild taks assembly, test and scripting
This is a complete set of tooling to build .proto files, with or without gRPC services, in .csproj, both "classic" and SDK flavors, and a bare minimum support for C++ projects. Highlights and omissions: * By default, generated files are placed into project's intermediate directory under obj/, and treated as temporary generated sources. * The projects are highly customizabe thorugh item metadata on Protobuf items. * SDK projects only use Visual Studio new build system, and automatically import XAML property sheets that allow setting per-file properties, such as generated file access, and whether to expect gRPC outputs, from VS properties windows. This possibly requires VS restart after the package is added to solution. Classic projects cannot be extended this way, and only show Protobuf as the possible item; settings are modified by editing the project only. * For C++ projects, only the tool and standard proto import paths are provided, no custom targets yet. This is in the works. * gRPC and Protobuf scripts are separate, and everything is programmed to easily split the Tools package into one for Google.Protobuf and another for Grpc.Tools. This requires tighter coordination between the teams. * The tasks DLL knows about gRPC. I tried to use it to support gRPC in a script-only fashion, but using the tasks results in much cleaner scripts. This is probably how it should remain. * In multitarget projects (multiple frameworks) protoc files are compiled for each target, and also for Debug/Release configuration sepatately. A possible fix is in the works, but requries some MsBuild tooling fixes, so it will take a while. * There are 4 tasks. The "smart" task predicts protoc outputs, and knows things about protoc naming conventions. This supports only C# and C++. The "dumb" task simply invokes protoc in a language-independent way, and supports all languages known to protoc. In the (not very likely) case protoc is used with MsBuild for these languages, instructions for extending the build is provided in build script comments. The other 2 tasks are one to detect current platform and therefore tools paths, and another to read protoc generated dependency file. We use it for C#, but custom project may opt not to use the dependecy files. * 64-bit tools for Windows (protoc and grpc plugin exe) have been removed from package, as Windows is alsways able to run 32-bit executable (and they are smaller and faster, and always preferred when 2G address space is enough).
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/src/csharp/build_packages_dotnetcli.bat.template2
-rwxr-xr-xtemplates/src/csharp/build_packages_dotnetcli.sh.template2
2 files changed, 2 insertions, 2 deletions
diff --git a/templates/src/csharp/build_packages_dotnetcli.bat.template b/templates/src/csharp/build_packages_dotnetcli.bat.template
index 45010fec74..cdadbba44f 100755
--- a/templates/src/csharp/build_packages_dotnetcli.bat.template
+++ b/templates/src/csharp/build_packages_dotnetcli.bat.template
@@ -47,10 +47,10 @@
%%DOTNET% pack --configuration Release Grpc.Auth --output ..\..\..\artifacts || goto :error
%%DOTNET% pack --configuration Release Grpc.HealthCheck --output ..\..\..\artifacts || goto :error
%%DOTNET% pack --configuration Release Grpc.Reflection --output ..\..\..\artifacts || goto :error
+ %%DOTNET% pack --configuration Release Grpc.Tools --output ..\..\..\artifacts || goto :error
%%NUGET% pack Grpc.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts || goto :error
%%NUGET% pack Grpc.Core.NativeDebug.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts
- %%NUGET% pack Grpc.Tools.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts
@rem copy resulting nuget packages to artifacts directory
xcopy /Y /I *.nupkg ..\..\artifacts\ || goto :error
diff --git a/templates/src/csharp/build_packages_dotnetcli.sh.template b/templates/src/csharp/build_packages_dotnetcli.sh.template
index 1172582ebd..5eba62efab 100755
--- a/templates/src/csharp/build_packages_dotnetcli.sh.template
+++ b/templates/src/csharp/build_packages_dotnetcli.sh.template
@@ -46,9 +46,9 @@
dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts
dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts
dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts
+ dotnet pack --configuration Release Grpc.Tools --output ../../../artifacts
nuget pack Grpc.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts
nuget pack Grpc.Core.NativeDebug.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts
- nuget pack Grpc.Tools.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts
(cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg)