Add forward_variables_from() and target() to GN

forward_variables_from is syntactic sugar for:
  if (defined(invoker.foo)) {
    foo = invoker.foo
  }
For a list of variables or for all variables in a scope. I was originally
resisting adding new primitives for this kind of thing, but in some
places (especially the Android build) this is so common that forcing the
more verbose expression seems to be hurting readability.

It will also allow us to make the component and test templates trivial and
more easily up-to-date with new variables.

The target() function allows a target to be defined with a user-defined
type:
  target("source_set", "foo")
is equivalent to:
  source_set("foo")
This makes certain constructs easier to express where previously people were
forced to do excessive code duplication.

Renames mark_used to mark_dest_used in the scope options because I found the
old name confusing when writing this patch.

Review URL: https://codereview.chromium.org/1263053003

Cr-Original-Commit-Position: refs/heads/master@{#341626}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: dc957e1a0229bd9b4764f74707b28672ae7f50bb
15 files changed
tree: 823b7d16097728d147bf93d1e5cbe8d56efea413
  1. tools/