| 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("//build/toolchain/toolchain.gni") | 5 import("//build/toolchain/toolchain.gni") |
| 6 import("//services/service_manager/public/constants.gni") | 6 import("//services/service_manager/public/constants.gni") |
| 7 | 7 |
| 8 if (is_android) { | 8 if (is_android) { |
| 9 import("//build/config/android/rules.gni") | 9 import("//build/config/android/rules.gni") |
| 10 import("//build/config/zip.gni") | 10 import("//build/config/zip.gni") |
| 11 } | 11 } |
| 12 | 12 |
| 13 # Generates a Service "package", which includes: | 13 # Generates a Service "package", which includes: |
| 14 # . A self-named subdirectory |
| 15 # . A binary .library |
| 16 # . A resources subdirectory alongside .library that contains the contents of |
| 17 # "resources" |
| 14 # | 18 # |
| 15 # - A self-named subdirectory | 19 # The parameters of this template are those of a shared library. |
| 16 # - A binary .service executable | |
| 17 # - A resources subdirectory alongside the executable, which contains the | |
| 18 # contents of "resources" | |
| 19 # | |
| 20 # The parameters of this template are those of an executable | |
| 21 template("service") { | 20 template("service") { |
| 22 base_target_name = target_name | 21 base_target_name = target_name |
| 23 if (defined(invoker.output_name)) { | 22 if (defined(invoker.output_name)) { |
| 24 base_target_name = invoker.output_name | 23 base_target_name = invoker.output_name |
| 25 } | 24 } |
| 26 | 25 |
| 27 final_target_name = target_name | 26 final_target_name = target_name |
| 28 | 27 |
| 29 service_deps = [] | 28 library_deps = [] |
| 30 if (defined(invoker.deps)) { | 29 if (defined(invoker.deps)) { |
| 31 service_deps += invoker.deps | 30 library_deps += invoker.deps |
| 32 } | 31 } |
| 33 | 32 |
| 34 service_data_deps = | 33 library_data_deps = [] |
| 35 [ "//services/service_manager/public/cpp/standalone_service:main" ] | |
| 36 | 34 |
| 37 if (defined(invoker.resources)) { | 35 if (defined(invoker.resources)) { |
| 38 copy_step_name = "${base_target_name}__copy_resources" | 36 copy_step_name = "${base_target_name}__copy_resources" |
| 39 copy(copy_step_name) { | 37 copy(copy_step_name) { |
| 40 sources = invoker.resources | 38 sources = invoker.resources |
| 41 outputs = [ | 39 outputs = [ |
| 42 "${root_out_dir}/${packages_directory}/${base_target_name}/resources/{{s
ource_file_part}}", | 40 "${root_out_dir}/${packages_directory}/${base_target_name}/resources/{{s
ource_file_part}}", |
| 43 ] | 41 ] |
| 44 if (defined(invoker.testonly)) { | 42 if (defined(invoker.testonly)) { |
| 45 testonly = invoker.testonly | 43 testonly = invoker.testonly |
| 46 } | 44 } |
| 47 deps = service_deps | 45 deps = library_deps |
| 48 } | 46 } |
| 49 service_data_deps += [ ":$copy_step_name" ] | 47 library_data_deps += [ ":$copy_step_name" ] |
| 50 } | 48 } |
| 51 | 49 |
| 52 if (defined(invoker.data_deps)) { | 50 output = base_target_name + ".library" |
| 53 service_data_deps += invoker.data_deps | 51 library_target_name = base_target_name + "_library" |
| 54 } | 52 library_name = "${shlib_prefix}${library_target_name}${shlib_extension}" |
| 55 | 53 |
| 56 executable_target_name = base_target_name + "_executable" | 54 shared_library(library_target_name) { |
| 57 executable_name = base_target_name + ".service" | |
| 58 | |
| 59 executable(executable_target_name) { | |
| 60 output_name = base_target_name | |
| 61 output_extension = "service" | |
| 62 | |
| 63 if (defined(invoker.cflags)) { | 55 if (defined(invoker.cflags)) { |
| 64 cflags = invoker.cflags | 56 cflags = invoker.cflags |
| 65 } | 57 } |
| 66 if (defined(invoker.cflags_c)) { | 58 if (defined(invoker.cflags_c)) { |
| 67 cflags_c = invoker.cflags_c | 59 cflags_c = invoker.cflags_c |
| 68 } | 60 } |
| 69 if (defined(invoker.cflags_cc)) { | 61 if (defined(invoker.cflags_cc)) { |
| 70 cflags_cc = invoker.cflags_cc | 62 cflags_cc = invoker.cflags_cc |
| 71 } | 63 } |
| 72 if (defined(invoker.cflags_objc)) { | 64 if (defined(invoker.cflags_objc)) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 if (defined(invoker.ldflags)) { | 76 if (defined(invoker.ldflags)) { |
| 85 ldflags = invoker.ldflags | 77 ldflags = invoker.ldflags |
| 86 } | 78 } |
| 87 if (defined(invoker.lib_dirs)) { | 79 if (defined(invoker.lib_dirs)) { |
| 88 lib_dirs = invoker.lib_dirs | 80 lib_dirs = invoker.lib_dirs |
| 89 } | 81 } |
| 90 if (defined(invoker.libs)) { | 82 if (defined(invoker.libs)) { |
| 91 libs = invoker.libs | 83 libs = invoker.libs |
| 92 } | 84 } |
| 93 | 85 |
| 94 data_deps = service_data_deps | 86 data_deps = [] |
| 87 if (!defined(invoker.avoid_runner_cycle) || !invoker.avoid_runner_cycle) { |
| 88 # Give the user an out; as some Services are depended on by the runner. |
| 89 data_deps += [ "//services/service_manager/standalone" ] |
| 90 } |
| 91 if (defined(invoker.data_deps)) { |
| 92 data_deps += invoker.data_deps |
| 93 } |
| 94 data_deps += library_data_deps |
| 95 | 95 |
| 96 deps = [ | 96 deps = [ |
| 97 "//services/service_manager/public/cpp/standalone_service:main", | 97 "//mojo/public/c/system:set_thunks_for_app", |
| 98 "//services/service_manager/public/cpp:application_support", |
| 98 ] | 99 ] |
| 99 | 100 |
| 100 deps += service_deps | 101 deps += library_deps |
| 101 if (defined(invoker.public_deps)) { | 102 if (defined(invoker.public_deps)) { |
| 102 public_deps = invoker.public_deps | 103 public_deps = invoker.public_deps |
| 103 } | 104 } |
| 104 if (defined(invoker.all_dependent_configs)) { | 105 if (defined(invoker.all_dependent_configs)) { |
| 105 all_dependent_configs = invoker.all_dependent_configs | 106 all_dependent_configs = invoker.all_dependent_configs |
| 106 } | 107 } |
| 107 if (defined(invoker.public_configs)) { | 108 if (defined(invoker.public_configs)) { |
| 108 public_configs = invoker.public_configs | 109 public_configs = invoker.public_configs |
| 109 } | 110 } |
| 110 if (defined(invoker.check_includes)) { | 111 if (defined(invoker.check_includes)) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 130 } | 131 } |
| 131 } | 132 } |
| 132 | 133 |
| 133 copy(final_target_name) { | 134 copy(final_target_name) { |
| 134 forward_variables_from(invoker, | 135 forward_variables_from(invoker, |
| 135 [ | 136 [ |
| 136 "testonly", | 137 "testonly", |
| 137 "visibility", | 138 "visibility", |
| 138 ]) | 139 ]) |
| 139 deps = [ | 140 deps = [ |
| 140 ":${executable_target_name}", | 141 ":${library_target_name}", |
| 141 ] | 142 ] |
| 142 | 143 |
| 143 # NOTE: We have to explicitly inherit the same data_deps as the executable | |
| 144 # target itself, rather than specifying a data depenedency on the executable | |
| 145 # target. This avoids needless duplication of service binary artifacts in | |
| 146 # test isolates, as the executable is unused in its original location. | |
| 147 data_deps = service_data_deps | |
| 148 | |
| 149 sources = [ | 144 sources = [ |
| 150 "${root_out_dir}/${executable_name}", | 145 "${root_shlib_dir}/${library_name}", |
| 151 ] | 146 ] |
| 152 outputs = [ | 147 outputs = [ |
| 153 "${root_out_dir}/${packages_directory}/${base_target_name}/${executable_na
me}", | 148 "${root_out_dir}/${packages_directory}/${base_target_name}/${output}", |
| 154 ] | 149 ] |
| 155 } | 150 } |
| 156 } | 151 } |
| OLD | NEW |