Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/grpc/templates/README.md

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Quick justification
2
3 We've approached the problem of the build system from a lot of different
4 angles. The main issue was that there isn't a single build system that
5 was going to single handedly cover all of our usage cases.
6
7 So instead we decided to work the following way:
8
9 * A `build.yaml` file at the root is the source of truth for listing all the
10 targets and files needed to build grpc and its tests, as well as a basic system
11 for dependency description.
12
13 * Each project file (Makefile, Visual Studio project files, Bazel's BUILD) is
14 a [YAML](http://yaml.org) file used by the `build.yaml` file to generate the
15 final output file.
16
17 This way we can maintain as many project system as we see fit, without having
18 to manually maintain them when we add or remove new code to the repository.
19 Only the structure of the project file is relevant to the template. The actual
20 list of source code and targets isn't.
21
22 We currently have template files for GNU Make, Visual Studio 2013,
23 [Bazel](http://bazel.io) and [gyp](https://gyp.gsrc.io/) (albeit only for
24 Node.js). In the future, we
25 would like to expand to also generate [cmake](https://cmake.org)
26 project files, XCode project files, and an Android.mk file allowing to compile
27 gRPC using Android's NDK.
28
29 We'll gladly accept contribution that'd create additional project files
30 using that system.
31
32 # Structure of `build.yaml`
33
34 The `build.yaml` file has the following structure:
35
36 ```
37 settings: # global settings, such as version number
38 ...
39 filegroups: # groups of files that are automatically expanded
40 ...
41 libs: # list of libraries to build
42 ...
43 target: # list of targets to build
44 ...
45 ```
46
47 The `filegroups` are helpful to re-use a subset of files in multiple targets.
48 One `filegroups` entry has the following structure:
49
50 ```
51 - name: "arbitrary string", # the name of the filegroup
52 public_headers: # list of public headers defined in that filegroup
53 - ...
54 headers: # list of headers defined in that filegroup
55 - ...
56 src: # list of source files defined in that filegroup
57 - ...
58 ```
59
60 The `libs` collection contains the list of all the libraries we describe. Some m ay be
61 helper libraries for the tests. Some may be installable libraries. Some may be
62 helper libraries for installable binaries.
63
64 The `targets` array contains the list of all the binary targets we describe. Som e may
65 be installable binaries.
66
67 One `libs` or `targets` entry has the following structure (see below for
68 details):
69
70 ```
71 name: "arbitrary string", # the name of the library
72 build: "build type", # in which situation we want that library to be
73 # built and potentially installed (see below).
74 language: "...", # the language tag; "c" or "c++"
75 public_headers: # list of public headers to install
76 headers: # list of headers used by that target
77 src: # list of files to compile
78 secure: boolean, # see below
79 baselib: boolean, # this is a low level library that has system
80 # dependencies
81 vs_project_guid: '{...}', # Visual Studio's unique guid for that project
82 filegroups: # list of filegroups to merge to that project
83 # note that this will be expanded automatically
84 deps: # list of libraries this target depends on
85 deps_linkage: "..." # "static" or "dynamic". Used by the Makefile only to
86 # determine the way dependencies are linkned. Defaults
87 # to "dynamic".
88 dll: "..." # see below.
89 dll_def: "..." # Visual Studio's dll definition file.
90 vs_props: # List of property sheets to attach to that project.
91 vs_config_type: "..." # DynamicLibrary/StaticLibrary. Used only when
92 # creating a library. Specifies if we're building a
93 # static library or a dll. Use in conjunction with `dl l_def`.
94 vs_packages: # List of nuget packages this project depends on.
95 ```
96
97 ## The `"build"` tag
98
99 Currently, the "`build`" tag have these meanings:
100
101 * `"all"`: library to build on `"make all"`, and install on the system.
102 * `"protoc"`: a protoc plugin to build on `"make all"` and install on the system .
103 * `"private"`: a library to only build for tests.
104 * `"test"`: a test binary to run on `"make test"`.
105 * `"tool"`: a binary to be built upon `"make tools"`.
106
107 All of the targets should always be present in the generated project file, if
108 possible and applicable. But the build tag is what should group the targets
109 together in a single build command.
110
111
112 ## The `"secure"` tag
113
114 This means this target requires OpenSSL one way or another. The values can be
115 `"yes"`, `"no"` and `"check"`. The default value is `"check"`. It means that
116 the target requires OpenSSL, but that since the target depends on another one
117 that is supposed to also import OpenSSL, the import should then be implicitely
118 transitive. `"check"` should then only disable that target if OpenSSL hasn't
119 been found or is unavailable.
120
121 ## The `"baselib"` boolean
122
123 This means this is a library that will provide most of the features for gRPC.
124 In particular, if we're locally building OpenSSL, protobuf or zlib, then we
125 should merge OpenSSL, protobuf or zlib inside that library. That effect depends
126 on the `"language"` tag. OpenSSL and zlib are for `"c"` libraries, while
127 protobuf is for `"c++"` ones.
128
129 ## The `"dll"` tag
130
131 Used only by Visual Studio's project files. "true" means the project will be
132 built with both static and dynamic runtimes. "false" means it'll only be built
133 with static runtime. "only" means it'll only be built with the dll runtime.
134
135 ## The `"dll_def"` tag
136
137 Specifies the visual studio's dll definition file. When creating a DLL, you
138 sometimes (not always) need a def file (see grpc.def).
139
140
141 # The template system
142
143 We're currently using the [mako templates](http://www.makotemplates.org/)
144 renderer. That choice enables us to simply render text files without dragging
145 with us a lot of other features. Feel free to explore the current templates
146 in that directory. The simplest one is probably [BUILD.template](BUILD.template)
147 which is used to create the [Bazel](http://bazel.io/) project file.
148
149 ## The renderer engine
150
151 As mentioned, the renderer is using [mako templates](http://www.makotemplates.or g/),
152 but some glue is needed to process all of that. See the [buildgen folder](../too ls/buildgen)
153 for more details. We're mainly loading the build.json file, and massaging it,
154 in order to get the list of properties we need, into a Python dictionary, that
155 is then passed to the template while rending it.
156
157 ## The plugins
158
159 The file build.json itself isn't passed straight to the template files. It is
160 first processed and modified by a few plugins. For example, the `filegroups`
161 expander is [a plugin](../tools/buildgen/plugins/expand_filegroups.py).
162
163 The structure of a plugin is simple. The plugin must defined the function
164 `mako_plugin` that takes a Python dictionary. That dictionary represents the
165 current state of the build.json contents. The plugin can alter it to whatever
166 feature it needs to add.
OLDNEW
« no previous file with comments | « third_party/grpc/templates/Makefile.template ('k') | third_party/grpc/templates/binding.gyp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698