Mention how to convert "copies" from gyp to gn in the cookbook. BUG=none Review URL: https://codereview.chromium.org/1683123002 Cr-Original-Commit-Position: refs/heads/master@{#374791} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: bf781415f643cacdb62968ef765f83fa12674ac6
diff --git a/tools/gn/docs/cookbook.md b/tools/gn/docs/cookbook.md index c918d86..c328563 100644 --- a/tools/gn/docs/cookbook.md +++ b/tools/gn/docs/cookbook.md
@@ -64,7 +64,7 @@ args = [ "--la_dee_da" ] } -executable('foo.exe') { +executable("foo.exe") { ... deps = [ ":foo" ] # Depend on the action to make sure it runs. } @@ -73,6 +73,36 @@ Rules in GYP become `action_foreach` in GN which work like actions but iterate over a set of sources. +### Copies + +GYP + +``` +'copies': [ + { + 'destination': '<(PRODUCT_DIR)/', + 'files': [ + '../build/win/dbghelp_xp/dbghelp.dll', + ], + }, +], +``` + +Unlike GYP, where copies are part of a target, GN copies are +separate targets that you then depend on via deps from other targets: + +``` +copy("bar") { + sources = [ "../path/to/secret.dll" ] + outputs = [ "$root_out_dir/{{source_file_part}}" ] +} + +component("base") { + ... + deps = [ "bar" } # Depend on the copy to make sure it runs. +} +``` + ## Platform checking | *GYP* | *GN* |