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("mojo.gni") | 5 import("mojo.gni") |
6 import("mojo_sdk.gni") | 6 import("mojo_sdk.gni") |
7 | 7 |
8 # Generate a binary mojo application.The parameters of this template are those | 8 # Generate a binary mojo application.The parameters of this template are those |
9 # of a shared library. | 9 # of a shared library. |
10 template("mojo_native_application") { | 10 template("mojo_native_application") { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 if (defined(invoker.lib_dirs)) { | 56 if (defined(invoker.lib_dirs)) { |
57 lib_dirs = invoker.lib_dirs | 57 lib_dirs = invoker.lib_dirs |
58 } | 58 } |
59 if (defined(invoker.libs)) { | 59 if (defined(invoker.libs)) { |
60 libs = invoker.libs | 60 libs = invoker.libs |
61 } | 61 } |
62 | 62 |
63 if (use_prebuilt_mojo_shell) { | 63 if (use_prebuilt_mojo_shell) { |
64 copy_mojo_shell = | 64 copy_mojo_shell = |
65 rebase_path("mojo/public/tools:copy_mojo_shell", ".", mojo_root) | 65 rebase_path("mojo/public/tools:copy_mojo_shell", ".", mojo_root) |
66 } | 66 } |
67 | 67 |
68 # Copy the prebuilt mojo_shell if using it. | 68 # Copy the prebuilt mojo_shell if using it. |
69 if (defined(invoker.datadeps)) { | 69 if (defined(invoker.datadeps)) { |
70 datadeps = invoker.datadeps | 70 datadeps = invoker.datadeps |
71 if (use_prebuilt_mojo_shell) { | 71 if (use_prebuilt_mojo_shell) { |
72 datadeps += [ copy_mojo_shell ] | 72 datadeps += [ copy_mojo_shell ] |
73 } | 73 } |
74 } else { | 74 } else { |
75 if (use_prebuilt_mojo_shell) { | 75 if (use_prebuilt_mojo_shell) { |
76 datadeps = [ copy_mojo_shell ] | 76 datadeps = [ |
| 77 copy_mojo_shell, |
| 78 ] |
77 } | 79 } |
78 } | 80 } |
79 deps = rebase_path([ | 81 deps = rebase_path([ |
80 "mojo/public/c/system:for_shared_library", | 82 "mojo/public/c/system", |
81 ], ".", mojo_root) | 83 "mojo/public/platform/native:system", |
| 84 ], |
| 85 ".", |
| 86 mojo_root) |
82 if (defined(invoker.deps)) { | 87 if (defined(invoker.deps)) { |
83 deps += invoker.deps | 88 deps += invoker.deps |
84 } | 89 } |
85 if (defined(invoker.forward_dependent_configs_from)) { | 90 if (defined(invoker.forward_dependent_configs_from)) { |
86 forward_dependent_configs_from = invoker.forward_dependent_configs_from | 91 forward_dependent_configs_from = invoker.forward_dependent_configs_from |
87 } | 92 } |
88 if (defined(invoker.public_deps)) { | 93 if (defined(invoker.public_deps)) { |
89 public_deps = invoker.public_deps | 94 public_deps = invoker.public_deps |
90 } | 95 } |
91 if (defined(invoker.all_dependent_configs)) { | 96 if (defined(invoker.all_dependent_configs)) { |
(...skipping 17 matching lines...) Expand all Loading... |
109 if (defined(invoker.public)) { | 114 if (defined(invoker.public)) { |
110 public = invoker.public | 115 public = invoker.public |
111 } | 116 } |
112 if (defined(invoker.sources)) { | 117 if (defined(invoker.sources)) { |
113 sources = invoker.sources | 118 sources = invoker.sources |
114 } | 119 } |
115 if (defined(invoker.testonly)) { | 120 if (defined(invoker.testonly)) { |
116 testonly = invoker.testonly | 121 testonly = invoker.testonly |
117 } | 122 } |
118 | 123 |
119 visibility = [ | 124 visibility = [ ":${final_target_name}" ] |
120 ":${final_target_name}", | |
121 ] | |
122 } | 125 } |
123 | 126 |
124 copy(final_target_name) { | 127 copy(final_target_name) { |
125 if (defined(invoker.testonly)) { | 128 if (defined(invoker.testonly)) { |
126 testonly = invoker.testonly | 129 testonly = invoker.testonly |
127 } | 130 } |
128 if (defined(invoker.visibility)) { | 131 if (defined(invoker.visibility)) { |
129 visibility = invoker.visibility | 132 visibility = invoker.visibility |
130 } | 133 } |
131 deps = [ | 134 deps = [ |
132 ":${library_target_name}", | 135 ":${library_target_name}", |
133 ] | 136 ] |
134 sources = [ "${root_out_dir}/${library_name}" ] | 137 sources = [ |
135 outputs = [ "${root_out_dir}/${output}" ] | 138 "${root_out_dir}/${library_name}", |
| 139 ] |
| 140 outputs = [ |
| 141 "${root_out_dir}/${output}", |
| 142 ] |
136 } | 143 } |
137 } | 144 } |
138 | 145 |
139 if (is_android) { | 146 if (is_android) { |
140 # Declares an Android Mojo application consisting of an .so file and a | 147 # Declares an Android Mojo application consisting of an .so file and a |
141 # corresponding .dex.jar file. | 148 # corresponding .dex.jar file. |
142 # | 149 # |
143 # Variables: | 150 # Variables: |
144 # input_so: the .so file to bundle | 151 # input_so: the .so file to bundle |
145 # input_dex_jar: the .dex.jar file to bundle | 152 # input_dex_jar: the .dex.jar file to bundle |
146 # output_name (optional): override for the output file name | 153 # output_name (optional): override for the output file name |
147 template("mojo_android_application") { | 154 template("mojo_android_application") { |
148 assert(defined(invoker.input_so)) | 155 assert(defined(invoker.input_so)) |
149 assert(defined(invoker.input_dex_jar)) | 156 assert(defined(invoker.input_dex_jar)) |
150 | 157 |
151 zip_action_name = "${target_name}_zip" | 158 zip_action_name = "${target_name}_zip" |
152 zip_action_output = "$target_gen_dir/${target_name}.zip" | 159 zip_action_output = "$target_gen_dir/${target_name}.zip" |
153 action(zip_action_name) { | 160 action(zip_action_name) { |
154 script = "//build/android/gn/zip.py" | 161 script = "//build/android/gn/zip.py" |
155 | 162 |
156 inputs = [ | 163 inputs = [ |
157 invoker.input_so, | 164 invoker.input_so, |
158 invoker.input_dex_jar, | 165 invoker.input_dex_jar, |
159 ] | 166 ] |
160 | 167 |
161 output = zip_action_output | 168 output = zip_action_output |
162 outputs = [ output ] | 169 outputs = [ |
| 170 output, |
| 171 ] |
163 | 172 |
164 rebase_inputs = rebase_path(inputs, root_build_dir) | 173 rebase_inputs = rebase_path(inputs, root_build_dir) |
165 rebase_output = rebase_path(output, root_build_dir) | 174 rebase_output = rebase_path(output, root_build_dir) |
166 args = [ | 175 args = [ |
167 "--inputs=$rebase_inputs", | 176 "--inputs=$rebase_inputs", |
168 "--output=$rebase_output", | 177 "--output=$rebase_output", |
169 ] | 178 ] |
170 } | 179 } |
171 | 180 |
172 if (defined(invoker.output_name)) { | 181 if (defined(invoker.output_name)) { |
173 mojo_output = "$target_out_dir/" + invoker.output_name + ".mojo" | 182 mojo_output = "$target_out_dir/" + invoker.output_name + ".mojo" |
174 } else { | 183 } else { |
175 mojo_output = "$target_out_dir/" + target_name + ".mojo" | 184 mojo_output = "$target_out_dir/" + target_name + ".mojo" |
176 } | 185 } |
177 | 186 |
178 action(target_name) { | 187 action(target_name) { |
179 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) | 188 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) |
180 | 189 |
181 input = zip_action_output | 190 input = zip_action_output |
182 inputs = [ input ] | 191 inputs = [ |
| 192 input, |
| 193 ] |
183 | 194 |
184 output = mojo_output | 195 output = mojo_output |
185 outputs = [ output ] | 196 outputs = [ |
| 197 output, |
| 198 ] |
186 | 199 |
187 rebase_input = rebase_path(input, root_build_dir) | 200 rebase_input = rebase_path(input, root_build_dir) |
188 rebase_output = rebase_path(output, root_build_dir) | 201 rebase_output = rebase_path(output, root_build_dir) |
189 args = [ | 202 args = [ |
190 "--input=$rebase_input", | 203 "--input=$rebase_input", |
191 "--output=$rebase_output", | 204 "--output=$rebase_output", |
192 "--line=#!mojo:android_handler", | 205 "--line=#!mojo:android_handler", |
193 ] | 206 ] |
194 } | 207 } |
195 } | 208 } |
196 } | 209 } |
OLD | NEW |