Fix WindowAndroid leak in Android WebView
[chromium-blink-merge.git] / url / BUILD.gn
blob4f6b63731e2072efc30e1c6dba1de77606490713
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")
6 import("//url/config.gni")
8 # Sets the USE_ICU_ALTERNATIVES_ON_ANDROID define based on the build flag.
9 config("url_icu_config") {
10   if (use_icu_alternatives_on_android) {
11     defines = [ "USE_ICU_ALTERNATIVES_ON_ANDROID=1" ]
12   }
15 component("url") {
16   if (is_win) {
17     # Don't conflict with Windows' "url.dll".
18     output_name = "url_lib"
19   }
20   sources = [
21     "android/url_jni_registrar.cc",
22     "android/url_jni_registrar.h",
23     "gurl.cc",
24     "gurl.h",
25     "origin.cc",
26     "origin.h",
27     "third_party/mozilla/url_parse.cc",
28     "third_party/mozilla/url_parse.h",
29     "url_canon.h",
30     "url_canon_etc.cc",
31     "url_canon_filesystemurl.cc",
32     "url_canon_fileurl.cc",
33     "url_canon_host.cc",
34     "url_canon_icu.cc",
35     "url_canon_icu.h",
36     "url_canon_internal.cc",
37     "url_canon_internal.h",
38     "url_canon_internal_file.h",
39     "url_canon_ip.cc",
40     "url_canon_ip.h",
41     "url_canon_mailtourl.cc",
42     "url_canon_path.cc",
43     "url_canon_pathurl.cc",
44     "url_canon_query.cc",
45     "url_canon_relative.cc",
46     "url_canon_stdstring.cc",
47     "url_canon_stdstring.h",
48     "url_canon_stdurl.cc",
49     "url_constants.cc",
50     "url_constants.h",
51     "url_export.h",
52     "url_file.h",
53     "url_parse_file.cc",
54     "url_parse_internal.h",
55     "url_util.cc",
56     "url_util.h",
57   ]
59   defines = [ "URL_IMPLEMENTATION" ]
61   configs += [
62     ":url_icu_config",
64     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
65     "//build/config/compiler:no_size_t_to_int_warning",
66   ]
68   deps = [
69     "//base",
70     "//base/third_party/dynamic_annotations",
71     "//third_party/icu:icudata",
72     "//third_party/icu",
73   ]
75   if (use_icu_alternatives_on_android) {
76     sources -= [
77       "url_canon_icu.cc",
78       "url_canon_icu.h",
79     ]
80     deps -= [
81       "//third_party/icu:icudata",
82       "//third_party/icu",
83     ]
85     sources += [
86       "url_canon_icu_alternatives_android.cc",
87       "url_canon_icu_alternatives_android.h",
88     ]
89   }
92 # TODO(dpranke): crbug.com/360936. Get this to build and run on Android.
93 if (!is_android) {
94   test("url_unittests") {
95     sources = [
96       "gurl_unittest.cc",
97       "origin_unittest.cc",
98       "url_canon_icu_unittest.cc",
99       "url_canon_unittest.cc",
100       "url_parse_unittest.cc",
101       "url_test_utils.h",
102       "url_util_unittest.cc",
103     ]
105     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
106     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
108     #if (is_posix && !is_mac && !is_ios) {
109     #  if (use_allocator!="none") {
110     #    deps += "//base/allocator"
111     #  }
112     #}
114     deps = [
115       ":url",
116       "//base",
117       "//base/test:run_all_unittests",
118       "//testing/gtest",
119       "//third_party/icu:icuuc",
120     ]
122     if (use_icu_alternatives_on_android) {
123       sources -= [ "url_canon_icu_unittest.cc" ]
124       deps -= [ "//third_party/icu:icuuc" ]
125     }
126   }