The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
David Garcia Quintas a64f38d308 Merge commit '3049460b75ac557348243601896ed68ca8145522' into master-upmerge-v1.3.x 8 years ago
..
src Keep _grpcio_metadata.py in GitHub repo 8 years ago
test/core Put files in a better place 8 years ago
tools trial and error 8 years ago
vsprojects Delete generate_debug_projects.sh 8 years ago
CMakeLists.txt.template Fix for recent cmake failure owing to gmock 8 years ago
Makefile.template Merge pull request #10644 from MakMukhi/master 8 years ago
README.md Added comment for gyp 9 years ago
binding.gyp.template Remove non-libuv code from Node extension 8 years ago
build_config.rb.template Fixed sanity errors 8 years ago
composer.json.template PHP: prepare for 1.2 release 8 years ago
config.m4.template PHP: add ares as deps 8 years ago
gRPC-Core.podspec.template Merge pull request #7771 from y-zeng/cares_buildin 8 years ago
gRPC-ProtoRPC.podspec.template Relieve ios deployment version to 7.0 8 years ago
gRPC-RxLibrary.podspec.template Relieve ios deployment version to 7.0 8 years ago
gRPC.podspec.template Relieve ios deployment version to 7.0 8 years ago
grpc.def.template Cleaning up cruft to properly create a dll file. 9 years ago
grpc.gemspec.template Fix for using gem build/install 8 years ago
package.json.template Node: Don't depend on cares npm package 8 years ago
package.xml.template PHP: prepare for 1.2 release 8 years ago

README.md

Quick justification

We've approached the problem of the build system from a lot of different angles. The main issue was that there isn't a single build system that was going to single handedly cover all of our usage cases.

So instead we decided to work the following way:

  • A build.yaml file at the root is the source of truth for listing all the targets and files needed to build grpc and its tests, as well as a basic system for dependency description.

  • Each project file (Makefile, Visual Studio project files, Bazel's BUILD) is a YAML file used by the build.yaml file to generate the final output file.

This way we can maintain as many project system as we see fit, without having to manually maintain them when we add or remove new code to the repository. Only the structure of the project file is relevant to the template. The actual list of source code and targets isn't.

We currently have template files for GNU Make, Visual Studio 2013, Bazel and gyp (albeit only for Node.js). In the future, we would like to expand to also generate cmake project files, XCode project files, and an Android.mk file allowing to compile gRPC using Android's NDK.

We'll gladly accept contribution that'd create additional project files using that system.

Structure of build.yaml

The build.yaml file has the following structure:

settings:  # global settings, such as version number
  ...
filegroups:  # groups of files that are automatically expanded
  ...
libs:  # list of libraries to build
  ...
target:   # list of targets to build
  ...

The filegroups are helpful to re-use a subset of files in multiple targets. One filegroups entry has the following structure:

- name: "arbitrary string", # the name of the filegroup
  public_headers: # list of public headers defined in that filegroup
  - ...
  headers: # list of headers defined in that filegroup
  - ...
  src: # list of source files defined in that filegroup
  - ...

The libs collection contains the list of all the libraries we describe. Some may be helper libraries for the tests. Some may be installable libraries. Some may be helper libraries for installable binaries.

The targets array contains the list of all the binary targets we describe. Some may be installable binaries.

One libs or targets entry has the following structure (see below for details):

name: "arbitrary string", # the name of the library
build: "build type",      # in which situation we want that library to be
                          # built and potentially installed (see below).
language: "...",          # the language tag; "c" or "c++"
public_headers:           # list of public headers to install
headers:                  # list of headers used by that target
src:                      # list of files to compile
secure: boolean,          # see below
baselib: boolean,         # this is a low level library that has system
                          # dependencies
vs_project_guid: '{...}', # Visual Studio's unique guid for that project
filegroups:               # list of filegroups to merge to that project
                          # note that this will be expanded automatically
deps:                     # list of libraries this target depends on
deps_linkage: "..."       # "static"  or "dynamic". Used by the Makefile only to
                          # determine the way dependencies are linkned. Defaults
                          # to "dynamic".
dll: "..."                # see below.
dll_def: "..."            # Visual Studio's dll definition file.
vs_props:                 # List of property sheets to attach to that project.
vs_config_type: "..."     # DynamicLibrary/StaticLibrary. Used only when
                          # creating a library. Specifies if we're building a
                          # static library or a dll. Use in conjunction with `dll_def`.
vs_packages:              # List of nuget packages this project depends on.

The "build" tag

Currently, the "build" tag have these meanings:

  • "all": library to build on "make all", and install on the system.
  • "protoc": a protoc plugin to build on "make all" and install on the system.
  • "private": a library to only build for tests.
  • "test": a test binary to run on "make test".
  • "tool": a binary to be built upon "make tools".

All of the targets should always be present in the generated project file, if possible and applicable. But the build tag is what should group the targets together in a single build command.

The "secure" tag

This means this target requires OpenSSL one way or another. The values can be "yes", "no" and "check". The default value is "check". It means that the target requires OpenSSL, but that since the target depends on another one that is supposed to also import OpenSSL, the import should then be implicitely transitive. "check" should then only disable that target if OpenSSL hasn't been found or is unavailable.

The "baselib" boolean

This means this is a library that will provide most of the features for gRPC. In particular, if we're locally building OpenSSL, protobuf or zlib, then we should merge OpenSSL, protobuf or zlib inside that library. That effect depends on the "language" tag. OpenSSL and zlib are for "c" libraries, while protobuf is for "c++" ones.

The "dll" tag

Used only by Visual Studio's project files. "true" means the project will be built with both static and dynamic runtimes. "false" means it'll only be built with static runtime. "only" means it'll only be built with the dll runtime.

The "dll_def" tag

Specifies the visual studio's dll definition file. When creating a DLL, you sometimes (not always) need a def file (see grpc.def).

The template system

We're currently using the mako templates renderer. That choice enables us to simply render text files without dragging with us a lot of other features. Feel free to explore the current templates in that directory. The simplest one is probably BUILD.template which is used to create the Bazel project file.

The renderer engine

As mentioned, the renderer is using mako templates, but some glue is needed to process all of that. See the buildgen folder for more details. We're mainly loading the build.json file, and massaging it, in order to get the list of properties we need, into a Python dictionary, that is then passed to the template while rending it.

The plugins

The file build.json itself isn't passed straight to the template files. It is first processed and modified by a few plugins. For example, the filegroups expander is a plugin.

The structure of a plugin is simple. The plugin must defined the function mako_plugin that takes a Python dictionary. That dictionary represents the current state of the build.json contents. The plugin can alter it to whatever feature it needs to add.