Roll src/third_party/WebKit 10b2b4a:a6818f9 (svn 202548:202549)
[chromium-blink-merge.git] / url / BUILD.gn
blob7cedd400ed8b0a3108a59b8693184279310fd6b8
1 # Copyright (c) 2013 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.
5 import("//testing/test.gni")
7 if (is_android) {
8   import("//build/config/android/rules.gni")
11 # Shared sources between url and url_lib_use_icu_alternatives_on_android.
12 url_shared_sources = [
13   "gurl.cc",
14   "gurl.h",
15   "origin.cc",
16   "origin.h",
17   "scheme_host_port.cc",
18   "scheme_host_port.h",
19   "third_party/mozilla/url_parse.cc",
20   "third_party/mozilla/url_parse.h",
21   "url_canon.h",
22   "url_canon_etc.cc",
23   "url_canon_filesystemurl.cc",
24   "url_canon_fileurl.cc",
25   "url_canon_host.cc",
26   "url_canon_internal.cc",
27   "url_canon_internal.h",
28   "url_canon_internal_file.h",
29   "url_canon_ip.cc",
30   "url_canon_ip.h",
31   "url_canon_mailtourl.cc",
32   "url_canon_path.cc",
33   "url_canon_pathurl.cc",
34   "url_canon_query.cc",
35   "url_canon_relative.cc",
36   "url_canon_stdstring.cc",
37   "url_canon_stdstring.h",
38   "url_canon_stdurl.cc",
39   "url_constants.cc",
40   "url_constants.h",
41   "url_export.h",
42   "url_file.h",
43   "url_parse_file.cc",
44   "url_parse_internal.h",
45   "url_util.cc",
46   "url_util.h",
49 component("url") {
50   sources = url_shared_sources + [
51               "url_canon_icu.cc",
52               "url_canon_icu.h",
53             ]
55   if (is_win) {
56     # Don't conflict with Windows' "url.dll".
57     output_name = "url_lib"
58   }
59   defines = [ "URL_IMPLEMENTATION" ]
61   configs += [
62     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
63     "//build/config/compiler:no_size_t_to_int_warning",
64   ]
66   deps = [
67     "//base",
68     "//base/third_party/dynamic_annotations",
69     "//third_party/icu:icudata",
70     "//third_party/icu",
71   ]
74 if (is_android) {
75   generate_jni("url_jni_headers") {
76     sources = [
77       "android/java/src/org/chromium/url/IDNStringUtil.java",
78     ]
79     jni_package = "url"
80   }
82   component("url_lib_use_icu_alternatives_on_android") {
83     sources = url_shared_sources + [
84                 "android/url_jni_registrar.cc",
85                 "android/url_jni_registrar.h",
86                 "url_canon_icu_alternatives_android.cc",
87                 "url_canon_icu_alternatives_android.h",
88               ]
90     defines = [
91       "URL_IMPLEMENTATION",
92       "USE_ICU_ALTERNATIVES_ON_ANDROID=1",
93     ]
95     configs += [
96       # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
97       "//build/config/compiler:no_size_t_to_int_warning",
98     ]
100     deps = [
101       ":url_jni_headers",
102       "//base",
103       "//base/third_party/dynamic_annotations",
104     ]
105   }
108 # TODO(dpranke): crbug.com/360936. Get this to build and run on Android.
109 if (!is_android) {
110   # TODO(GYP): Delete this after we've converted everything to GN.
111   # The _run targets exist only for compatibility w/ GYP.
112   group("url_unittests_run") {
113     testonly = true
114     deps = [
115       ":url_unittests",
116     ]
117   }
119   test("url_unittests") {
120     sources = [
121       "gurl_unittest.cc",
122       "origin_unittest.cc",
123       "scheme_host_port_unittest.cc",
124       "url_canon_icu_unittest.cc",
125       "url_canon_unittest.cc",
126       "url_parse_unittest.cc",
127       "url_test_utils.h",
128       "url_util_unittest.cc",
129     ]
131     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
132     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
134     #if (is_posix && !is_mac && !is_ios) {
135     #  if (use_allocator!="none") {
136     #    deps += "//base/allocator"
137     #  }
138     #}
140     deps = [
141       ":url",
142       "//base",
143       "//base/test:run_all_unittests",
144       "//testing/gtest",
145       "//third_party/icu:icuuc",
146     ]
147   }