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

Side by Side Diff: blimp/docs/args.md

Issue 1772213002: Create doc on build arg best practices for Blimp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address doc review recommendations pending larger structure discussion. Created 4 years, 9 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
« no previous file with comments | « no previous file | blimp/docs/build.md » ('j') | blimp/docs/build.md » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Build Arguments
2
3 [Build arguments](../../tools/gn/docs/language.md#Build-arguments)
4 can be passed via the command line or an `args.gn` file to control the build.
5
6 This document addresses the creation of new build arguments for Blimp. See
Dirk Pranke 2016/03/09 01:28:45 Honestly, I'm not sure that you should really have
Jess 2016/03/09 19:14:27 Done. Please let me know your thoughts on the rest
7 [building](build.md) for developer GN args setup.
8
9 ## Best Practices
10
11 ### Scope
12
13 Build arguments should be scoped to a unit of behavior, e.g. enabling a feature.
14 There are historic examples in core code that do not conform (e.g. target_os),
15 but the build team recommends this convention for all new arguments.
Dirk Pranke 2016/03/09 01:28:45 I would probably drop lines 14 and 15. target_os i
Jess 2016/03/09 19:14:27 Done.
16
17 Typically an argument would be declared in an imported file to share it with
18 the subset of the build that could make use of it.
19
20 ### Type
21
22 Arguments support all the
23 [GN language types](../../tools/gn/docs/language.md#Language).
24
25 In the vast majority of cases `boolean` is the preferred type, since most
26 arguments are enabling or disabling features or includes.
27
28 `String`s are typically used for filepaths. They are also used for enumerated
29 options though integers and even sets of `boolean`s are often used instead.
Dirk Pranke 2016/03/09 01:28:45 sets of booleans?
Jess 2016/03/09 19:14:27 Ugh. Bad writing on my part. There was a segment o
30
31 ### Naming conventions
32
33 While there are no hard and fast rules around argument naming there are
34 many common conventions. If you ever want to see the current list of argument
35 names and default values for your current checkout use
36 `gn args out/Debug --list --short`.
37
38 `use_foo` - indicates dependencies or major codepaths to include (e.g.
39 `use_open_ssl`, `use_ozone`, `use_cups`)
40
41 `enable_foo` - indicates feature or tools to be enabled (e.g.
42 `enable_google_now`, `enable_nacl`, `enable_remoting`, `enable_pdf`)
43
44 `disable_foo` - _NOT_ recommended, use `enable_foo` instead with swapped default
45 value
46
47 `is_foo` - usually a global state descriptor (e.g. `is_chrome_branded`,
48 `is_desktop_linux`); poor choice for non-globals
49
50 `foo_use_bar` - prefixes can be used to indicate a limited scope for an argument
51 (e.g. `rtc_use_h264`, `v8_use_snapshot`)
Dirk Pranke 2016/03/09 01:28:45 These three sections (Scope, Type, Naming conventi
Jess 2016/03/09 19:14:27 Done.
52
53 ## Declaring Build Args
54
55 You declare which arguments you accept and specify default values via
56 `declare_args`. See `gn help buildargs` for an overview of how this works.
57 See `gn help declare_args` for specifics on declaring them.
58
59 It is an error to declare a given argument more than once in a given scope, so
60 care should be used in scoping and naming arguments.
61
62 ## Build Args for Behavior
63
64 While build args directly affect build behavior and values they can not be
65 directly referenced in code. This can be handled with an entry in the
66 [defines](../../tools/gn/docs/reference.md#defines_C-preprocessor-defines)
67 set that can then be used in code.
68
69 ## Updating Args Templates
70
71 Blimp has default argument templates for the
72 [`build/args/blimp_client.gn`](../../build/args/blimp_client.gn) and
73 [`build/args/blimp_engine.gn`](../../build/args/blimp_engine.gn).
74
75 If you create a new argument where the default behavior for the rest of chrome
76 does not match the default behavior of typical blimp build,
77 you should update the respective blimp argument template(s).
78
79 See [building](build.md) for using these in a developer GN args setup.
Dirk Pranke 2016/03/09 01:28:45 If you were to get rid of this file, I would keep
Jess 2016/03/09 19:14:27 Done.
OLDNEW
« no previous file with comments | « no previous file | blimp/docs/build.md » ('j') | blimp/docs/build.md » ('J')

Powered by Google App Engine
This is Rietveld 408576698