| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import("//build/toolchain/toolchain.gni") | |
| 6 import("//services/shell/public/constants.gni") | |
| 7 | |
| 8 if (is_android) { | |
| 9 import("//build/config/android/rules.gni") | |
| 10 import("//build/config/zip.gni") | |
| 11 } | |
| 12 | |
| 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" | |
| 18 # | |
| 19 # The parameters of this template are those of a shared library. | |
| 20 template("service") { | |
| 21 base_target_name = target_name | |
| 22 if (defined(invoker.output_name)) { | |
| 23 base_target_name = invoker.output_name | |
| 24 } | |
| 25 | |
| 26 final_target_name = target_name | |
| 27 | |
| 28 library_deps = [] | |
| 29 if (defined(invoker.deps)) { | |
| 30 library_deps += invoker.deps | |
| 31 } | |
| 32 | |
| 33 library_data_deps = [] | |
| 34 | |
| 35 if (defined(invoker.resources)) { | |
| 36 copy_step_name = "${base_target_name}__copy_resources" | |
| 37 copy(copy_step_name) { | |
| 38 sources = invoker.resources | |
| 39 outputs = [ | |
| 40 "${root_out_dir}/${packages_directory}/${base_target_name}/resources/{{s
ource_file_part}}", | |
| 41 ] | |
| 42 if (defined(invoker.testonly)) { | |
| 43 testonly = invoker.testonly | |
| 44 } | |
| 45 deps = library_deps | |
| 46 } | |
| 47 library_data_deps += [ ":$copy_step_name" ] | |
| 48 } | |
| 49 | |
| 50 output = base_target_name + ".library" | |
| 51 library_target_name = base_target_name + "_library" | |
| 52 library_name = "${shlib_prefix}${library_target_name}${shlib_extension}" | |
| 53 | |
| 54 shared_library(library_target_name) { | |
| 55 if (defined(invoker.cflags)) { | |
| 56 cflags = invoker.cflags | |
| 57 } | |
| 58 if (defined(invoker.cflags_c)) { | |
| 59 cflags_c = invoker.cflags_c | |
| 60 } | |
| 61 if (defined(invoker.cflags_cc)) { | |
| 62 cflags_cc = invoker.cflags_cc | |
| 63 } | |
| 64 if (defined(invoker.cflags_objc)) { | |
| 65 cflags_objc = invoker.cflags_objc | |
| 66 } | |
| 67 if (defined(invoker.cflags_objcc)) { | |
| 68 cflags_objcc = invoker.cflags_objcc | |
| 69 } | |
| 70 if (defined(invoker.defines)) { | |
| 71 defines = invoker.defines | |
| 72 } | |
| 73 if (defined(invoker.include_dirs)) { | |
| 74 include_dirs = invoker.include_dirs | |
| 75 } | |
| 76 if (defined(invoker.ldflags)) { | |
| 77 ldflags = invoker.ldflags | |
| 78 } | |
| 79 if (defined(invoker.lib_dirs)) { | |
| 80 lib_dirs = invoker.lib_dirs | |
| 81 } | |
| 82 if (defined(invoker.libs)) { | |
| 83 libs = invoker.libs | |
| 84 } | |
| 85 | |
| 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/shell/standalone" ] | |
| 90 } | |
| 91 if (defined(invoker.data_deps)) { | |
| 92 data_deps += invoker.data_deps | |
| 93 } | |
| 94 data_deps += library_data_deps | |
| 95 | |
| 96 deps = [ | |
| 97 "//mojo/public/c/system:set_thunks_for_app", | |
| 98 "//services/shell/public/cpp:application_support", | |
| 99 ] | |
| 100 | |
| 101 deps += library_deps | |
| 102 if (defined(invoker.public_deps)) { | |
| 103 public_deps = invoker.public_deps | |
| 104 } | |
| 105 if (defined(invoker.all_dependent_configs)) { | |
| 106 all_dependent_configs = invoker.all_dependent_configs | |
| 107 } | |
| 108 if (defined(invoker.public_configs)) { | |
| 109 public_configs = invoker.public_configs | |
| 110 } | |
| 111 if (defined(invoker.check_includes)) { | |
| 112 check_includes = invoker.check_includes | |
| 113 } | |
| 114 if (defined(invoker.configs)) { | |
| 115 configs += invoker.configs | |
| 116 } | |
| 117 if (defined(invoker.data)) { | |
| 118 data = invoker.data | |
| 119 } | |
| 120 if (defined(invoker.inputs)) { | |
| 121 inputs = invoker.inputs | |
| 122 } | |
| 123 if (defined(invoker.public)) { | |
| 124 public = invoker.public | |
| 125 } | |
| 126 if (defined(invoker.sources)) { | |
| 127 sources = invoker.sources | |
| 128 } | |
| 129 if (defined(invoker.testonly)) { | |
| 130 testonly = invoker.testonly | |
| 131 } | |
| 132 } | |
| 133 | |
| 134 copy(final_target_name) { | |
| 135 forward_variables_from(invoker, | |
| 136 [ | |
| 137 "testonly", | |
| 138 "visibility", | |
| 139 ]) | |
| 140 deps = [ | |
| 141 ":${library_target_name}", | |
| 142 ] | |
| 143 | |
| 144 sources = [ | |
| 145 "${root_shlib_dir}/${library_name}", | |
| 146 ] | |
| 147 outputs = [ | |
| 148 "${root_out_dir}/${packages_directory}/${base_target_name}/${output}", | |
| 149 ] | |
| 150 } | |
| 151 } | |
| OLD | NEW |