Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(840)

Unified Diff: mojo/public/mojo_application.gni

Issue 1180653002: Build Mojo apps in subdirectories, like application packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/mojo_application.gni
diff --git a/mojo/public/mojo_application.gni b/mojo/public/mojo_application.gni
index 42e03c2ec88eb87b00f0a4135c0c93f2d4227bb7..9d9e1c5a8428c680c405cc757e543a278006e7e8 100644
--- a/mojo/public/mojo_application.gni
+++ b/mojo/public/mojo_application.gni
@@ -4,17 +4,37 @@
import("mojo.gni")
-# Generate a binary mojo application.The parameters of this template are those
-# of a shared library.
+# Generate a binary Mojo application in a self-named directory.
+# Application resources are copied to a "resources" directory alongside the app.
+# The parameters of this template are those of a shared library.
template("mojo_native_application") {
+ base_target_name = target_name
if (defined(invoker.output_name)) {
base_target_name = invoker.output_name
- } else {
- base_target_name = target_name
}
final_target_name = target_name
+ mojo_deps = []
+ if (defined(invoker.deps)) {
+ mojo_deps += invoker.deps
+ }
+
+ if (defined(invoker.resources)) {
+ copy_step_name = "${base_target_name}__copy_resources"
+ copy(copy_step_name) {
+ sources = invoker.resources
+ outputs = [
+ "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}",
+ ]
+ if (defined(invoker.testonly)) {
+ testonly = invoker.testonly
+ }
+ deps = mojo_deps
+ }
+ mojo_deps += [ ":$copy_step_name" ]
+ }
+
if (!is_nacl) {
output = base_target_name + ".mojo"
library_target_name = base_target_name + "_library"
@@ -30,8 +50,8 @@ template("mojo_native_application") {
}
if (is_android) {
- # On android, use the stripped version of the library, because applications
- # are always fetched over the network.
+ # On android, use the stripped version of the library, because
+ # applications are always fetched over the network.
library_dir = "${root_out_dir}/lib.stripped"
} else {
library_dir = root_out_dir
@@ -91,9 +111,7 @@ template("mojo_native_application") {
],
".",
mojo_root)
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
+ deps += mojo_deps
if (defined(invoker.forward_dependent_configs_from)) {
forward_dependent_configs_from = invoker.forward_dependent_configs_from
}
@@ -146,7 +164,7 @@ template("mojo_native_application") {
"${library_dir}/${library_name}",
]
outputs = [
- "${root_out_dir}/${output}",
+ "${root_out_dir}/${base_target_name}/${output}",
]
}
} else {
@@ -211,9 +229,7 @@ template("mojo_native_application") {
],
".",
mojo_root)
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
+ deps += mojo_deps
if (defined(invoker.forward_dependent_configs_from)) {
forward_dependent_configs_from = invoker.forward_dependent_configs_from
}
@@ -266,7 +282,7 @@ template("mojo_native_application") {
input_path,
]
- output_path = "${root_build_dir}/${output}"
+ output_path = "${root_build_dir}/${base_target_name}/${output}"
outputs = [
output_path,
]
@@ -336,10 +352,9 @@ if (is_android) {
}
}
+ base_target_name = target_name
scottmg 2015/06/12 22:40:10 can this go inside action(target_name) {...}? (or
msw 2015/06/12 22:57:03 Done.
if (defined(invoker.output_name)) {
- mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
- } else {
- mojo_output = "$root_out_dir/" + target_name + ".mojo"
+ base_target_name = invoker.output_name
}
action(target_name) {
@@ -350,7 +365,7 @@ if (is_android) {
input,
]
- output = mojo_output
+ output = "${root_out_dir}/${base_target_name}/${base_target_name}.mojo"
outputs = [
output,
]

Powered by Google App Engine
This is Rietveld 408576698