summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authoragrieve <agrieve@chromium.org>2015-12-11 04:04:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-11 12:05:33 +0000
commit9f815753bd4c99e2209965cf8ac724aa0803db45 (patch)
tree1cbd2c9b1cd19583b7c4623d70c93c439f34a082 /build
parentd4f02010ab59dc0920e9cde17b7c4c7842da74c2 (diff)
downloadchromium_src-9f815753bd4c99e2209965cf8ac724aa0803db45.zip
chromium_src-9f815753bd4c99e2209965cf8ac724aa0803db45.tar.gz
chromium_src-9f815753bd4c99e2209965cf8ac724aa0803db45.tar.bz2
GN: Add symlink rules for dump_syms, symupload
Creates a symlink.gni helper template to reduce copy / paste. BUG=552040 Review URL: https://codereview.chromium.org/1516533002 Cr-Commit-Position: refs/heads/master@{#364672}
Diffstat (limited to 'build')
-rw-r--r--build/symlink.gni68
1 files changed, 68 insertions, 0 deletions
diff --git a/build/symlink.gni b/build/symlink.gni
new file mode 100644
index 0000000..691128c
--- /dev/null
+++ b/build/symlink.gni
@@ -0,0 +1,68 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Creates a symlink.
+# Args:
+# source: Path to link to.
+# output: Where to create the symlink.
+template("symlink") {
+ action(target_name) {
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "testonly",
+ "visibility",
+ ])
+ outputs = [
+ invoker.output,
+ ]
+ script = "//build/symlink.py"
+ args = [
+ "-f",
+ rebase_path(invoker.source, get_path_info(invoker.output, "dir")),
+ rebase_path(invoker.output, root_build_dir),
+ ]
+ }
+}
+
+# Creates a symlink from root_build_dir/target_name to |binary_label|. This rule
+# is meant to be used within if (current_toolchain == default_toolchain) blocks
+# and point to targets in the non-default toolchain.
+# Note that for executables, using a copy (as opposed to a symlink) does not
+# work when is_component_build=true, since dependent libraries are found via
+# relative location.
+#
+# Args:
+# binary_label: Target that builds the file to symlink to. e.g.:
+# ":foo($host_toolchain)".
+# output: Where to create the symlink (default="$root_out_dir/$target_name")
+#
+# Example:
+# if (current_toolchain == host_toolchain) {
+# executable("foo") { ... }
+# } else if (current_toolchain == default_toolchain) {
+# binary_symlink("foo") {
+# binary_label = ":foo($host_toolchain)"
+# }
+# }
+template("binary_symlink") {
+ symlink(target_name) {
+ forward_variables_from(invoker,
+ [
+ "output",
+ "testonly",
+ "visibility",
+ ])
+ deps = [
+ invoker.binary_label,
+ ]
+
+ _out_dir = get_label_info(invoker.binary_label, "root_out_dir")
+ source = "$_out_dir/" + get_label_info(invoker.binary_label, "name")
+
+ if (!defined(output)) {
+ output = "$root_out_dir/${invoker.target_name}"
+ }
+ }
+}