Index: third_party/mojo/src/mojo/public/dart/rules.gni |
diff --git a/third_party/mojo/src/mojo/public/dart/rules.gni b/third_party/mojo/src/mojo/public/dart/rules.gni |
index e8d7c7274be59b03a7f21ebfc6465a88281de9cc..56c502a55591a08a9354c7e72ff575a47545d872 100644 |
--- a/third_party/mojo/src/mojo/public/dart/rules.gni |
+++ b/third_party/mojo/src/mojo/public/dart/rules.gni |
@@ -63,28 +63,63 @@ template("dart_packaged_application") { |
mojo_output = "$root_out_dir/" + target_name + ".mojo" |
} |
- action_foreach(package_analyze_sources) { |
- sources = invoker.sources |
- |
+ action(package_analyze_sources) { |
script = rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_root) |
+ sources = [ |
+ package_output, |
+ ] |
+ |
args = [ |
- rebase_path(root_gen_dir), |
- rebase_path("$target_gen_dir/{{source_name_part}}.stamp"), |
- "{{source}}", |
+ rebase_path(package_output), |
+ rebase_path("$target_gen_dir/${target_name}_analyze.stamp"), |
"--no-hints", |
- "--url-mapping=mojo:application,/" + |
- rebase_path("mojo/public/dart/application.dart", "/", mojo_root), |
- "--url-mapping=mojo:bindings,/" + |
- rebase_path("mojo/public/dart/bindings.dart", "/", mojo_root), |
- "--url-mapping=mojo:builtin,/" + |
- rebase_path("mojo/dart/embedder/builtin.dart", "/", mojo_root), |
- "--url-mapping=mojo:core,/" + |
- rebase_path("mojo/public/dart/core.dart", "/", mojo_root), |
+ |
+ # The dart bindings refer to the autogenerated application interface in |
+ # their source code; since that code is then packaged into the image, we |
+ # need to manually resolve these package urls to the autogenerated code. |
+ "--url-mapping=package:mojo/public/interfaces/application/application.mojom.dart,/" + rebase_path( |
+ "mojo/public/interfaces/application/application.mojom.dart", |
+ "/", |
+ root_gen_dir + mojo_root), |
+ "--url-mapping=package:mojo/public/interfaces/application/service_provider.mojom.dart,/" + rebase_path( |
+ "mojo/public/interfaces/application/service_provider.mojom.dart", |
+ "/", |
+ root_gen_dir + mojo_root), |
+ "--url-mapping=package:mojo/public/interfaces/application/shell.mojom.dart,/" + rebase_path( |
+ "mojo/public/interfaces/application/shell.mojom.dart", |
+ "/", |
+ root_gen_dir + mojo_root), |
+ |
+ # If you are trying to use the mojo sdk in another repository, you'll |
+ # probably also need these url mapping overrides. Users are currently |
+ # referring to these files with these third_party/mojo/ URLs. |
+ # |
+ # (This means that we're referring to the same files through two different |
+ # URLs, depending on which part of the system we're referring to them from. |
+ # This is not a good idea.) |
+ "--url-mapping=package:third_party/mojo/src/mojo/public/interfaces/application/application.mojom.dart,/" + rebase_path( |
+ "mojo/public/interfaces/application/application.mojom.dart", |
+ "/", |
+ root_gen_dir + mojo_root), |
+ "--url-mapping=package:third_party/mojo/src/mojo/public/interfaces/application/service_provider.mojom.dart,/" + rebase_path( |
+ "mojo/public/interfaces/application/service_provider.mojom.dart", |
+ "/", |
+ root_gen_dir + mojo_root), |
+ "--url-mapping=package:third_party/mojo/src/mojo/public/interfaces/application/shell.mojom.dart,/" + rebase_path( |
+ "mojo/public/interfaces/application/shell.mojom.dart", |
+ "/", |
+ root_gen_dir + mojo_root), |
] |
+ # Because the standard 'mojo:*' packages depend on the application mojom |
+ # interface, we must depend on their existence, even though we don't depend |
+ # directly on them. |
+ deps = [ |
+ rebase_path("mojo/public/interfaces/application", ".", mojo_root), |
+ ] |
if (defined(invoker.deps)) { |
- deps = invoker.deps |
+ deps += invoker.deps |
} |
if (defined(invoker.datadeps)) { |
@@ -92,7 +127,7 @@ template("dart_packaged_application") { |
} |
outputs = [ |
- "$target_gen_dir/{{source_name_part}}.stamp", |
+ "$target_gen_dir/${target_name}_analyze.stamp", |
] |
} |
@@ -123,9 +158,7 @@ template("dart_packaged_application") { |
] |
deps = [ |
- # TODO(erg): When dartanalyze runs at an acceptable speed, add |
- # ":$package_analyze_sources" as a dependency here and remove the |
- # manual group("check") in the toplevel build file. |
+ ":$package_analyze_sources", |
":$package_name", |
] |
if (defined(invoker.deps)) { |