Let source_target_relative be a valid substitution for bundle_data.

This helps address the situation where one needs to package a bundle not
produced by the build's create_bundle rule, like a third-party
framework, inside another bundle that is produced by the build. If a
bundle_data rule only pointed to the outer directory of that third-party
framework, any changes to the inner components of the bundle would not
trigger a re-copy.

The {{source_target_relative}} is useful because it lets one define a
bundle_data target at the same level as the third-party bundle, list
its entire contents in |sources|, and have the bundle's folder
structure preserved.

With the existing set of valid substitution patterns, a bundle_data
rule would need to be created for each level of folder structure in
the third-party bundle.

Bug: chromium:955936, chromium:608382
Change-Id: I6e32a98ea607fb95d73ec707c7c8e9a39ee1e9d0
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/4860
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Petr Hosek <phosek@google.com>
3 files changed
tree: 7654819d87e6e76515a7ba81daf0f3b052f96cac
  1. .clang-format
  2. .editorconfig
  3. .gitignore
  4. .style.yapf
  8. README.md
  9. base/
  10. build/
  11. docs/
  12. infra/
  13. tools/
  14. util/


GN is a meta-build system that generates build files for Ninja. There is documentation in docs/ and a presentation on it.

Getting started

You can download the latest version of GN binary for Linux, macOS and Windows.

Alternatively, you can build GN from source:

git clone https://gn.googlesource.com/gn
cd gn
python build/gen.py
ninja -C out
# To run tests:

On Windows, it is expected that cl.exe, link.exe, and lib.exe can be found in PATH, so you'll want to run from a Visual Studio command prompt, or similar.

On Linux and Mac, the default compiler is clang++, a recent version is expected to be found in PATH. This can be overridden by setting CC, CXX, and AR.

Reporting bugs

If you find a bug, you can see if it is known or report it in the bug database.

Sending patches

GN uses Gerrit for code review. The short version of how to patch is:

Register at https://gn-review.googlesource.com.

... edit code ...
ninja -C out && out/gn_unittests

Then, to upload a change for review:

git commit
git cl upload --gerrit

When revising a change, use:

git commit --amend
git cl upload --gerrit

which will add the new changes to the existing code review, rather than creating a new one.

We ask that all contributors sign Google's Contributor License Agreement (either individual or corporate as appropriate, select ‘any other Google project’).


You may ask questions and follow along w/ GN‘s development on Chromium’s gn-dev@ Google Group.