summaryrefslogtreecommitdiffstats
path: root/url/BUILD.gn
blob: 5c5b3ba9a13323f08f6ab98872dde0073fb47064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//testing/test.gni")

if (is_android) {
  import("//build/config/android/rules.gni")
}

# Shared sources between url and url_lib_use_icu_alternatives_on_android.
url_shared_sources = [
  "gurl.cc",
  "gurl.h",
  "origin.cc",
  "origin.h",
  "scheme_host_port.cc",
  "scheme_host_port.h",
  "third_party/mozilla/url_parse.cc",
  "third_party/mozilla/url_parse.h",
  "url_canon.h",
  "url_canon_etc.cc",
  "url_canon_filesystemurl.cc",
  "url_canon_fileurl.cc",
  "url_canon_host.cc",
  "url_canon_internal.cc",
  "url_canon_internal.h",
  "url_canon_internal_file.h",
  "url_canon_ip.cc",
  "url_canon_ip.h",
  "url_canon_mailtourl.cc",
  "url_canon_path.cc",
  "url_canon_pathurl.cc",
  "url_canon_query.cc",
  "url_canon_relative.cc",
  "url_canon_stdstring.cc",
  "url_canon_stdstring.h",
  "url_canon_stdurl.cc",
  "url_constants.cc",
  "url_constants.h",
  "url_export.h",
  "url_file.h",
  "url_parse_file.cc",
  "url_parse_internal.h",
  "url_util.cc",
  "url_util.h",
]

component("url") {
  sources = url_shared_sources + [
              "url_canon_icu.cc",
              "url_canon_icu.h",
            ]

  if (is_win) {
    # Don't conflict with Windows' "url.dll".
    output_name = "url_lib"
  }
  defines = [ "URL_IMPLEMENTATION" ]

  configs += [
    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
    "//build/config/compiler:no_size_t_to_int_warning",
  ]

  deps = [
    "//base",
    "//base/third_party/dynamic_annotations",
    "//third_party/icu",
    "//third_party/icu:icudata",
  ]
}

if (is_android) {
  android_library("url_java") {
    DEPRECATED_java_in_dir = "android/java/src"
    deps = [
      "//base:base_java",
    ]
  }

  generate_jni("url_jni_headers") {
    sources = [
      "android/java/src/org/chromium/url/IDNStringUtil.java",
    ]
    jni_package = "url"
  }

  component("url_lib_use_icu_alternatives_on_android") {
    sources = url_shared_sources + [
                "android/url_jni_registrar.cc",
                "android/url_jni_registrar.h",
                "url_canon_icu_alternatives_android.cc",
                "url_canon_icu_alternatives_android.h",
              ]

    defines = [
      "URL_IMPLEMENTATION",
      "USE_ICU_ALTERNATIVES_ON_ANDROID=1",
    ]

    configs += [
      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
      "//build/config/compiler:no_size_t_to_int_warning",
    ]

    deps = [
      ":url_java",
      ":url_jni_headers",
      "//base",
      "//base/third_party/dynamic_annotations",
    ]
  }
}

# TODO(dpranke): crbug.com/360936. Get this to build and run on Android.
if (!is_android) {
  # TODO(GYP): Delete this after we've converted everything to GN.
  # The _run targets exist only for compatibility w/ GYP.
  group("url_unittests_run") {
    testonly = true
    deps = [
      ":url_unittests",
    ]
  }

  test("url_unittests") {
    sources = [
      "gurl_unittest.cc",
      "origin_unittest.cc",
      "scheme_host_port_unittest.cc",
      "url_canon_icu_unittest.cc",
      "url_canon_unittest.cc",
      "url_parse_unittest.cc",
      "url_test_utils.h",
      "url_util_unittest.cc",
    ]

    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
    configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]

    #if (is_posix && !is_mac && !is_ios) {
    #  if (use_allocator!="none") {
    #    deps += "//base/allocator"
    #  }
    #}

    deps = [
      ":url",
      "//base",
      "//base/test:run_all_unittests",
      "//testing/gtest",
      "//third_party/icu:icuuc",
    ]
  }
}