| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 # Currently paths here are hard coded for convenience in building Mojo/Flutter. | 5 # Currently paths here are hard coded for convenience in building Mojo/Flutter. |
| 6 declare_args() { | 6 declare_args() { |
| 7 # Specify the path to a host compatible version of the Dart SDK. | 7 # Specify the path to a host compatible version of the Dart SDK. |
| 8 # This SDK is used to compile the Observatory frontend sources. | 8 # This SDK is used to compile the Observatory frontend sources. |
| 9 dart_host_sdk = rebase_path("//third_party/dart-sdk/dart-sdk") | 9 dart_host_sdk = rebase_path("//third_party/dart-sdk/dart-sdk") |
| 10 | 10 |
| 11 # Specify the path to a host compatible version of pub. | 11 # Specify the path to a host compatible version of pub. |
| 12 # This is used to compile the Observatory frontend sources. | 12 # This is used to compile the Observatory frontend sources. |
| 13 # |
| 14 # The observatory build tool searches for pub first using this GN arg, then |
| 15 # for the checked-in SDK, and if that doesn't work, it uses the dart_bootstrap |
| 16 # built as part of the build to invoke pub. If this arg is set to a non-empty |
| 17 # string, we assume that there is no need for dart_bootstrap. If it is set to |
| 18 # "", then we assume that there may be a need for dart_bootstrap. |
| 13 dart_host_pub_exe = rebase_path("$dart_host_sdk/bin/pub") | 19 dart_host_pub_exe = rebase_path("$dart_host_sdk/bin/pub") |
| 14 } | 20 } |
| 15 | 21 |
| 22 # Construct arguments to the observatory tool for finding pub. |
| 23 pub_build_deps = [] |
| 24 pub_build_args = [] |
| 25 if (dart_host_pub_exe != "") { |
| 26 pub_build_args = [ |
| 27 "--pub-executable", |
| 28 dart_host_pub_exe, |
| 29 ] |
| 30 } else { |
| 31 pub_build_deps += [ "../bin:dart_bootstrap($host_toolchain)" ] |
| 32 |
| 33 dart_out_dir = |
| 34 get_label_info("../bin:dart_bootstrap($host_toolchain)", "root_out_dir") |
| 35 if (is_win) { |
| 36 dart_bootstrap = rebase_path("$dart_out_dir/dart_bootstrap.exe") |
| 37 } else { |
| 38 dart_bootstrap = rebase_path("$dart_out_dir/dart_bootstrap") |
| 39 } |
| 40 |
| 41 pub_build_args = [ |
| 42 "--sdk=True", |
| 43 "--dart-executable", |
| 44 dart_bootstrap, |
| 45 ] |
| 46 } |
| 47 |
| 48 current_dir = rebase_path(".", "//") |
| 49 |
| 16 # Helper build rules for packaging the Dart observatory resources. | 50 # Helper build rules for packaging the Dart observatory resources. |
| 17 observatory_sources_gypi = | 51 observatory_sources_gypi = |
| 18 exec_script("../../tools/gypi_to_gn.py", | 52 exec_script("../../tools/gypi_to_gn.py", |
| 19 [ rebase_path("../observatory/observatory_sources.gypi") ], | 53 [ rebase_path("../observatory/observatory_sources.gypi") ], |
| 20 "scope", | 54 "scope", |
| 21 [ "../observatory/observatory_sources.gypi" ]) | 55 [ "../observatory/observatory_sources.gypi" ]) |
| 22 | 56 |
| 23 copy("copy_observatory") { | 57 copy("copy_observatory") { |
| 24 sources = rebase_path(observatory_sources_gypi.sources, "", ".") | 58 sources = rebase_path(observatory_sources_gypi.sources, "", ".") |
| 25 outputs = [ | 59 outputs = [ |
| 26 "$root_gen_dir/observatory_copy/{{source_root_relative_dir}}/{{source_file_p
art}}", | 60 "$root_gen_dir/observatory_copy/{{source_root_relative_dir}}/{{source_file_p
art}}", |
| 27 ] | 61 ] |
| 28 } | 62 } |
| 29 | 63 |
| 30 action("write_observatory_pubspec_yaml") { | 64 action("write_observatory_pubspec_yaml") { |
| 31 deps = [ | 65 deps = [ ":copy_observatory" ] + pub_build_deps |
| 32 ":copy_observatory", | |
| 33 ] | |
| 34 | |
| 35 script = "../../tools/observatory_tool.py" | |
| 36 | 66 |
| 37 inputs = [ | 67 inputs = [ |
| 38 rebase_path("pubspec.yaml"), | 68 rebase_path("pubspec.yaml"), |
| 39 ] | 69 ] |
| 40 | 70 |
| 41 current_dir = rebase_path(".", "//") | 71 script = "../../tools/observatory_tool.py" |
| 42 args = [ | 72 args = |
| 43 "--silent=True", | 73 pub_build_args + [ |
| 44 "--pub-executable", | 74 "--silent=True", |
| 45 dart_host_pub_exe, | 75 "--directory", |
| 46 "--directory", | 76 rebase_path("$root_gen_dir/observatory_copy/$current_dir/"), |
| 47 rebase_path("$root_gen_dir/observatory_copy/$current_dir/"), | 77 "--command", |
| 48 "--command", | 78 "rewrite", |
| 49 "rewrite", | 79 rebase_path("../observatory/pubspec.yaml"), |
| 50 rebase_path("../observatory/pubspec.yaml"), | 80 rebase_path("$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml"), |
| 51 rebase_path("$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml"), | 81 "../../third_party/", |
| 52 "../../third_party/", | 82 rebase_path("../../third_party/"), |
| 53 rebase_path("../../third_party/"), | 83 ] |
| 54 ] | |
| 55 | 84 |
| 56 outputs = [ | 85 outputs = [ |
| 57 "$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml", | 86 "$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml", |
| 58 ] | 87 ] |
| 59 } | 88 } |
| 60 | 89 |
| 61 action("copy_observatory_deps") { | 90 action("copy_observatory_deps") { |
| 62 deps = [ | 91 deps = [ ":write_observatory_pubspec_yaml" ] + pub_build_deps |
| 63 ":write_observatory_pubspec_yaml", | 92 |
| 93 inputs = [ |
| 94 "$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml", |
| 64 ] | 95 ] |
| 65 | 96 |
| 66 script = "../../tools/observatory_tool.py" | 97 script = "../../tools/observatory_tool.py" |
| 67 | 98 args = pub_build_args + [ |
| 68 current_dir = rebase_path(".", "//") | 99 "--silent=True", |
| 69 inputs = [ | 100 "--stamp", |
| 70 script, | 101 rebase_path( |
| 71 "$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml", | 102 "$root_gen_dir/observatory_copy/$current_dir/packages.stamp"), |
| 72 ] | 103 "--directory", |
| 73 | 104 rebase_path("$root_gen_dir/observatory_copy/$current_dir/"), |
| 74 args = [ | 105 "--command", |
| 75 "--silent=True", | 106 "get", |
| 76 "--pub-executable", | 107 ] |
| 77 dart_host_pub_exe, | |
| 78 "--stamp", | |
| 79 rebase_path("$root_gen_dir/observatory_copy/$current_dir/packages.stamp"), | |
| 80 "--directory", | |
| 81 rebase_path("$root_gen_dir/observatory_copy/$current_dir/"), | |
| 82 "--command", | |
| 83 "get", | |
| 84 ] | |
| 85 | 108 |
| 86 outputs = [ | 109 outputs = [ |
| 87 "$root_gen_dir/observatory_copy/$current_dir/packages.stamp", | 110 "$root_gen_dir/observatory_copy/$current_dir/packages.stamp", |
| 88 ] | 111 ] |
| 89 } | 112 } |
| 90 | 113 |
| 91 action("pub_build_observatory") { | 114 action("pub_build_observatory") { |
| 92 current_dir = rebase_path(".", "//") | 115 deps = [ |
| 116 ":copy_observatory", |
| 117 ":copy_observatory_deps", |
| 118 ] + pub_build_deps |
| 119 |
| 93 sources = rebase_path(observatory_sources_gypi.sources, | 120 sources = rebase_path(observatory_sources_gypi.sources, |
| 94 "", | 121 "", |
| 95 "$root_gen_dir/observatory_copy/$current_dir") | 122 "$root_gen_dir/observatory_copy/$current_dir") |
| 96 | 123 |
| 97 deps = [ | 124 inputs = |
| 98 ":copy_observatory", | 125 sources + [ "$root_gen_dir/observatory_copy/$current_dir/packages.stamp" ] |
| 99 ":copy_observatory_deps", | |
| 100 ] | |
| 101 | 126 |
| 102 script = "../../tools/observatory_tool.py" | 127 script = "../../tools/observatory_tool.py" |
| 103 | 128 args = pub_build_args + [ |
| 104 inputs = [ | 129 "--silent=True", |
| 105 script, | 130 "--directory", |
| 106 "$root_gen_dir/observatory_copy/$current_dir/packages.stamp", | 131 rebase_path("$root_gen_dir/observatory_copy/$current_dir/"), |
| 107 ] | 132 "--command", |
| 108 inputs += sources | 133 "build", |
| 109 | 134 rebase_path("$root_out_dir/observatory/build"), |
| 110 args = [ | 135 ] |
| 111 "--silent=True", | |
| 112 "--pub-executable", | |
| 113 dart_host_pub_exe, | |
| 114 "--directory", | |
| 115 rebase_path("$root_gen_dir/observatory_copy/$current_dir/"), | |
| 116 "--command", | |
| 117 "build", | |
| 118 rebase_path("$root_out_dir/observatory/build"), | |
| 119 ] | |
| 120 | 136 |
| 121 outputs = [ | 137 outputs = [ |
| 122 "$root_out_dir/observatory/build/web/main.dart.js", | 138 "$root_out_dir/observatory/build/web/main.dart.js", |
| 123 ] | 139 ] |
| 124 } | 140 } |
| 125 | 141 |
| 126 action("deploy_observatory") { | 142 action("deploy_observatory") { |
| 127 deps = [ | 143 deps = [ ":pub_build_observatory" ] + pub_build_deps |
| 128 ":pub_build_observatory", | |
| 129 ] | |
| 130 | 144 |
| 131 script = "../../tools/observatory_tool.py" | 145 script = "../../tools/observatory_tool.py" |
| 132 | 146 |
| 133 inputs = [ | 147 inputs = [ |
| 134 script, | 148 script, |
| 135 "$root_out_dir/observatory/build/web/main.dart.js", | 149 "$root_out_dir/observatory/build/web/main.dart.js", |
| 136 ] | 150 ] |
| 137 | 151 |
| 138 args = [ | 152 args = pub_build_args + [ |
| 139 "--silent=True", | 153 "--silent=True", |
| 140 "--pub-executable", | 154 "--directory", |
| 141 dart_host_pub_exe, | 155 rebase_path("$root_out_dir/observatory"), |
| 142 "--directory", | 156 "--command", |
| 143 rebase_path("$root_out_dir/observatory"), | 157 "deploy", |
| 144 "--command", | 158 ] |
| 145 "deploy", | |
| 146 ] | |
| 147 | 159 |
| 148 outputs = [ | 160 outputs = [ |
| 149 "$root_out_dir/observatory/deployed/web/main.dart.js", | 161 "$root_out_dir/observatory/deployed/web/main.dart.js", |
| 150 ] | 162 ] |
| 151 } | 163 } |
| 152 | 164 |
| 153 template("observatory_archive") { | 165 template("observatory_archive") { |
| 154 assert(defined(invoker.inner_namespace), | 166 assert(defined(invoker.inner_namespace), |
| 155 "Need inner_namespace in $target_name") | 167 "Need inner_namespace in $target_name") |
| 156 assert(defined(invoker.outer_namespace), | 168 assert(defined(invoker.outer_namespace), |
| 157 "Need outer_namespace in $target_name") | 169 "Need outer_namespace in $target_name") |
| 158 enable_compression = false | 170 enable_compression = false |
| 159 if (defined(invoker.compress) && invoker.compress) { | 171 if (defined(invoker.compress) && invoker.compress) { |
| 160 enable_compression = true | 172 enable_compression = true |
| 161 } | 173 } |
| 162 action(target_name) { | 174 action(target_name) { |
| 163 deps = [ | 175 deps = [ |
| 164 ":deploy_observatory", | 176 ":deploy_observatory", |
| 165 ] | 177 ] |
| 166 | 178 |
| 167 script = "../tools/create_archive.py" | |
| 168 | |
| 169 inputs = [ | 179 inputs = [ |
| 170 script, | |
| 171 "$root_out_dir/observatory/deployed/web/main.dart.js", | 180 "$root_out_dir/observatory/deployed/web/main.dart.js", |
| 172 ] | 181 ] |
| 173 | 182 |
| 174 inner_namespace = invoker.inner_namespace | 183 inner_namespace = invoker.inner_namespace |
| 175 outer_namespace = invoker.outer_namespace | 184 outer_namespace = invoker.outer_namespace |
| 176 output_name = target_name | 185 output_name = target_name |
| 186 |
| 187 script = "../tools/create_archive.py" |
| 177 args = [ | 188 args = [ |
| 178 "--output", | 189 "--output", |
| 179 rebase_path("$root_gen_dir/observatory/${output_name}.cc"), | 190 rebase_path("$root_gen_dir/observatory/${output_name}.cc"), |
| 180 "--tar_output", | 191 "--tar_output", |
| 181 rebase_path("$root_gen_dir/observatory/${output_name}.tar"), | 192 rebase_path("$root_gen_dir/observatory/${output_name}.tar"), |
| 182 "--outer_namespace", | 193 "--outer_namespace", |
| 183 outer_namespace, | 194 outer_namespace, |
| 184 "--inner_namespace", | 195 "--inner_namespace", |
| 185 inner_namespace, | 196 inner_namespace, |
| 186 "--name", | 197 "--name", |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 233 |
| 223 source_set("standalone_observatory_archive") { | 234 source_set("standalone_observatory_archive") { |
| 224 deps = [ | 235 deps = [ |
| 225 ":standalone_archive_observatory", | 236 ":standalone_archive_observatory", |
| 226 ] | 237 ] |
| 227 | 238 |
| 228 sources = [ | 239 sources = [ |
| 229 rebase_path("$root_gen_dir/observatory/standalone_archive_observatory.cc"), | 240 rebase_path("$root_gen_dir/observatory/standalone_archive_observatory.cc"), |
| 230 ] | 241 ] |
| 231 } | 242 } |
| OLD | NEW |