| 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 # Rules to generate zipped applications for Dart. | 5 # Rules to generate zipped applications for Dart. |
| 6 # Rules to generate dart-pkg and dart-pkg/packages. | 6 # Rules to generate dart-pkg and dart-pkg/packages. |
| 7 | 7 |
| 8 import("//build/module_args/mojo.gni") | 8 import("//build/module_args/mojo.gni") |
| 9 import("//build/module_args/dart.gni") |
| 9 | 10 |
| 11 # Creates a dartzip package. |
| 10 template("dartzip_package") { | 12 template("dartzip_package") { |
| 11 package_target_name = "$target_name" | 13 package_target_name = "$target_name" |
| 12 package_output = "$target_out_dir/$target_name.dartzip" | 14 package_output = "$target_out_dir/$target_name.dartzip" |
| 13 | 15 |
| 14 if (defined(invoker.uses_pub) && invoker.uses_pub) { | 16 if (defined(invoker.uses_pub) && invoker.uses_pub) { |
| 15 # Repackage all dependencies pulled in via "pub get" in a dartzip file. | 17 # Repackage all dependencies pulled in via "pub get" in a dartzip file. |
| 16 action("${package_target_name}_repackage") { | 18 action("${package_target_name}_repackage") { |
| 17 target_dir = get_label_info(":$target_name", "dir") | 19 target_dir = get_label_info(":$target_name", "dir") |
| 18 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_sdk_root) | 20 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_sdk_root) |
| 19 | 21 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 108 |
| 107 action(target_name) { | 109 action(target_name) { |
| 108 script = | 110 script = |
| 109 rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_sdk_root) | 111 rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_sdk_root) |
| 110 | 112 |
| 111 sources = [ | 113 sources = [ |
| 112 package_output, | 114 package_output, |
| 113 ] | 115 ] |
| 114 | 116 |
| 115 args = [ | 117 args = [ |
| 118 "--dart-sdk", |
| 119 rebase_path(dart_sdk_root), |
| 120 "--dartzip-file", |
| 116 rebase_path(package_output), | 121 rebase_path(package_output), |
| 122 "--stamp-file", |
| 117 rebase_path("$target_gen_dir/${package_target_name}_analyze.stamp"), | 123 rebase_path("$target_gen_dir/${package_target_name}_analyze.stamp"), |
| 118 "--no-hints", | 124 "--no-hints", |
| 119 ] | 125 ] |
| 120 | 126 |
| 121 deps = [ | 127 deps = [ |
| 122 ":${package_target_name}_package", | 128 ":${package_target_name}_package", |
| 123 ] | 129 ] |
| 124 if (defined(invoker.deps)) { | 130 if (defined(invoker.deps)) { |
| 125 deps += invoker.deps | 131 deps += invoker.deps |
| 126 } | 132 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 "--output=$rebase_output", | 210 "--output=$rebase_output", |
| 205 "--line=$line", | 211 "--line=$line", |
| 206 ] | 212 ] |
| 207 } | 213 } |
| 208 } | 214 } |
| 209 | 215 |
| 210 # Creates a gen/dart-pkg/package_name directory containing symlinks to package | 216 # Creates a gen/dart-pkg/package_name directory containing symlinks to package |
| 211 # sources. Also copies any mojom dependencies into lib/mojom. | 217 # sources. Also copies any mojom dependencies into lib/mojom. |
| 212 # | 218 # |
| 213 # sources | 219 # sources |
| 214 # List of sources to include in the package. | 220 # List of non-entrypoint sources to include in the package. |
| 221 # |
| 222 # entrypoints (optional) |
| 223 # List of package entrypoints to pass to the analyzer. If no entry points |
| 224 # are defined, the analyzer is not run. |
| 215 # | 225 # |
| 216 # pkg_dir (optional) | 226 # pkg_dir (optional) |
| 217 # Directory containing the package sources. This overrides sources. | 227 # Directory containing the package sources. This overrides sources and |
| 228 # entrypoints. The analyzer will not be run. |
| 218 # | 229 # |
| 219 # deps (optional) | 230 # deps (optional) |
| 220 # Note: this can only contain mojom targets. | 231 # List of other dart_pkg targets for Dart packages imported by this |
| 232 # dart_pkg, as well as the mojom targets needed by this dart_pkg. |
| 221 # | 233 # |
| 222 # datadeps (optional) | 234 # datadeps (optional) |
| 223 # | 235 # |
| 224 # sdk_ext_directory (optional) | 236 # sdk_ext_directory (optional) |
| 225 # Directory containing sdk-ext .dart sources. | 237 # Directory containing sdk-ext .dart sources. |
| 226 # | 238 # |
| 227 # sdk_ext_files (optional) | 239 # sdk_ext_files (optional) |
| 228 # List of sources to include in sdk-ext. | 240 # List of sources to include in sdk-ext. |
| 229 # | 241 # |
| 230 # sdk_ext_mappings (optional) | 242 # sdk_ext_mappings (optional) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if (defined(invoker.sdk_ext_mappings)) { | 304 if (defined(invoker.sdk_ext_mappings)) { |
| 293 sdk_ext_mappings += invoker.sdk_ext_mappings | 305 sdk_ext_mappings += invoker.sdk_ext_mappings |
| 294 } | 306 } |
| 295 | 307 |
| 296 script = rebase_path("mojo/public/tools/dart_pkg.py", ".", mojo_sdk_root) | 308 script = rebase_path("mojo/public/tools/dart_pkg.py", ".", mojo_sdk_root) |
| 297 outputs = [ | 309 outputs = [ |
| 298 output_dir, | 310 output_dir, |
| 299 stamp_file, | 311 stamp_file, |
| 300 ] | 312 ] |
| 301 | 313 |
| 314 entrypoints = [] |
| 315 if (defined(invoker.entrypoints)) { |
| 316 entrypoints += invoker.entrypoints |
| 317 } |
| 318 |
| 319 sources = [] |
| 302 if (defined(invoker.sources)) { | 320 if (defined(invoker.sources)) { |
| 303 sources = invoker.sources | 321 sources += invoker.sources |
| 304 } else { | 322 } else { |
| 305 assert(defined(invoker.pkg_dir)) | 323 assert(defined(invoker.pkg_dir)) |
| 306 list_script = rebase_path("build/ls.py", ".", mojo_sdk_root) | 324 list_script = rebase_path("build/ls.py", ".", mojo_sdk_root) |
| 307 sources = exec_script(list_script, | 325 sources += exec_script(list_script, |
| 308 [ | 326 [ |
| 309 "--target-directory", | 327 "--target-directory", |
| 310 rebase_path(invoker.pkg_dir), | 328 rebase_path(invoker.pkg_dir), |
| 311 ], | 329 ], |
| 312 "list lines") | 330 "list lines") |
| 313 } | 331 } |
| 314 | 332 |
| 315 inputs = [ | 333 inputs = [ |
| 316 list_mojoms_script, | 334 list_mojoms_script, |
| 317 script, | 335 script, |
| 318 ] + rebase_path(sources) | 336 ] + rebase_path(sources) |
| 319 | 337 |
| 320 args = [ | 338 args = [ |
| 321 "--package-name", | 339 "--package-name", |
| 322 package_name, | 340 package_name, |
| 341 "--dart-sdk", |
| 342 rebase_path(dart_sdk_root), |
| 323 "--gen-directory", | 343 "--gen-directory", |
| 324 rebase_path("$root_gen_dir/dart-gen"), | 344 rebase_path("$root_gen_dir/dart-gen"), |
| 325 "--pkg-directory", | 345 "--pkg-directory", |
| 326 pkg_directory, | 346 pkg_directory, |
| 327 "--package-root", | 347 "--package-root", |
| 328 package_root, | 348 package_root, |
| 329 "--stamp-file", | 349 "--stamp-file", |
| 330 rebase_path(stamp_file), | 350 rebase_path(stamp_file), |
| 331 "--package-sources", | 351 "--package-sources", |
| 332 ] + rebase_path(sources) + [ "--mojom-sources" ] + | 352 ] + rebase_path(sources) + [ "--package-entrypoints" ] + |
| 353 rebase_path(entrypoints) + [ "--mojom-sources" ] + |
| 333 rebase_path(mojom_sources, "", mojo_sdk_root) + | 354 rebase_path(mojom_sources, "", mojo_sdk_root) + |
| 334 [ "--sdk-ext-directories" ] + rebase_path(sdk_ext_directory) + | 355 [ "--sdk-ext-directories" ] + rebase_path(sdk_ext_directory) + |
| 335 [ "--sdk-ext-files" ] + rebase_path(sdk_ext_files) + | 356 [ "--sdk-ext-files" ] + rebase_path(sdk_ext_files) + |
| 336 [ "--sdk-ext-mappings" ] + sdk_ext_mappings | 357 [ "--sdk-ext-mappings" ] + sdk_ext_mappings |
| 337 } | 358 } |
| 338 } | 359 } |
| OLD | NEW |