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