github.com/sercand/please@v13.4.0+incompatible/docs/config.html (about) 1 2 <h1>Please config file reference</h1> 3 4 <p>The root of a Please repo is identified by a .plzconfig file. This also has a number of 5 options to control various parts of its behaviour which might be useful to tailor it 6 to your environment.</p> 7 8 <p>Please looks in several locations for these files and builds it up bit by bit. In order 9 (from lowest priority to highest): 10 <ul> 11 <li><code>/etc/plzconfig</code></li> 12 <li><code>~/.please/plzconfig</code></li> 13 <li><code>.plzconfig</code></li> 14 <li><code>.plzconfig_<arch></code> (e.g. .plzconfig_linux_amd64)</li> 15 <li><code>.plzconfig.<profile></code> (if the <code>--profile</code> flag is passed)</li> 16 <li><code>.plzconfig.local</code></li> 17 </ul> 18 One would normally check in <code>.plzconfig</code> (and arch-specific equivalents if needed).<br/> 19 <code>/etc/plzconfig</code> is there to facilitate per-machine config in cases where the repo is often 20 deleted - this is quite common in CI systems.<br/> 21 Finally you normally add <code>.plzconfig.local</code> to .gitignore to allow people to override 22 settings locally if needed.</p> 23 24 <p>The file format is very similar to 25 <a href="https://git-scm.com/docs/git-config#_syntax">Git's config</a>; it's broken into 26 sections by headers in square brackets, and each section contains <code>option = value</code> 27 pairs. Comments start with a semicolon.</p> 28 29 <p>We'll list out the various options by section. The option names are all case-insensitive, 30 the values are of course case sensitive (except in the case of boolean variables which accept 31 various forms of <code>true</code>, <code>false</code>, <code>yes</code>, <code>no</code> etc).<br/> 32 Various parameters can be repeated (they're noted as such below); this means passing them 33 multiple times in their entirety, e.g. 34 <pre><code> 35 buildfilename = BUILD 36 buildfilename = BUCK 37 </code></pre> 38 Comma-separating on the same line won't work.</p> 39 40 <h3>[Please]</h3> 41 42 <ul> 43 <li><b>Version</b><br/> 44 Defines the version of plz that this repo is supposed to use currently. If it's not present 45 or the version matches the currently running version no special action is taken; otherwise 46 if <code>SelfUpdate</code> is set Please will attempt to download an appropriate 47 version, otherwise it will issue a warning and continue.<br/><br/> 48 49 Note that if this is not set, you can run <code>plz update</code> to update to the latest 50 version available on the server.</li> 51 52 <li><b>Location</b><br/> 53 Defines the directory Please is installed into.<br/> 54 Defaults to <code>~/.please</code> but you might want it to be somewhere else if you're 55 installing via another method (e.g. the debs and install script still use <code>/opt/please</code>).</li> 56 57 <li><b>SelfUpdate</b> (bool)<br/> 58 Sets whether plz will attempt to update itself when the version set in the config file is 59 different.</li> 60 61 <li><b>DownloadLocation</b><br/> 62 Defines the location to download Please from when self-updating. Defaults to the Please 63 web server (<code>https://get.please.build</code>), but you can point it to some location of your own if you prefer to keep 64 traffic within your network or use home-grown versions.</li> 65 66 <li><b>Lang</b><br/> 67 Sets the language passed to build rules when building. This can be important for some 68 tools (although hopefully not many) - we've mostly observed it with Sass. 69 Defaults to <code>en_GB.UTF-8</code>.</li> 70 71 <li><b>Nonce</b><br/> 72 This is an arbitrary string that is added to the hash of every build target. It provides 73 a way to force a rebuild of everything when it's changed.<br/> 74 We will bump the default of this whenever we think it's required - although it's been 75 a pretty long time now and we hope that'll continue.</li> 76 77 <li><b>NumThreads</b> (int)<br/> 78 Number of parallel build operations to run.<br/> 79 Is overridden by the equivalent command-line flag, if that's passed. 80 Defaults to the number of CPUs plus two.</li> 81 </ul> 82 83 <h3>[Parse]</h3> 84 85 <ul> 86 <li><b>BuildFileName</b> (repeated string)<br/> 87 Sets the names that Please uses for its build files. Defaults to <code>BUILD</code>.<br/> 88 For clarity the documentation refers to them simply as BUILD files but you could 89 reconfigure them here to be something else.<br/> 90 One case this can be particularly useful is in cases where you have a subdirectory named 91 <code>build</code> on a case-insensitive file system like HFS+.</li> 92 93 <li><b>BlacklistDirs</b> (repeated string)<br/> 94 Directories to blacklist when recursively searching for BUILD files (e.g. when using 95 <code>plz build ...</code> or similar).<br/> 96 This is generally useful when you have large directories within your repo that don't 97 need to be searched, especially things like <code>node_modules</code> that have 98 come from external package managers.</li> 99 100 <li><b>ExperimentalDir</b> (repeated string)<br/> 101 Directory containing experimental code. This is subject to some extra restrictions: 102 <ul> 103 <li>Code in the experimental dir can override normal visibility constraints</li> 104 <li>Code outside the experimental dir can never depend on code inside it</li> 105 <li>Tests are excluded from general detection</li> 106 </ul> 107 </li> 108 109 <li><b>PreloadBuildDefs</b> (repeated string)<br/> 110 Files to preload by the parser before loading any BUILD files.<br/> 111 Since this is done before the first package is parsed they must be files in the 112 repository, they cannot be <code>subinclude()</code> paths.</li> 113 </ul> 114 115 <h3>[Display]</h3> 116 117 <p>Contains options relating to display output. These have no impact on build output.</p> 118 119 <ul> 120 <li><b>UpdateTitle</b> (bool)<br/> 121 Whether to update the window title as things are built. This is off by default because while 122 many Linux shells will reset it afterwards, others won't and it's not ideal for us to leave 123 it messed up.</li> 124 125 <li><b>SystemStats</b> (bool)<br/> 126 Whether or not to show basic system resource usage in the interactive display. 127 Defaults to <code>False</code>.</li> 128 </ul> 129 130 <h3>[Build]</h3> 131 132 <ul> 133 134 <li><b>Arch</b><br/> 135 Architecture to compile for. Defaults to the host architecture.</li> 136 137 <li><b>Timeout</b> (int)<br/> 138 Timeout for build operations, in seconds. Defaults to 600 (ten minutes).</li> 139 140 <li><b>Path</b> (repeated string)<br/> 141 The PATH variable that will be passed to the build processes.<br/> 142 Defaults to <code>/usr/local/bin:/usr/bin:/bin</code> but of course can be modified if 143 you need to get binaries from other locations.</li> 144 145 <li><b>Config</b><br/> 146 The build config to use when one is not chosen on the command line. Defaults to <code>opt</code>.</li> 147 148 <li><b>FallbackConfig</b><br/> 149 The build config to use when one is chosen and a required target does not have 150 one by the same name. Also defaults to <code>opt</code>.</li> 151 152 <li><b>PassEnv</b> (repeated string)<br/> 153 A list of environment variables to pass from the current environment to build rules. For example 154 <code>PassEnv = HTTP_PROXY</code> 155 would copy your HTTP_PROXY environment variable to the build env for any rules.</li> 156 157 <li><b>Sandbox</b> (bool)<br/> 158 Activates sandboxing for individual build actions, which isolates them from network 159 access, IPC and some aspects of the filesystem. Currently only works on Linux. 160 Defaults to <code>False</code>.</li> 161 162 </ul> 163 164 <h3>[Cache]</h3> 165 166 <ul> 167 168 <li><b>Dir</b><br/> 169 Sets the directory to use for the dir cache.<br/> 170 The default is <code>.plz-cache</code>, if set to the empty string the dir cache will 171 be disabled.</li> 172 173 <li><b>DirCacheHighWaterMark</b> (size)<br/> 174 Starts cleaning the directory cache when it is over this number of bytes.<br/> 175 Can also be given with human-readable suffixes like 10G, 200MB etc. 176 Defaults to <code>10GiB</code>.</li> 177 178 <li><b>DirCacheLowWaterMark</b> (size)<br/> 179 When cleaning the directory cache, it's reduced to at most this size. 180 Defaults to <code>8GiB</code>.</li> 181 182 <li><b>HttpUrl</b><br/> 183 Base URL of the HTTP cache.<br/> 184 Not set to anything by default which means the cache will be disabled.</li> 185 186 <li><b>HttpWriteable</b> (bool)<br/> 187 If True this plz instance will write content back to the HTTP cache.<br/> 188 By default it runs in read-only mode.</li> 189 190 <li><b>HttpTimeout</b> (int)<br/> 191 Timeout for operations contacting the HTTP cache, in seconds.</li> 192 193 <li><b>RpcUrl</b><br/> 194 Base URL of the RPC cache.<br/> 195 Not set to anything by default which means the cache will be disabled.</li> 196 197 <li><b>RpcWriteable</b> (bool)<br/> 198 If True this plz instance will write content back to the RPC cache.<br/> 199 By default it runs in read-only mode.</li> 200 201 <li><b>RpcTimeout</b> (int)<br/> 202 Timeout for operations contacting the RPC cache, in seconds.</li> 203 204 <li><b>RpcMaxMsgSize</b> (bytes)<br/> 205 Maximum size of a single message that we'll send to the RPC server.<br/> 206 This should agree with the server's limit, if it's higher the artifacts will be rejected.<br/> 207 The value is given as a byte size so can be suffixed with M, GB, KiB, etc.</li> 208 209 </ul> 210 211 <h3>[Test]</h3> 212 213 <ul> 214 <li><b>Timeout</b> (int)<br/> 215 Sets the default timeout length, in seconds, for any test that isn't explicitly given one. 216 Defaults to 600 (10 minutes).</li> 217 218 <li><b>DefaultContainer</b><br/> 219 Sets the default type of containerisation to use for tests that are given 220 <code>container = True</code>.<br/> 221 Currently the only option is "docker" but we intend to add rkt support at some point.</li> 222 223 <li><b>Sandbox</b> (bool)<br/> 224 Activates sandboxing for individual tests, which isolates them from network 225 access, IPC and some aspects of the filesystem. Currently only works on Linux. 226 Defaults to <code>False</code>.</li> 227 </ul> 228 229 <h3>[Cover]</h3> 230 231 <ul> 232 <li><b>FileExtension</b> (repeated string)<br/> 233 Extensions of files to consider for coverage.<br/> 234 Defaults to <code>.go</code>, <code>.py</code>, <code>.java</code>, 235 <code>.js</code>, <code>.cc</code>, <code>.h</code>, and <code>.c</code>.</li> 236 237 <li><b>ExcludeExtension</b> (repeated string)<br/> 238 Extensions of files to exclude from coverage.<br/> 239 Typically this is for generated code; the default is to exclude protobuf extensions like 240 <code>.pb.go</code>, <code>_pb2.py</code>. 241 Defaults to <code>.pb.go</code>, <code>_pb2.py</code>, <code>.pb.cc</code>, 242 <code>.pb.h</code>, <code>_test.py</code>, <code>_test.go</code>, 243 <code>_pb.go</code>, <code>_bindata.go</code>, and <code>_test_main.cc</code>.</li> 244 </ul> 245 246 <h3>[Metrics]</h3> 247 248 <p>Options related to metric collection. Currently the only metrics implementation pushes 249 to a <a href="https://prometheus.io/">Prometheus</a> 250 <a href="https://github.com/prometheus/pushgateway">pushgateway</a> for collection.</p> 251 252 <ul> 253 <li><b>PushGatewayURL</b><br/> 254 The URL of the pushgateway to send metrics to.</li> 255 256 <li><b>PushFrequency</b> (duration)<br/> 257 The frequency to push statistics at. Defaults to 400ms.</li> 258 259 <li><b>PushTimeout</b> (duration)<br/> 260 The timeout for metric pushes. Defaults to 500ms.</li> 261 262 <li><b>PerTest</b> (bool)<br/> 263 Emit per-test duration metrics. Off by default, they can be very useful but generate 264 larger cardinalities of labels in Prometheus.</li> 265 266 <li><b>PerUser</b> (bool)<br/> 267 Emit per-user metric labels. On by default, but turning it off can reduce the amount of 268 data to be stored.</li> 269 </ul> 270 271 <h3>[CustomMetricLabels]</h3> 272 273 <p>Describes optional labels to attach to metrics.<br/> 274 For technical reasons this is a separate section to the main metrics options.</p> 275 276 <p>These are defined as key-value pairs, where the key is the label attached to the metric 277 and the value is a command to run on the system that defines the value to attach.<br/> 278 Hence these labels are run once at startup and constant across all build targets.</p> 279 280 <p>For example:<br/> 281 <pre><code>branch = git rev-parse --abbrev-ref HEAD</code></pre> 282 to attach the current git branch to all metrics reported.</p> 283 284 <p>In general it's a good idea not to let the cardinality of your labels become too large, 285 so you might want to filter it to only print whether the user is on master or not.</p> 286 287 <h3>[Docker]</h3> 288 289 <p>Options relating to tests that are run inside Docker containers.</p> 290 291 <ul> 292 <li><b>DefaultImage</b><br/> 293 The default image used for any test that doesn't specify another. 294 Defaults to <code>ubuntu:trusty</code>.</li> 295 296 <li><b>AllowLocalFallback</b> (bool)<br/> 297 If True, will attempt to run the test locally if containerised running fails. 298 Defaults to <code>False</code>.</li> 299 300 <li><b>Timeout</b> (int)<br/> 301 Default timeout for Dockerised tests, in seconds. Default is 1200 (twenty minutes).</li> 302 303 <li><b>ResultsTimeout</b> (int)<br/> 304 Timeout to wait when trying to retrieve results from inside the container. Default is 20 seconds.</li> 305 306 <li><b>RemoveTimeout</b> (int)<br/> 307 Timeout to wait when trying to remove a container after running a test. Defaults to 20 seconds.</li> 308 </ul> 309 310 <h3>[Gc]</h3> 311 312 <p>Options relating to use of <code>plz gc</code>.</p> 313 314 <ul> 315 <li><b>Keep</b> (build label)<br/> 316 Marks targets that gc should always keep. Can include meta-targets such as 317 <code>//test/...</code> and <code>//docs:all</code>.</li> 318 <li><b>KeepLabel</b><br/> 319 Defines a target label to be kept; for example, if you set this to <code>go</code>, 320 no Go targets would ever be considered for deletion.</li> 321 </ul> 322 323 <h3>[Go]</h3> 324 325 <p>Properties that affect how the various Go build rules work.</p> 326 327 <ul> 328 <li><b>ImportPath</b><br/> 329 String name of the canonical path of this repository.<br/> 330 This path is used as the prefix of the package name relative to this <code>please</code> build directory. 331 <code>importpath</code> is commonly used to prepend <code>github.com/myorg/myrepo</code> to a project's 332 path.</li> 333 334 <li><b>GoPath</b><br/> 335 If set, will set the GOPATH environment variable appropriately during build actions.</li> 336 337 <li><b>GoTool</b><br/> 338 If set, the binary name to use to invoke Go & its subtools with. 339 Defaults to <code>go</code>.</li> 340 341 <li><b>GoRoot</b><br/> 342 If set, will set the GOROOT environment variable appropriately during build actions.</li> 343 344 <li><b>BuildIDTool</b><br/> 345 Sets the name of the binary to use to replace Go <code>go tool buildid</code>. 346 Defaults to <code>go_buildid_replacer</code>.</li> 347 348 <li><b>TestTool</b><br/> 349 Sets the location of the <code>please_go_test</code> tool that is used to template the test 350 main for <code>go_test</code> rules.</li> 351 352 <li><b>CgoCCTool</b><br/> 353 Sets the location of <code>CC</code> while building <code>cgo_library</code> and <code>cgo_test</code> 354 rules. Defaults to <code>gcc</code></li> 355 356 <li><b>FilterTool</b><br/> 357 Sets the location of the <code>please_go_filter</code> tool that is used to filter source 358 files against build constraints.</li> 359 360 <li><b>DefaultStatic</b> (bool)<br/> 361 Sets Go binaries to default to static linking. Note that enabling this may have negative 362 consequences for some code, including Go's DNS lookup code in the net module.</li> 363 </ul> 364 365 <h3>[Python]</h3> 366 367 <p>Properties that affect how the various Python build rules work.</p> 368 369 <ul> 370 <li><b>PipTool</b><br/> 371 The tool that is invoked during <code>pip_library</code> rules. Defaults to <code>pip3</code>.</li> 372 373 <li><b>PexTool</b><br/> 374 The tool that's invoked to build pexes. Defaults to <code>please_pex</code> in the install directory.</li> 375 376 <li><b>DefaultInterpreter</b><br/> 377 The interpreter used for <code>python_binary</code> and <code>python_test</code> rules when none is 378 specified on the rule itself. Defaults to <code>python3</code> but you could of course set it to 379 <code>pypy</code>.</li> 380 381 <li><b>TestRunner</b><br/> 382 The test runner used to discover & run Python tests; one of <code>unittest</code>, 383 <code>pytest</code> or <code>behave</code>. Defaults to <code>unittest</code>.</li> 384 385 <li><b>ModuleDir</b><br/> 386 Defines a directory containing modules from which they can be imported at the top level.<br/> 387 By default this is empty but by convention we define our <code>pip_library</code> rules in 388 <code>third_party/python</code> and set this appropriately. Hence any of those third-party 389 libraries that try something like <code>import six</code> will have it work as they expect, 390 even though it's actually in a different location within the .pex.</li> 391 392 <li><b>DefaultPipRepo</b><br/> 393 Defines a location for a pip repo to download wheels from.<br/> 394 By default <code>pip_library</code> uses PyPI (although see below on that) but you may well want 395 to use this define another location to upload your own wheels to.<br/> 396 Is overridden by the <code>repo</code> argument to <code>pip_library</code>.</li> 397 398 <li><b>UsePyPI</b> (bool)<br/> 399 Whether or not to use PyPI for <code>pip_library</code> rules or not. Defaults to <code>True</code>, if you 400 disable this you will presumably want to set DefaultPipRepo to use one of your own.<br/> 401 Is overridden by the <code>use_pypi</code> argument to <code>pip_library</code>.</li> 402 403 <li><b>WheelNameScheme</b> (string)<br/> 404 Defines a custom templatized wheel naming scheme.<br/> 405 Templatized variables should be surrounded in curly braces within the scheme, and the available options are: <code>url_base</code>, <code>package_name</code>, and <code>version</code>. The default search pattern is <code>{url_base}/{package_name}-{version}-${{OS}}-${{ARCH}}.whl</code> along with a few common variants.</li> 406 </ul> 407 408 <h3>[Java]</h3> 409 410 <p>Properties that affect how the various Java build rules work.</p> 411 412 <ul> 413 <li><b>JavacTool</b><br/> 414 Defines the tool used for the Java compiler. Defaults to <code>javac</code>.</li> 415 416 <li><b>JlinkTool</b><br/> 417 Defines the tool used for the Java linker. Defaults to <code>jlink</code>.</li> 418 419 <li><b>JavaHome</b><br/> 420 Defines the Java home folder.</li> 421 422 <li><b>JarTool</b><br/> 423 Defines the tool used to build a .jar. Defaults to <code>jar</code>.</li> 424 425 <li><b>JarcatTool</b><br/> 426 Defines the tool used to concatenate .jar files which we use to build the output 427 of <code>java_binary</code> and <code>java_test</code>.Defaults to <code>jarcat</code> 428 in the Please install directory.<br/> 429 Any resemblance to 430 <a href="http://4.bp.blogspot.com/_fzolLOGJOn0/TRkl9BFE_4I/AAAAAAAAEGQ/vxs9pwhDCVA/s1600/Cat-Packed.in.Glass.jpg">this</a> 431 or <a href="http://d104xtrw2rzoau.cloudfront.net/wp-content/uploads/2013/06/15806-cat_stuck_jar_27_8_2012.jpg">this</a> 432 is purr-ly coincidental.</li> 433 434 <li><b>PleaseMavenTool</b><br/> 435 Defines the tool used to fetch information from Maven in <code>maven_jars</code> rules.<br/> 436 Defaults to <code>please_maven</code> in the Please install directory.</li> 437 438 <li><b>DefaultMavenRepo</b><br/> 439 Default location to load artifacts from in maven_jar rules.</li> 440 441 <li><b>JUnitRunner</b><br/> 442 Defines the .jar containing the JUnit runner. This is built into all <code>java_test</code> rules 443 since it's necessary to make JUnit do anything useful.<br/> 444 Defaults to <code>junit_runner.jar</code> in the Please install directory.</li> 445 446 <li><b>DefaultTestPackage</b><br/> 447 The Java classpath to search for functions annotated with <code>@Test</code>.</li> 448 449 <li><b>SourceLevel</b> (int)<br/> 450 The default Java source level when compiling. Defaults to 8.</li> 451 452 <li><b>TargetLevel</b> (int)<br/> 453 The default Java bytecode level to target. Defaults to 8.</li> 454 455 <li><b>ReleaseLevel</b> (int)<br/> 456 The default Java release level when compiling. 457 SourceLevel and TargetLevel are ignored if this is set. 458 Bear in mind that this flag is only supported in Java version 9+.</li> 459 </ul> 460 461 <h3><a name="cpp">[Cpp]</a></h3> 462 463 <p>Properties that affect how the various C++ build rules work.</p> 464 465 <ul> 466 <li><b>CCTool</b><br/> 467 The tool invoked to compile C code. Defaults to <code>gcc</code> but you might 468 want to set it to <code>clang</code>, for example.</li> 469 470 <li><b>CppTool</b><br/> 471 The tool invoked to compile C++ code. Defaults to <code>g++</code> but you might 472 want to set it to <code>clang++</code>, for example.</li> 473 474 <li><b>LdTool</b><br/> 475 The tool invoked to link object files. Defaults to <code>ld</code> but you could 476 also set it to <code>gold</code>, for example.</li> 477 478 <li><b>ArTool</b><br/> 479 The tool invoked to archive static libraries. Defaults to <code>ar</code>.</li> 480 481 <li><b>AsmTool</b><br/> 482 The tool invoked as an assembler. Currently only used on OSX for 483 <code>cc_embed_binary</code> rules and so defaults to <code>nasm</code>.</li> 484 485 <li><b>LinkWithLdTool</b><br/> 486 If true, instructs Please to use the tool set earlier in <code>ldtool</code> 487 to link binaries instead of <code>cctool</code>.<br/> 488 This is an esoteric setting that most people don't want; a vanilla <code>ld</code> 489 will not perform all steps necessary here (you'll get lots of missing symbol messages 490 from having no libc etc). Generally best to leave this disabled.</li> 491 492 <li><b>DefaultOptCflags</b><br/> 493 Compiler flags passed to all C rules during <code>opt</code> builds; 494 these are typically pretty basic things like 495 what language standard you want to target, warning flags, etc.<br/> 496 Defaults to <code>--std=c99 -O3 -DNDEBUG -Wall -Werror</code></li> 497 498 <li><b>DefaultDbgCflags</b><br/> 499 Compiler rules passed to all C rules during <code>dbg</code> builds.<br/> 500 Defaults to <code>--std=c99 -g3 -DDEBUG -Wall -Werror</code>.</li> 501 502 <li><b>DefaultOptCppflags</b><br/> 503 Compiler flags passed to all C++ rules during <code>opt</code> builds; 504 these are typically pretty basic things like 505 what language standard you want to target, warning flags, etc.<br/> 506 Defaults to <code>--std=c++11 -O3 -DNDEBUG -Wall -Werror</code></li> 507 508 <li><b>DefaultDbgCppflags</b><br/> 509 Compiler rules passed to all C++ rules during <code>dbg</code> builds.<br/> 510 Defaults to <code>--std=c++11 -g3 -DDEBUG -Wall -Werror</code>.</li> 511 512 <li><b>DefaultLdFlags</b><br/> 513 Linker flags passed to all C++ rules.<br/> 514 By default this is empty.</li> 515 516 <li><b>DefaultNamespace</b><br/> 517 Namespace passed to all <code>cc_embed_binary</code> rules when not overridden 518 by the <code>namespace</code> argument to that rule.<br/> 519 Not set by default, if you want to use those rules you'll need to set it or 520 pass it explicitly to each one.</li> 521 522 <li><b>Coverage</b><br/> 523 If true (the default), coverage will be available for C and C++ build rules.<br/> 524 This is still a little experimental but should work for GCC. Right now it does 525 <b>not</b> work for Clang (it likely will in Clang 4.0 which will likely support 526 <code>--fprofile-dir</code>) and so this can be useful to disable it.<br/> 527 It's also useful in some cases for CI systems etc if you'd prefer to avoid the overhead, 528 since the tests have to be compiled with extra instrumentation and without optimisation.</li> 529 </ul> 530 531 <h3>[Proto]</h3> 532 533 <p>Properties that affect how the <code>proto_library</code> and 534 <code>grpc_library</code> rules work.</p> 535 536 <p>As noted elsewhere, these rules are fairly complex and do a bunch of things 537 internally, so they correspondingly have a lot of options here.</p> 538 539 <p>Obviously the various gRPC-related properties only apply to <code>grpc_library</code> 540 rules, whereas <code>proto_library</code> rules are affected by all of them.</p> 541 542 <ul> 543 544 <li><b>ProtocTool</b><br/> 545 The binary invoked to compile .proto files. Defaults to <code>protoc</code>.</li> 546 547 <li><b>ProtocGoPlugin</b><br/> 548 The binary passed to protoc as a plugin to generate Go code. Defaults to 549 <code>protoc-gen-go</code>.<br/> 550 We've found this easier to manage with a <code>go_get</code> rule instead 551 though, so you can also pass a build label here. See the Please repo for an example.</li> 552 553 <li><b>GrpcPythonPlugin</b><br/> 554 The plugin invoked to compile Python code for <code>grpc_library</code>.<br/> 555 Defaults to <code>grpc_python_plugin</code>.</li> 556 557 <li><b>GrpcJavaPlugin</b><br/> 558 The plugin invoked to compile Java code for <code>grpc_library</code>.<br/> 559 Defaults to <code>protoc-gen-grpc-java</code>.</li> 560 561 <li><b>Language</b> (repeated string)<br/> 562 Sets the default set of languages that proto rules are built for.<br/> 563 Chosen from the set of {<code>cc</code>, <code>java</code>, <code>go</code>, 564 <code>py</code>}.<br/> 565 Defaults to multiple <code>Language</code> lines, one line for each of 566 the following values: <code>cc</code>, <code>py</code>, <code>java</code>, 567 <code>go</code>, and <code>js</code>.</li> 568 569 <li><b>PythonDep</b><br/> 570 An in-repo dependency that's applied to any Python targets built. 571 Defaults to <code>//third_party/python:protobuf</code>.</li> 572 573 <li><b>JavaDep</b><br/> 574 An in-repo dependency that's applied to any Java targets built. 575 Defaults to <code>//third_party/java:protobuf</code>.</li> 576 577 <li><b>GoDep</b><br/> 578 An in-repo dependency that's applied to any Go targets built. 579 Defaults to <code>//third_party/go:protobuf</code>.</li> 580 581 <li><b>PythonGrpcDep</b><br/> 582 An in-repo dependency that's applied to any Python gRPC targets built. 583 Defaults to <code>//third_party/python:grpc</code>.</li> 584 585 <li><b>JavaGrpcDep</b><br/> 586 An in-repo dependency that's applied to any Java gRPC targets built. 587 Defaults to <code>/third_party/java:grpc-all</code>.</li> 588 589 <li><b>GoGrpcDep</b><br/> 590 An in-repo dependency that's applied to any Go gRPC targets built. 591 Defaults to <code>//third_party/go:grpc</code>.</li> 592 593 </ul> 594 595 <h3>[Licences]</h3> 596 597 <p>Please has a limited ability to detect licences from third-party code. We 598 obviously can't be 100% sure of these due to the complex nature of dependency 599 management formats and the many, many different forms each licence can be 600 described as. Hopefully though this should offer some help in cases where 601 licences can be detected.</p> 602 603 <ul> 604 <li><b>Accept</b> (repeated string)<br/> 605 Licences that are accepted in this repository.<br/> 606 When this is empty licences are ignored. As soon as it's set any licence 607 detected or assigned must be accepted explicitly here.<br/> 608 There's no fuzzy matching, so some package managers (especially PyPI and 609 Maven, but shockingly not npm which rather nicely uses SPDX) will generate 610 a lot of slightly different spellings of the same thing, which will all 611 have to be accepted here. We'd rather that than trying to "cleverly" match 612 them which might result in matching the wrong thing.</li> 613 614 <li><b>Reject</b><br/> 615 Licences that are explicitly rejected in this repository.<br/> 616 An astute observer will notice that this is not very different to just not 617 adding it to the accept section, but it does have the advantage of explicitly 618 documenting things that the team aren't allowed to use.</li> 619 </ul> 620 621 <h3>[Aliases]</h3> 622 623 <p>This section lets you define new commands to run at the command line. These are 624 currently implemented as a simple text-based replacement of the original command 625 which limits some applications, but they can still be very useful.</p> 626 627 <p>They're written with a simple <code>alias = replacement</code> syntax:</p> 628 629 <pre><code> 630 [aliases] 631 deploy = run //deployment:deployer -- 632 </code></pre> 633 634 <p>This would transform <code>plz deploy //src:please</code> into 635 <code>plz run //deployment:deployer -- //src:please</code>.</p> 636 637 <p>You can also do subcommands of aliases, with a slightly different syntax:</p> 638 639 <pre><code> 640 [aliases "deploy"] 641 dev = run //deployment:deployer -- --env=dev 642 prod = run //deployment:deployer -- --env=prod 643 </code></pre> 644 645 <p>These are then invoked as <code>plz deploy dev</code> and 646 <code>plz deploy prod</code> respectively.<br/> 647 Due to the limitations of parsing our config format, you can only have one 648 level of subcommand of aliases.</p> 649 650 <h3>[Alias]</h3> 651 652 <p>This is (unsurprisingly) very similar to the <code>[Aliases]</code> section, but 653 allows more information to be defined against each one. For example:</p> 654 655 <pre><code> 656 [alias "deploy"] 657 cmd = run //deployment:deployer -- 658 subcommand = dev 659 subcommand = prod 660 subcommand = real prod 661 flag = --force 662 flag = -f 663 </code></pre> 664 665 <p>This will tab-complete, taking into account the various sub-commands and flags etc.</p> 666 667 668 <h3>[Bazel]</h3> 669 670 <p>This section defines some settings to help with limited Bazel compatibility.<br/> 671 We don't aspire to be fully compatible and mimic all the semantics of their system, 672 but we hope to ease migration and cross-testing by being able to parse simple repos.</p> 673 674 <p>Currently the only attribute here is <code>compatibility</code>, when that is enabled 675 some aspects of the parser behave a little differently; some of the rule names and flags 676 change, <code>//visibility:public</code> is interpreted specially and WORKSPACE files are 677 parsed to find external dependencies.<p> 678 679 <p>There is a <code>--bazel_compat</code> flag to <code>plz init</code> which sets this 680 on initialising a new repo.</p> 681 682 <p>We don't have a separate setting for it, but switching this on will also allow limited 683 Buck compatibility. Specifically <code>include_defs</code> becomes available and the 684 various C++ rules gain <code>cxx_</code> aliases.</p>