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 python packaged applications for Dart | 5 # Rules to generate python packaged applications for Dart |
6 | 6 |
7 import("../mojo_sdk.gni") | 7 import("../mojo_sdk.gni") |
8 | 8 |
9 template("dart_package") { | 9 template("dart_package") { |
10 action(target_name) { | 10 action(target_name) { |
(...skipping 17 matching lines...) Expand all Loading... |
28 datadeps = invoker.datadeps | 28 datadeps = invoker.datadeps |
29 } | 29 } |
30 | 30 |
31 output = "$target_out_dir/$target_name.dartzip" | 31 output = "$target_out_dir/$target_name.dartzip" |
32 outputs = [ | 32 outputs = [ |
33 output, | 33 output, |
34 ] | 34 ] |
35 | 35 |
36 rebase_base_dir = | 36 rebase_base_dir = |
37 rebase_path(get_label_info(":$target_name", "dir"), root_build_dir) | 37 rebase_path(get_label_info(":$target_name", "dir"), root_build_dir) |
| 38 if (defined(invoker.base_dir)) { |
| 39 rebase_base_dir = invoker.base_dir |
| 40 } |
38 rebase_inputs = rebase_path(inputs, root_build_dir) | 41 rebase_inputs = rebase_path(inputs, root_build_dir) |
39 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir) | 42 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir) |
40 rebase_output = rebase_path(output, root_build_dir) | 43 rebase_output = rebase_path(output, root_build_dir) |
41 args = [ | 44 args = [ |
42 "--base-dir=$rebase_base_dir", | 45 "--base-dir=$rebase_base_dir", |
43 "--inputs=$rebase_inputs", | 46 "--inputs=$rebase_inputs", |
44 "--zip-inputs=$rebase_zip_inputs", | 47 "--zip-inputs=$rebase_zip_inputs", |
45 "--output=$rebase_output", | 48 "--output=$rebase_output", |
46 ] | 49 ] |
47 } | 50 } |
(...skipping 19 matching lines...) Expand all Loading... |
67 script = rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_root) | 70 script = rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_root) |
68 | 71 |
69 sources = [ | 72 sources = [ |
70 package_output, | 73 package_output, |
71 ] | 74 ] |
72 | 75 |
73 args = [ | 76 args = [ |
74 rebase_path(package_output), | 77 rebase_path(package_output), |
75 rebase_path("$target_gen_dir/${target_name}_analyze.stamp"), | 78 rebase_path("$target_gen_dir/${target_name}_analyze.stamp"), |
76 "--no-hints", | 79 "--no-hints", |
77 | |
78 # The dart bindings refer to the autogenerated application interface in | |
79 # their source code; since that code is then packaged into the image, we | |
80 # need to manually resolve these package urls to the autogenerated code. | |
81 "--url-mapping=package:mojo/public/interfaces/application/application.mojo
m.dart,/" + rebase_path( | |
82 "mojo/public/interfaces/application/application.mojom.dart", | |
83 "/", | |
84 root_gen_dir + mojo_root), | |
85 "--url-mapping=package:mojo/public/interfaces/application/service_provider
.mojom.dart,/" + rebase_path( | |
86 "mojo/public/interfaces/application/service_provider.mojom.dart", | |
87 "/", | |
88 root_gen_dir + mojo_root), | |
89 "--url-mapping=package:mojo/public/interfaces/application/shell.mojom.dart
,/" + rebase_path( | |
90 "mojo/public/interfaces/application/shell.mojom.dart", | |
91 "/", | |
92 root_gen_dir + mojo_root), | |
93 | |
94 # If you are trying to use the mojo sdk in another repository, you'll | |
95 # probably also need these url mapping overrides. Users are currently | |
96 # referring to these files with these third_party/mojo/ URLs. | |
97 # | |
98 # (This means that we're referring to the same files through two different | |
99 # URLs, depending on which part of the system we're referring to them from
. | |
100 # This is not a good idea.) | |
101 "--url-mapping=package:third_party/mojo/src/mojo/public/interfaces/applica
tion/application.mojom.dart,/" + rebase_path( | |
102 "mojo/public/interfaces/application/application.mojom.dart", | |
103 "/", | |
104 root_gen_dir + mojo_root), | |
105 "--url-mapping=package:third_party/mojo/src/mojo/public/interfaces/applica
tion/service_provider.mojom.dart,/" + rebase_path( | |
106 "mojo/public/interfaces/application/service_provider.mojom.dart", | |
107 "/", | |
108 root_gen_dir + mojo_root), | |
109 "--url-mapping=package:third_party/mojo/src/mojo/public/interfaces/applica
tion/shell.mojom.dart,/" + rebase_path( | |
110 "mojo/public/interfaces/application/shell.mojom.dart", | |
111 "/", | |
112 root_gen_dir + mojo_root), | |
113 ] | 80 ] |
114 | 81 |
115 # Because the standard 'mojo:*' packages depend on the application mojom | 82 deps = [] |
116 # interface, we must depend on their existence, even though we don't depend | |
117 # directly on them. | |
118 deps = [ | |
119 rebase_path("mojo/public/interfaces/application", ".", mojo_root), | |
120 ] | |
121 if (defined(invoker.deps)) { | 83 if (defined(invoker.deps)) { |
122 deps += invoker.deps | 84 deps += invoker.deps |
123 } | 85 } |
124 | 86 |
125 if (defined(invoker.datadeps)) { | 87 if (defined(invoker.datadeps)) { |
126 datadeps = invoker.datadeps | 88 datadeps = invoker.datadeps |
127 } | 89 } |
128 | 90 |
129 outputs = [ | 91 outputs = [ |
130 "$target_gen_dir/${target_name}_analyze.stamp", | 92 "$target_gen_dir/${target_name}_analyze.stamp", |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 140 |
179 rebase_input = rebase_path(input, root_build_dir) | 141 rebase_input = rebase_path(input, root_build_dir) |
180 rebase_output = rebase_path(output, root_build_dir) | 142 rebase_output = rebase_path(output, root_build_dir) |
181 args = [ | 143 args = [ |
182 "--input=$rebase_input", | 144 "--input=$rebase_input", |
183 "--output=$rebase_output", | 145 "--output=$rebase_output", |
184 "--line=$line", | 146 "--line=$line", |
185 ] | 147 ] |
186 } | 148 } |
187 } | 149 } |
OLD | NEW |