|
|
|
@rem Copyright 2016 gRPC authors.
|
|
|
|
@rem
|
|
|
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
@rem you may not use this file except in compliance with the License.
|
|
|
|
@rem You may obtain a copy of the License at
|
|
|
|
@rem
|
|
|
|
@rem http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
@rem
|
|
|
|
@rem Unless required by applicable law or agreed to in writing, software
|
|
|
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
@rem See the License for the specific language governing permissions and
|
|
|
|
@rem limitations under the License.
|
|
|
|
|
|
|
|
@rem Current package versions
|
|
|
|
set VERSION=1.18.0-dev
|
|
|
|
|
|
|
|
@rem Adjust the location of nuget.exe
|
|
|
|
set NUGET=C:\nuget\nuget.exe
|
|
|
|
set DOTNET=dotnet
|
|
|
|
|
|
|
|
mkdir ..\..\artifacts
|
|
|
|
|
|
|
|
@rem Collect the artifacts built by the previous build step
|
|
|
|
mkdir nativelibs
|
|
|
|
powershell -Command "cp -r ..\..\input_artifacts\csharp_ext_* nativelibs"
|
|
|
|
|
|
|
|
@rem Collect protoc artifacts built by the previous build step
|
|
|
|
mkdir protoc_plugins
|
|
|
|
powershell -Command "cp -r ..\..\input_artifacts\protoc_* protoc_plugins"
|
|
|
|
|
|
|
|
%DOTNET% restore Grpc.sln || goto :error
|
|
|
|
|
|
|
|
@rem To be able to build, we also need to put grpc_csharp_ext to its normal location
|
|
|
|
xcopy /Y /I nativelibs\csharp_ext_windows_x64\grpc_csharp_ext.dll ..\..\cmake\build\x64\Release\
|
|
|
|
|
|
|
|
%DOTNET% pack --configuration Release Grpc.Core --output ..\..\..\artifacts || goto :error
|
|
|
|
%DOTNET% pack --configuration Release Grpc.Core.Testing --output ..\..\..\artifacts || goto :error
|
|
|
|
%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
|
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).
7 years ago
|
|
|
%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
|
|
|
|
|
|
|
|
@rem copy resulting nuget packages to artifacts directory
|
|
|
|
xcopy /Y /I *.nupkg ..\..\artifacts\ || goto :error
|
|
|
|
|
|
|
|
@rem create a zipfile with the artifacts as well
|
|
|
|
powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('..\..\artifacts', 'csharp_nugets_windows_dotnetcli.zip');"
|
|
|
|
xcopy /Y /I csharp_nugets_windows_dotnetcli.zip ..\..\artifacts\ || goto :error
|
|
|
|
|
|
|
|
goto :EOF
|
|
|
|
|
|
|
|
:error
|
|
|
|
echo Failed!
|
|
|
|
exit /b %errorlevel%
|