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

Unified Diff: mojo/public/mojo_application.gni

Issue 1189703004: Reland: Build Mojo apps in sub-dirs, like application packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup, move getAssetsList to FileHelper; rename local to cached. 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
« no previous file with comments | « mojo/mojo_application_package.gni ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/mojo_application.gni
diff --git a/mojo/public/mojo_application.gni b/mojo/public/mojo_application.gni
index 42e03c2ec88eb87b00f0a4135c0c93f2d4227bb7..1450227fe287c494edaee961ccfb6e9e76719b95 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,21 +352,20 @@ if (is_android) {
}
}
- if (defined(invoker.output_name)) {
- mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
- } else {
- mojo_output = "$root_out_dir/" + target_name + ".mojo"
- }
-
action(target_name) {
script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root)
+ base_target_name = target_name
+ if (defined(invoker.output_name)) {
+ base_target_name = invoker.output_name
+ }
+
input = zip_action_output
inputs = [
input,
]
- output = mojo_output
+ output = "${root_out_dir}/${base_target_name}/${base_target_name}.mojo"
outputs = [
output,
]
« no previous file with comments | « mojo/mojo_application_package.gni ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698