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

Unified Diff: third_party/mojo/src/mojo/public/mojo_application.gni

Issue 1310103002: Update mojo sdk to rev c02a28868825edfa57ab77947b8cb15e741c5598 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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: third_party/mojo/src/mojo/public/mojo_application.gni
diff --git a/third_party/mojo/src/mojo/public/mojo_application.gni b/third_party/mojo/src/mojo/public/mojo_application.gni
index 7ab5a3118e0a639928338f38970a68dce7046632..32bdb7a7d225c7dd457172f0379d69f9eabfaaf7 100644
--- a/third_party/mojo/src/mojo/public/mojo_application.gni
+++ b/third_party/mojo/src/mojo/public/mojo_application.gni
@@ -20,6 +20,7 @@ template("mojo_native_application") {
if (!is_nacl) {
output = base_target_name + ".mojo"
library_target_name = base_target_name + "_library"
+ copy_symbols_target = "__${final_target_name}_copy_symbols"
if (is_linux || is_android) {
library_name = "lib${library_target_name}.so"
@@ -130,7 +131,27 @@ template("mojo_native_application") {
testonly = invoker.testonly
}
+ visibility = [
+ ":${final_target_name}",
+ ":${copy_symbols_target}",
+ ]
+ }
+
+ copy(copy_symbols_target) {
+ if (defined(invoker.testonly)) {
+ testonly = invoker.testonly
+ }
visibility = [ ":${final_target_name}" ]
+ deps = [
+ ":${library_target_name}",
+ ]
+
+ sources = [
+ "${root_out_dir}/${library_name}",
+ ]
+ outputs = [
+ "${root_out_dir}/symbols/${library_name}",
+ ]
}
copy(final_target_name) {
@@ -142,6 +163,7 @@ template("mojo_native_application") {
}
deps = [
":${library_target_name}",
+ ":${copy_symbols_target}",
]
sources = [
@@ -289,30 +311,111 @@ template("mojo_native_application") {
}
if (is_android) {
+ import("//build/config/android/rules.gni")
+
# Declares an Android Mojo application consisting of an .so file and a
# corresponding .dex.jar file.
#
# Variables:
- # input_so: the .so file to bundle
- # input_dex_jar: the .dex.jar file to bundle
- # deps / public_deps / data_deps (optional):
- # Dependencies. The targets that generate the .so/jar inputs should be
- # listed in either deps or public_deps.
+ # sources (optional): The c++ sources.
+ # deps (optional): The c++ dependencies.
+ # java_sources (optional): The java sources.
+ # java_deps (optional): The java dependencies.
+ # jni_package (optional): The c++ package for the generated jni headers.
# output_name (optional): override for the output file name
+ # public_deps / data_deps (optional): Dependencies.
template("mojo_android_application") {
- assert(defined(invoker.input_so))
- assert(defined(invoker.input_dex_jar))
+ shared_library_name = "__${target_name}_lib"
+ library_basename = "lib${shared_library_name}.so"
+ if (defined(invoker.jni_package)) {
+ assert(defined(invoker.java_sources))
+ generate_jni_name = "__${target_name}_jni"
+ }
+ if (defined(invoker.java_sources)) {
+ java_library_name = "__${target_name}_java"
+ }
+ android_standalone_library_name = "__${target_name}_java_lib"
+ dex_output_path = "${target_gen_dir}/${target_name}.dex.jar"
+ zip_action_name = "__${target_name}_zip"
+ zip_action_output = "${target_gen_dir}/${target_name}.zip"
+ copy_symbols_target = "__${target_name}_copy_symbols"
+ final_target_name = target_name
+
+ if (defined(invoker.jni_package)) {
+ generate_jni(generate_jni_name) {
+ visibility = [ ":${shared_library_name}" ]
+
+ sources = invoker.java_sources
+ jni_package = invoker.jni_package
+ }
+ }
+
+ shared_library(shared_library_name) {
+ visibility = [
+ ":${copy_symbols_target}",
+ ":${zip_action_name}",
+ ]
+
+ if (defined(invoker.sources)) {
+ sources = invoker.sources
+ }
+
+ deps = []
+ if (defined(invoker.jni_package)) {
+ deps += [ ":${generate_jni_name}" ]
+ }
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+ }
+
+ copy(copy_symbols_target) {
+ visibility = [ ":${final_target_name}" ]
+ deps = [
+ ":${shared_library_name}",
+ ]
+
+ sources = [
+ "${root_out_dir}/${library_basename}",
+ ]
+ outputs = [
+ "${root_out_dir}/symbols/${library_basename}",
+ ]
+ }
+
+ if (defined(invoker.java_sources)) {
+ android_library(java_library_name) {
+ visibility = [ ":*" ]
+
+ java_files = invoker.java_sources
+
+ if (defined(invoker.java_deps)) {
+ deps = invoker.java_deps
+ }
+ }
+ }
+
+ android_standalone_library(android_standalone_library_name) {
+ deps = []
+
+ if (defined(invoker.java_sources)) {
+ deps += [ ":${java_library_name}" ]
+ }
+
+ if (defined(invoker.java_deps)) {
+ deps += invoker.java_deps
+ }
+
+ dex_path = dex_output_path
+ }
- zip_action_name = "${target_name}_zip"
- zip_action_output = "$target_gen_dir/${target_name}.zip"
- prepend_action_name = target_name
action(zip_action_name) {
- visibility = [ ":$prepend_action_name" ]
+ visibility = [ ":${final_target_name}" ]
script = "//build/android/gn/zip.py"
inputs = [
- invoker.input_so,
- invoker.input_dex_jar,
+ "${root_out_dir}/lib.stripped/${library_basename}",
+ dex_output_path,
]
output = zip_action_output
@@ -323,8 +426,8 @@ if (is_android) {
rebase_inputs = rebase_path(inputs, root_build_dir)
rebase_output = rebase_path(output, root_build_dir)
args = [
- "--inputs=$rebase_inputs",
- "--output=$rebase_output",
+ "--inputs=${rebase_inputs}",
+ "--output=${rebase_output}",
]
if (defined(invoker.deps)) {
@@ -339,12 +442,12 @@ if (is_android) {
}
if (defined(invoker.output_name)) {
- mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
+ mojo_output = "${root_out_dir}/" + invoker.output_name + ".mojo"
} else {
- mojo_output = "$root_out_dir/" + target_name + ".mojo"
+ mojo_output = "${root_out_dir}/" + target_name + ".mojo"
}
- action(target_name) {
+ action(final_target_name) {
script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root)
input = zip_action_output
@@ -360,13 +463,17 @@ if (is_android) {
rebase_input = rebase_path(input, root_build_dir)
rebase_output = rebase_path(output, root_build_dir)
args = [
- "--input=$rebase_input",
- "--output=$rebase_output",
+ "--input=${rebase_input}",
+ "--output=${rebase_output}",
"--line=#!mojo mojo:android_handler",
]
+ deps = [
+ ":${copy_symbols_target}",
+ ]
+
public_deps = [
- ":$zip_action_name",
+ ":${zip_action_name}",
]
}
}

Powered by Google App Engine
This is Rietveld 408576698