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 import("../public/mojo_sdk.gni") | 5 import("../public/mojo_sdk.gni") |
| 6 import("//testing/test.gni") |
6 | 7 |
7 # A mojo_edk_source_set is a mojo_sdk_source_set that does not restrict | 8 # A mojo_edk_source_set is a mojo_sdk_source_set that does not restrict |
8 # external dependencies and understands the following additional variables, all | 9 # external dependencies and understands the following additional variables, all |
9 # of which admit a list of the relevant elements specified relative to the | 10 # of which admit a list of the relevant elements specified relative to the |
10 # location of the Mojo EDK: | 11 # location of the Mojo EDK: |
11 # mojo_edk_configs | 12 # mojo_edk_configs |
12 # allow_circular_mojo_edk_includes_from | 13 # allow_circular_mojo_edk_includes_from |
13 # mojo_edk_public_deps | 14 # mojo_edk_public_deps |
14 # mojo_edk_deps | 15 # mojo_edk_deps |
15 | 16 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 # The EDK is required to be a sibling of the SDK, so the relative | 90 # The EDK is required to be a sibling of the SDK, so the relative |
90 # dependencies are rewritten in the same way. | 91 # dependencies are rewritten in the same way. |
91 mojo_sdk_deps = invoker.mojo_edk_deps | 92 mojo_sdk_deps = invoker.mojo_edk_deps |
92 } | 93 } |
93 if (defined(invoker.mojo_sdk_deps)) { | 94 if (defined(invoker.mojo_sdk_deps)) { |
94 mojo_sdk_deps += invoker.mojo_sdk_deps | 95 mojo_sdk_deps += invoker.mojo_sdk_deps |
95 } | 96 } |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
| 100 template("mojo_edk_unittests") { |
| 101 test(target_name) { |
| 102 deps = [ |
| 103 rebase_path("mojo/edk/system/test:run_all_unittests", ".", mojo_root), |
| 104 ] |
| 105 if (defined(invoker.sources)) { |
| 106 sources = invoker.sources |
| 107 } |
| 108 if (defined(invoker.deps)) { |
| 109 foreach(dep, invoker.deps) { |
| 110 # The only deps that are not specified relative to the location of the |
| 111 # Mojo EDK should be on targets within the same file or on a whitelisted |
| 112 # set of external dependencies. |
| 113 # TODO(vtl): Get rid of //base dependencies (and stop allowing it). |
| 114 assert(get_path_info(dep, "dir") == "." || dep == "//testing/gtest" || |
| 115 dep == "//base") |
| 116 deps += [ dep ] |
| 117 } |
| 118 } |
| 119 if (defined(invoker.mojo_sdk_deps)) { |
| 120 foreach(sdk_dep, invoker.mojo_sdk_deps) { |
| 121 # Check that the SDK dep was not mistakenly given as an absolute path. |
| 122 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) |
| 123 deps += [ rebase_path(sdk_dep, ".", mojo_root) ] |
| 124 } |
| 125 } |
| 126 if (defined(invoker.mojo_edk_deps)) { |
| 127 foreach(edk_dep, invoker.mojo_edk_deps) { |
| 128 # Check that the EDK dep was not mistakenly given as an absolute path. |
| 129 assert(get_path_info(edk_dep, "abspath") != edk_dep) |
| 130 deps += [ rebase_path(edk_dep, ".", mojo_root) ] |
| 131 } |
| 132 } |
| 133 } |
| 134 } |
| 135 |
| 136 template("mojo_edk_perftests") { |
| 137 test(target_name) { |
| 138 deps = [ |
| 139 rebase_path("mojo/edk/system/test:run_all_perftests", ".", mojo_root), |
| 140 ] |
| 141 if (defined(invoker.sources)) { |
| 142 sources = invoker.sources |
| 143 } |
| 144 if (defined(invoker.deps)) { |
| 145 foreach(dep, invoker.deps) { |
| 146 # The only deps that are not specified relative to the location of the |
| 147 # Mojo EDK should be on targets within the same file or on a whitelisted |
| 148 # set of external dependencies. |
| 149 # TODO(vtl): Get rid of //base dependencies (and stop allowing it). |
| 150 assert(get_path_info(dep, "dir") == "." || dep == "//testing/gtest" || |
| 151 dep == "//base") |
| 152 deps += [ dep ] |
| 153 } |
| 154 } |
| 155 if (defined(invoker.mojo_sdk_deps)) { |
| 156 foreach(sdk_dep, invoker.mojo_sdk_deps) { |
| 157 # Check that the SDK dep was not mistakenly given as an absolute path. |
| 158 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) |
| 159 deps += [ rebase_path(sdk_dep, ".", mojo_root) ] |
| 160 } |
| 161 } |
| 162 if (defined(invoker.mojo_edk_deps)) { |
| 163 foreach(edk_dep, invoker.mojo_edk_deps) { |
| 164 # Check that the EDK dep was not mistakenly given as an absolute path. |
| 165 assert(get_path_info(edk_dep, "abspath") != edk_dep) |
| 166 deps += [ rebase_path(edk_dep, ".", mojo_root) ] |
| 167 } |
| 168 } |
| 169 } |
| 170 } |
| 171 |
99 # Build EDK things with static thread annotation analysis enabled. | 172 # Build EDK things with static thread annotation analysis enabled. |
100 # TODO(vtl): Should we set this at a higher level? | 173 # TODO(vtl): Should we set this at a higher level? |
101 if (is_clang) { | 174 if (is_clang) { |
102 cflags = [ "-Wthread-safety" ] | 175 cflags = [ "-Wthread-safety" ] |
103 } | 176 } |
OLD | NEW |