| 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 | |
| 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 | |
| 8 # of the public SDK within a client repo. | |
| 9 mojo_root = get_path_info("../..", "abspath") | |
| 10 | |
| 11 # Takes as input a "source_set" that includes dependencies that are relative to | 5 # 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|). | 6 # 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 | 7 # Generates a source_set that has the mojo_sdk_deps added as ordinary deps |
| 14 # rebased to the current directory. | 8 # rebased to the current directory. |
| 15 # By default, restricts the entries that are given in invoker.deps and | 9 # 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 | 10 # 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 | 11 # whitelisted external dependencies. This check can be elided by setting |
| 18 # restrict_external_deps to false in the invoker. DO NOT DO THIS in | 12 # restrict_external_deps to false in the invoker. DO NOT DO THIS in |
| 19 # //mojo/public. | 13 # //mojo/public. |
| 20 # | 14 # |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 # ] | 36 # ] |
| 43 # } | 37 # } |
| 44 # | 38 # |
| 45 template("mojo_sdk_source_set") { | 39 template("mojo_sdk_source_set") { |
| 46 source_set(target_name) { | 40 source_set(target_name) { |
| 47 if (defined(invoker.visibility)) { | 41 if (defined(invoker.visibility)) { |
| 48 visibility = invoker.visibility | 42 visibility = invoker.visibility |
| 49 } else { | 43 } else { |
| 50 visibility = [ "*" ] | 44 visibility = [ "*" ] |
| 51 } | 45 } |
| 52 if (defined(invoker.mojo_sdk_visibility)) { | 46 if (defined(invoker.mojo_edk_visibility)) { |
| 53 foreach(sdk_target, invoker.mojo_sdk_visibility) { | 47 foreach(edk_target, invoker.mojo_edk_visibility) { |
| 54 # Check that the SDK target was not mistakenly given as an absolute | 48 # Check that the EDK target was not mistakenly given as an absolute |
| 55 # path. | 49 # path. |
| 56 assert(get_path_info(sdk_target, "abspath") != sdk_target) | 50 assert(get_path_info(edk_target, "abspath") != edk_target) |
| 57 visibility += [ rebase_path(sdk_target, ".", mojo_root) ] | 51 visibility += [ rebase_path(edk_target, ".", "//third_party/mojo/src") ] |
| 58 } | 52 } |
| 59 } | 53 } |
| 60 | 54 |
| 61 if (defined(invoker.testonly)) { | 55 if (defined(invoker.testonly)) { |
| 62 testonly = invoker.testonly | 56 testonly = invoker.testonly |
| 63 } | 57 } |
| 64 | 58 |
| 65 if (defined(invoker.sources)) { | 59 if (defined(invoker.sources)) { |
| 66 sources = invoker.sources | 60 sources = invoker.sources |
| 67 } | 61 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 foreach(dep, invoker.public_deps) { | 93 foreach(dep, invoker.public_deps) { |
| 100 if (restrict_external_deps) { | 94 if (restrict_external_deps) { |
| 101 # The only deps that are not specified relative to the location of | 95 # The only deps that are not specified relative to the location of |
| 102 # the Mojo SDK should be on targets within the same file or on a | 96 # the Mojo SDK should be on targets within the same file or on a |
| 103 # whitelisted set of external dependencies. | 97 # whitelisted set of external dependencies. |
| 104 assert(get_path_info(dep, "dir") == ".") | 98 assert(get_path_info(dep, "dir") == ".") |
| 105 } | 99 } |
| 106 public_deps += [ dep ] | 100 public_deps += [ dep ] |
| 107 } | 101 } |
| 108 } | 102 } |
| 103 if (defined(invoker.mojo_edk_public_deps)) { |
| 104 foreach(edk_dep, invoker.mojo_edk_public_deps) { |
| 105 # Check that the EDK dep was not mistakenly given as an absolute path. |
| 106 assert(get_path_info(edk_dep, "abspath") != edk_dep) |
| 107 public_deps += [ rebase_path(edk_dep, ".", "//third_party/mojo/src") ] |
| 108 } |
| 109 } |
| 109 if (defined(invoker.mojo_sdk_public_deps)) { | 110 if (defined(invoker.mojo_sdk_public_deps)) { |
| 110 foreach(sdk_dep, invoker.mojo_sdk_public_deps) { | 111 foreach(sdk_dep, invoker.mojo_sdk_public_deps) { |
| 111 # Check that the SDK dep was not mistakenly given as an absolute path. | 112 # Check that the SDK dep was not mistakenly given as an absolute path. |
| 112 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) | 113 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) |
| 113 public_deps += [ rebase_path(sdk_dep, ".", mojo_root) ] | 114 public_deps += [ rebase_path(sdk_dep, ".", "//") ] |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| 117 deps = [] | 118 deps = [] |
| 118 if (defined(invoker.deps)) { | 119 if (defined(invoker.deps)) { |
| 119 foreach(dep, invoker.deps) { | 120 foreach(dep, invoker.deps) { |
| 120 if (restrict_external_deps) { | 121 if (restrict_external_deps) { |
| 121 # The only deps that are not specified relative to the location of | 122 # The only deps that are not specified relative to the location of |
| 122 # the Mojo SDK should be on targets within the same file or on a | 123 # the Mojo SDK should be on targets within the same file or on a |
| 123 # whitelisted set of external dependencies. | 124 # whitelisted set of external dependencies. |
| 124 dep_dir = get_path_info(dep, "dir") | 125 dep_dir = get_path_info(dep, "dir") |
| 125 assert(dep_dir == "." || dep == "//testing/gtest" || | 126 assert(dep_dir == "." || dep == "//testing/gtest" || |
| 126 dep == "//mojo/environment:chromium" || | 127 dep == "//mojo/environment:chromium" || |
| 127 dep == "//mojo/message_pump") | 128 dep == "//mojo/message_pump") |
| 128 } | 129 } |
| 129 deps += [ dep ] | 130 deps += [ dep ] |
| 130 } | 131 } |
| 131 } | 132 } |
| 133 if (defined(invoker.mojo_edk_deps)) { |
| 134 foreach(edk_dep, invoker.mojo_edk_deps) { |
| 135 # Check that the EDK dep was not mistakenly given as an absolute path. |
| 136 assert(get_path_info(edk_dep, "abspath") != edk_dep) |
| 137 deps += [ rebase_path(edk_dep, ".", "//third_party/mojo/src") ] |
| 138 } |
| 139 } |
| 132 if (defined(invoker.mojo_sdk_deps)) { | 140 if (defined(invoker.mojo_sdk_deps)) { |
| 133 foreach(sdk_dep, invoker.mojo_sdk_deps) { | 141 foreach(sdk_dep, invoker.mojo_sdk_deps) { |
| 134 # Check that the SDK dep was not mistakenly given as an absolute path. | 142 # Check that the SDK dep was not mistakenly given as an absolute path. |
| 135 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) | 143 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) |
| 136 deps += [ rebase_path(sdk_dep, ".", mojo_root) ] | 144 deps += [ rebase_path(sdk_dep, ".", "//") ] |
| 137 } | 145 } |
| 138 } | 146 } |
| 139 | 147 |
| 140 data_deps = [] | 148 data_deps = [] |
| 141 if (defined(invoker.data_deps)) { | 149 if (defined(invoker.data_deps)) { |
| 142 data_deps = invoker.data_deps | 150 data_deps = invoker.data_deps |
| 143 } | 151 } |
| 144 } | 152 } |
| 145 } | 153 } |
| OLD | NEW |