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

Side by Side Diff: components/cronet/ios/BUILD.gn

Issue 2807283002: [Cronet] Build static libcronet.a for iOS with complete dependencies. (Closed)
Patch Set: Create cronet_consumer_template and use it for static and regular consumer. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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/buildflag_header.gni") 5 import("//build/buildflag_header.gni")
6 import("//build/config/ios/rules.gni") 6 import("//build/config/ios/rules.gni")
7 import("//build/config/mac/symbols.gni") 7 import("//build/config/mac/symbols.gni")
8 import("//build/mac/tweak_info_plist.gni") 8 import("//build/mac/tweak_info_plist.gni")
9 import("//build/util/process_version.gni") 9 import("//build/util/process_version.gni")
10 import("//build/util/version.gni") 10 import("//build/util/version.gni")
(...skipping 14 matching lines...) Expand all
25 sources = [ 25 sources = [
26 "//chrome/VERSION", 26 "//chrome/VERSION",
27 ] 27 ]
28 output = "$target_gen_dir/version.h" 28 output = "$target_gen_dir/version.h"
29 extra_args = [ 29 extra_args = [
30 "-e", 30 "-e",
31 "VERSION_FULL=\"%s.%s.%s.%s\" % (MAJOR,MINOR,BUILD,PATCH)", 31 "VERSION_FULL=\"%s.%s.%s.%s\" % (MAJOR,MINOR,BUILD,PATCH)",
32 ] 32 ]
33 } 33 }
34 34
35 config("cronet_include_config") {
36 include_dirs = [ "//components/grpc_support/include" ]
37 }
38
39 config("cronet_static_config") {
40 libs = [
41 "$target_out_dir/$current_cpu/libcronet_hide.a",
42 "UIKit.Framework",
43 "CFNetwork.framework",
44 "MobileCoreServices.framework",
45 "Security.framework",
46 "SystemConfiguration.framework",
47 "resolv",
48 ]
49 }
50
51 _cronet_deps = [
52 ":cronet_version_header",
53 ":generate_accept_languages",
54 "//base:base",
55 "//components/grpc_support",
56 "//components/metrics:metrics",
57 "//components/metrics/proto:proto",
58 "//components/prefs:prefs",
59 "//ios/net:net",
60 "//ios/web:user_agent",
61 "//net",
62 "//url",
63 ]
64
65 _cronet_sources = [
66 "../histogram_manager.cc",
67 "../histogram_manager.h",
68 "../stale_host_resolver.cc",
69 "../stale_host_resolver.h",
70 "../url_request_context_config.cc",
71 "../url_request_context_config.h",
72 "Cronet.h",
73 "Cronet.mm",
74 "cronet_c_for_grpc.h",
75 "cronet_environment.h",
76 "cronet_environment.mm",
77 ]
78
35 source_set("cronet_sources") { 79 source_set("cronet_sources") {
36 deps = [ 80 deps = _cronet_deps
37 ":cronet_version_header",
38 ":generate_accept_languages",
39 "//base:base",
40 "//components/grpc_support",
41 "//components/metrics:metrics",
42 "//components/metrics/proto:proto",
43 "//components/prefs:prefs",
44 "//ios/net:net",
45 "//ios/web:user_agent",
46 "//net",
47 "//url",
48 ]
49 81
50 sources = [ 82 sources = _cronet_sources
51 "../histogram_manager.cc",
52 "../histogram_manager.h",
53 "../stale_host_resolver.cc",
54 "../stale_host_resolver.h",
55 "../url_request_context_config.cc",
56 "../url_request_context_config.h",
57 "Cronet.h",
58 "Cronet.mm",
59 "cronet_c_for_grpc.h",
60 "cronet_environment.h",
61 "cronet_environment.mm",
62 ]
63 83
64 include_dirs = [ "//components/grpc_support/include" ] 84 include_dirs = [ "//components/grpc_support/include" ]
65 85
66 if (!use_platform_icu_alternatives) { 86 if (!use_platform_icu_alternatives) {
67 deps += [ "//base:i18n" ] 87 deps += [ "//base:i18n" ]
68 } 88 }
69 } 89 }
70 90
71 # Tweak |info_plist| with current version and revision. 91 # Tweak |info_plist| with current version and revision.
72 tweak_info_plist("tweak_cronet_plist") { 92 tweak_info_plist("tweak_cronet_plist") {
73 info_plist = "Info.plist" 93 info_plist = "Info.plist"
74 } 94 }
75 95
76 ios_framework_bundle("cronet_framework") { 96 ios_framework_bundle("cronet_framework") {
77 output_name = "Cronet" 97 output_name = "Cronet"
78 info_plist_target = ":tweak_cronet_plist" 98 info_plist_target = ":tweak_cronet_plist"
79 99
80 deps = [ 100 deps = [
81 ":cronet_sources", 101 ":cronet_sources",
82 "//base", 102 "//base",
83 "//net:net", 103 "//net:net",
84 ] 104 ]
85 105
86 libs = [ "UIKit.Framework" ] 106 libs = [ "UIKit.Framework" ]
87 107
88 include_dirs = [ "//components/grpc_support/include" ] 108 include_dirs = [ "//components/grpc_support/include" ]
kapishnikov 2017/05/22 17:15:57 Is it still needed with the public_configs below?
mef 2017/05/22 20:53:53 Done.
89 109
90 public_deps = [ 110 public_deps = [
91 "//components/grpc_support", 111 "//components/grpc_support",
92 ] 112 ]
93 113
94 public_headers = [ 114 public_headers = [
95 "Cronet.h", 115 "Cronet.h",
96 "cronet_c_for_grpc.h", 116 "cronet_c_for_grpc.h",
97 ] 117 ]
98 public_headers += grpc_public_headers 118 public_headers += grpc_public_headers
99 119
100 sources = [ 120 sources = [
101 "Cronet.h", 121 "Cronet.h",
102 ] 122 ]
103 123
104 configs -= [ "//build/config/compiler:default_symbols" ] 124 configs -= [ "//build/config/compiler:default_symbols" ]
105 configs += [ "//build/config/compiler:symbols" ] 125 configs += [ "//build/config/compiler:symbols" ]
126
127 public_configs = [ ":cronet_include_config" ]
106 } 128 }
107 129
108 test("cronet_unittests") { 130 test("cronet_unittests") {
109 testonly = true 131 testonly = true
110 132
111 sources = [ 133 sources = [
112 "//components/cronet/histogram_manager_unittest.cc", 134 "//components/cronet/histogram_manager_unittest.cc",
113 "//components/cronet/run_all_unittests.cc", 135 "//components/cronet/run_all_unittests.cc",
114 "//components/cronet/stale_host_resolver_unittest.cc", 136 "//components/cronet/stale_host_resolver_unittest.cc",
115 "//components/cronet/url_request_context_config_unittest.cc", 137 "//components/cronet/url_request_context_config_unittest.cc",
(...skipping 14 matching lines...) Expand all
130 script = "//components/cronet/tools/generate_accept_languages.py" 152 script = "//components/cronet/tools/generate_accept_languages.py"
131 args = [ 153 args = [
132 rebase_path("$target_gen_dir"), 154 rebase_path("$target_gen_dir"),
133 rebase_path("//"), 155 rebase_path("//"),
134 ] 156 ]
135 outputs = [ 157 outputs = [
136 "$target_gen_dir/accept_languages_table.h", 158 "$target_gen_dir/accept_languages_table.h",
137 ] 159 ]
138 } 160 }
139 161
162 # A static library which contains just _cronet_sources.
163 static_library("cronet_static") {
164 deps = _cronet_deps
165
166 sources = _cronet_sources
167
168 visibility = [ ":*" ]
169
170 include_dirs = [ "//components/grpc_support/include" ]
kapishnikov 2017/05/22 17:15:57 Replace it with "cronet_include_config"?
mef 2017/05/22 20:53:53 Done.
171
172 public_deps = [
173 "//components/grpc_support",
174 ]
175
176 public_headers = [
177 "Cronet.h",
178 "cronet_c_for_grpc.h",
179 ]
180 public_headers += grpc_public_headers
181 }
182
183 # A static library which contains all dependencies of :cronet_static.
184 static_library("cronet_deps_complete") {
185 visibility = [ ":*" ]
186 complete_static_lib = true
187 deps = [
188 ":cronet_static",
189 ]
190 }
191
192 # A static library which contains cronet and all dependendencies hidden inside.
193 action("cronet_hide") {
kapishnikov 2017/05/22 17:15:57 Do we intend to keep this target public? If yes, w
mef 2017/05/22 20:53:53 It is currently used by cronet_consumer_static. I
194 script = "//components/cronet/tools/hide_symbols.py"
195 deps = [
196 ":cronet_deps_complete",
197 ":cronet_static",
198 ]
199 outputs = [
200 "$target_out_dir/$current_cpu/libcronet_hide.a",
201 ]
202 args = [
203 "--input_libs",
204 rebase_path("$target_out_dir/libcronet_static.a", root_build_dir),
205 "--deps_lib",
206 rebase_path("$target_out_dir/libcronet_deps_complete.a", root_build_dir),
207 "--output_obj",
208 rebase_path("$target_out_dir/$current_cpu/libcronet_hide.o",
209 root_build_dir),
210 "--output_lib",
211 rebase_path("$target_out_dir/$current_cpu/libcronet_hide.a",
212 root_build_dir),
213 "--current_cpu",
214 current_cpu,
215 ]
216
217 public_configs = [
218 ":cronet_include_config",
kapishnikov 2017/05/22 17:15:56 Should we add ":cronet_include_config" to ":cronet
mef 2017/05/22 20:53:53 Done.
219 ":cronet_static_config",
220 ]
221 }
222
223 # A fat static library which exports cronet public symbols and hides all depende ndencies.
224 lipo_binary("libcronet") {
225 arch_binary_target = ":cronet_hide"
226 arch_binary_output = "libcronet_hide.a"
227 output_name = "libcronet.a"
228 enable_stripping = false
229 enable_dsyms = false
230 }
231
140 if (additional_toolchains == [] || current_toolchain == default_toolchain) { 232 if (additional_toolchains == [] || current_toolchain == default_toolchain) {
141 _package_dir = "$root_out_dir/cronet" 233 _package_dir = "$root_out_dir/cronet"
142 234
143 action("generate_license") { 235 action("generate_license") {
144 _license_path = "$_package_dir/LICENSE" 236 _license_path = "$_package_dir/LICENSE"
145 237
146 script = "//components/cronet/tools/cronet_licenses.py" 238 script = "//components/cronet/tools/cronet_licenses.py"
147 inputs = [ 239 inputs = [
148 "//build/util/LASTCHANGE", 240 "//build/util/LASTCHANGE",
149 "//buildtools/$host_os/gn", 241 "//buildtools/$host_os/gn",
150 ] 242 ]
151 outputs = [ 243 outputs = [
152 _license_path, 244 _license_path,
153 ] 245 ]
154 args = [ 246 args = [
155 "license", 247 "license",
156 rebase_path(_license_path, root_build_dir), 248 rebase_path(_license_path, root_build_dir),
157 "--gn", 249 "--gn",
158 "--gn-path", 250 "--gn-path",
159 rebase_path("//buildtools/$host_os/gn", root_build_dir), 251 rebase_path("//buildtools/$host_os/gn", root_build_dir),
160 ] 252 ]
161 } 253 }
162 254
163 copy("cronet_package_copy") { 255 copy("cronet_package_copy") {
164 sources = [ 256 sources = [
165 "$root_out_dir/Cronet.framework", 257 "$root_out_dir/Cronet.framework",
258 "$target_out_dir/libcronet.a",
166 "//AUTHORS", 259 "//AUTHORS",
167 "//chrome/VERSION", 260 "//chrome/VERSION",
168 ] 261 ]
169 outputs = [ 262 outputs = [
170 "$_package_dir/{{source_file_part}}", 263 "$_package_dir/{{source_file_part}}",
171 ] 264 ]
172 265
173 deps = [ 266 deps = [
174 ":cronet_framework", 267 ":cronet_framework",
268 ":libcronet",
175 ] 269 ]
176 } 270 }
177 271
178 if (enable_dsyms) { 272 if (enable_dsyms) {
179 action("cronet_dsym_archive") { 273 action("cronet_dsym_archive") {
180 script = "//chrome/tools/build/mac/archive_symbols.py" 274 script = "//chrome/tools/build/mac/archive_symbols.py"
181 275
182 # These are the dSYMs that will be archived. The sources list must be 276 # These are the dSYMs that will be archived. The sources list must be
183 # the target outputs that correspond to the dSYMs (since a dSYM is a 277 # the target outputs that correspond to the dSYMs (since a dSYM is a
184 # directory it cannot be listed as a source file). The targets that 278 # directory it cannot be listed as a source file). The targets that
(...skipping 23 matching lines...) Expand all
208 } 302 }
209 303
210 group("cronet_package") { 304 group("cronet_package") {
211 deps = [ 305 deps = [
212 ":cronet_dsym_archive", 306 ":cronet_dsym_archive",
213 ":cronet_package_copy", 307 ":cronet_package_copy",
214 ":generate_license", 308 ":generate_license",
215 ] 309 ]
216 } 310 }
217 } 311 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/ios/cronet_consumer/BUILD.gn » ('j') | components/cronet/tools/hide_symbols.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698