| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # The absolute path to the directory containing the mojo public SDK (i.e., the | 5 # The absolute path to the directory containing the mojo public SDK (i.e., the |
| 6 # directory containing mojo/public). The build files within the Mojo public | 6 # directory containing mojo/public). The build files within the Mojo public |
| 7 # SDK use this variable to allow themselves to be parameterized by the location | 7 # SDK use this variable to allow themselves to be parameterized by the location |
| 8 # of the public SDK within a client repo. | 8 # of the public SDK within a client repo. |
| 9 mojo_root = get_path_info("../..", "abspath") | 9 mojo_root = get_path_info("../..", "abspath") |
| 10 | 10 |
| 11 # Takes as input a "source_set" that includes dependencies that are relative to | 11 # Takes as input a "source_set" that includes dependencies that are relative to |
| 12 # the parent directory of the Mojo public SDK (given in |mojo_sdk_deps|). | 12 # the parent directory of the Mojo public SDK (given in |mojo_sdk_deps|). |
| 13 # Generates a source_set that has the mojo_sdk_deps added as ordinary deps | 13 # Generates a source_set that has the mojo_sdk_deps added as ordinary deps |
| 14 # rebased to the current directory. | 14 # rebased to the current directory. |
| 15 # By default, restricts the entries that are given in invoker.deps and | 15 # By default, restricts the entries that are given in invoker.deps and |
| 16 # invoker.public_deps to be only within the same file and on a small set of | 16 # invoker.public_deps to be only within the same file and on a small set of |
| 17 # whitelisted external dependencies. This check can be elided by setting | 17 # whitelisted external dependencies. This check can be elided by setting |
| 18 # restrict_external_dependencies to false in the invoker. DO NOT DO THIS in | 18 # restrict_external_dependencies to false in the invoker. DO NOT DO THIS in |
| 19 # //mojo/public. | 19 # //mojo/public. |
| 20 # | 20 # |
| 21 # Example of a mojo_sdk_source_set: | 21 # Example of a mojo_sdk_source_set: |
| 22 # | 22 # |
| 23 # mojo_sdk_source_set("foo") { | 23 # mojo_sdk_source_set("foo") { |
| 24 # sources = [ | 24 # sources = [ |
| 25 # "foo.h", | 25 # "foo.h", |
| 26 # "foo.cc", | 26 # "foo.cc", |
| 27 # ] | 27 # ] |
| 28 # | 28 # |
| 29 # # Same-file deps are specified in the ordinary way. Any external | 29 # # Same-file deps are specified in the ordinary way. Any external |
| 30 # dependencies are specified the same way (although in general there should | 30 # dependencies are specified the same way (although in general there should |
| 31 # be very few of these). | 31 # be very few of these). |
| 32 # deps = [ | 32 # deps = [ |
| 33 # ":bar", | 33 # ":bar", |
| 34 # ] | 34 # ] |
| 35 # | 35 # |
| 36 # # Mojo SDK deps are specified relative to the containing directory of the | 36 # # Mojo SDK deps are specified relative to the containing directory of the |
| 37 # SDK via mojo_sdk_deps. | 37 # SDK via mojo_sdk_deps. |
| 38 # mojo_sdk_deps = [ | 38 # mojo_sdk_deps = [ |
| 39 # "mojo/public/cpp/bindings", | 39 # "mojo/public/cpp/bindings", |
| 40 # "mojo/public/cpp/environment", | 40 # "mojo/public/cpp/environment", |
| 41 # "mojo/public/cpp/system", | 41 # "mojo/public/cpp/system", |
| 42 # ] | 42 # ] |
| 43 # } | 43 # } |
| 44 # | 44 # |
| 45 template("mojo_sdk_source_set") { | 45 template("mojo_sdk_source_set") { |
| 46 source_set(target_name) { | 46 source_set(target_name) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (defined(invoker.sources)) { | 65 if (defined(invoker.sources)) { |
| 66 sources = invoker.sources | 66 sources = invoker.sources |
| 67 } | 67 } |
| 68 | 68 |
| 69 if (defined(invoker.defines)) { | 69 if (defined(invoker.defines)) { |
| 70 defines = invoker.defines | 70 defines = invoker.defines |
| 71 } | 71 } |
| 72 | 72 |
| 73 public_configs = [ | 73 public_configs = |
| 74 rebase_path("mojo/public/build/config:mojo_sdk", ".", mojo_root), | 74 [ rebase_path("mojo/public/build/config:mojo_sdk", ".", mojo_root) ] |
| 75 ] | |
| 76 if (defined(invoker.public_configs)) { | 75 if (defined(invoker.public_configs)) { |
| 77 public_configs += invoker.public_configs | 76 public_configs += invoker.public_configs |
| 78 } | 77 } |
| 79 | 78 |
| 80 if (defined(invoker.configs)) { | 79 if (defined(invoker.configs)) { |
| 81 configs += invoker.configs | 80 configs += invoker.configs |
| 82 } | 81 } |
| 83 | 82 |
| 84 if (defined(invoker.allow_circular_includes_from)) { | 83 if (defined(invoker.allow_circular_includes_from)) { |
| 85 allow_circular_includes_from = invoker.allow_circular_includes_from | 84 allow_circular_includes_from = invoker.allow_circular_includes_from |
| 86 } | 85 } |
| 87 | 86 |
| 88 if (defined(invoker.public_deps) || (defined(invoker.deps))) { | 87 if (defined(invoker.public_deps) || defined(invoker.deps)) { |
| 89 restrict_external_deps = true | 88 restrict_external_deps = true |
| 90 if (defined(invoker.restrict_external_deps)) { | 89 if (defined(invoker.restrict_external_deps)) { |
| 91 restrict_external_deps = invoker.restrict_external_deps | 90 restrict_external_deps = invoker.restrict_external_deps |
| 92 } | 91 } |
| 93 } | 92 } |
| 94 | 93 |
| 95 public_deps = [] | 94 public_deps = [] |
| 96 if (defined(invoker.public_deps)) { | 95 if (defined(invoker.public_deps)) { |
| 97 foreach(dep, invoker.public_deps) { | 96 foreach(dep, invoker.public_deps) { |
| 98 if (restrict_external_deps) { | 97 if (restrict_external_deps) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 127 } | 126 } |
| 128 if (defined(invoker.mojo_sdk_deps)) { | 127 if (defined(invoker.mojo_sdk_deps)) { |
| 129 foreach(sdk_dep, invoker.mojo_sdk_deps) { | 128 foreach(sdk_dep, invoker.mojo_sdk_deps) { |
| 130 # Check that the SDK dep was not mistakenly given as an absolute path. | 129 # Check that the SDK dep was not mistakenly given as an absolute path. |
| 131 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) | 130 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) |
| 132 deps += [ rebase_path(sdk_dep, ".", mojo_root) ] | 131 deps += [ rebase_path(sdk_dep, ".", mojo_root) ] |
| 133 } | 132 } |
| 134 } | 133 } |
| 135 } | 134 } |
| 136 } | 135 } |
| OLD | NEW |