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

Unified Diff: tools/gn/docs/cookbook.md

Issue 1904383002: Tweak "Typical sources and deps modifications" section. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/docs/cookbook.md
diff --git a/tools/gn/docs/cookbook.md b/tools/gn/docs/cookbook.md
index 92bfeb55e1038b96cd552eb69bc44b118e3539d9..cdd6a032b649bba3b4e4479e6abee90ff8cad1c3 100644
--- a/tools/gn/docs/cookbook.md
+++ b/tools/gn/docs/cookbook.md
@@ -122,6 +122,7 @@ component("base") {
'sources': [
'a.cc',
'b.cc',
+ 'c.cc',
],
'dependencies': [
'<(DEPTH)/base/base.gyp:foo',
@@ -149,22 +150,26 @@ component("base") {
```
sources = [
- "a.cc",
- "b.cc",
+ "c.cc",
]
deps = [
"//base:foo",
]
if (is_win) {
- sources -= [ "a.cc" ]
- sources += [ "foo.cc" ]
+ sources += [
+ "b.cc",
+ "foo.cc',
+ ]
deps += [ "//base:bar" ]
} else {
- sources -= [ "b.cc" ]
+ sources += [ "a.cc" ]
}
```
+Note that in GN we prefer to only add files when needed, and don't add all of
+them at first only to remove them later like in gyp.
+
## Variable mappings
### Build configuration
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698