OLD | NEW |
---|---|
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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("//testing/test.gni") | 5 import("//testing/test.gni") |
6 import("features.gni") | |
6 | 7 |
7 if (is_android) { | 8 if (is_android) { |
8 import("//build/config/android/rules.gni") | 9 import("//build/config/android/rules.gni") |
9 } | 10 } |
10 | 11 |
11 # Shared sources between url and url_lib_use_icu_alternatives_on_android. | 12 config("url_config") { |
12 url_shared_sources = [ | 13 defines = [] |
13 "gurl.cc", | 14 if (use_platform_icu_alternatives) { |
14 "gurl.h", | 15 defines += [ "USE_PLATFORM_ICU_ALTERNATIVES=1" ] |
15 "origin.cc", | 16 } |
16 "origin.h", | 17 } |
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", | |
47 ] | |
48 | 18 |
49 component("url") { | 19 component("url") { |
50 sources = url_shared_sources + [ | 20 sources = [ |
51 "url_canon_icu.cc", | 21 "gurl.cc", |
52 "url_canon_icu.h", | 22 "gurl.h", |
53 ] | 23 "origin.cc", |
24 "origin.h", | |
25 "scheme_host_port.cc", | |
26 "scheme_host_port.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_internal.cc", | |
35 "url_canon_internal.h", | |
36 "url_canon_internal_file.h", | |
37 "url_canon_ip.cc", | |
38 "url_canon_ip.h", | |
39 "url_canon_mailtourl.cc", | |
40 "url_canon_path.cc", | |
41 "url_canon_pathurl.cc", | |
42 "url_canon_query.cc", | |
43 "url_canon_relative.cc", | |
44 "url_canon_stdstring.cc", | |
45 "url_canon_stdstring.h", | |
46 "url_canon_stdurl.cc", | |
47 "url_constants.cc", | |
48 "url_constants.h", | |
49 "url_export.h", | |
50 "url_file.h", | |
51 "url_parse_file.cc", | |
52 "url_parse_internal.h", | |
53 "url_util.cc", | |
54 "url_util.h", | |
55 ] | |
56 | |
57 defines = [ "URL_IMPLEMENTATION" ] | |
58 | |
59 configs += [ | |
60 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. | |
61 "//build/config/compiler:no_size_t_to_int_warning", | |
62 ":url_config", | |
63 ] | |
64 | |
65 deps = [ | |
66 "//base", | |
67 "//base/third_party/dynamic_annotations", | |
68 ] | |
54 | 69 |
55 if (is_win) { | 70 if (is_win) { |
56 # Don't conflict with Windows' "url.dll". | 71 # Don't conflict with Windows' "url.dll". |
57 output_name = "url_lib" | 72 output_name = "url_lib" |
58 } | 73 } |
59 defines = [ "URL_IMPLEMENTATION" ] | |
60 | 74 |
61 configs += [ | 75 # ICU support. |
62 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. | 76 if (use_platform_icu_alternatives) { |
63 "//build/config/compiler:no_size_t_to_int_warning", | 77 if (is_android) { |
64 ] | 78 sources += [ |
65 | 79 "android/url_jni_registrar.cc", |
66 deps = [ | 80 "android/url_jni_registrar.h", |
67 "//base", | 81 "url_canon_icu_alternatives_android.cc", |
68 "//base/third_party/dynamic_annotations", | 82 "url_canon_icu_alternatives_android.h", |
69 "//third_party/icu", | 83 ] |
70 "//third_party/icu:icudata", | 84 deps += [ |
71 ] | 85 ":url_java", |
86 ":url_jni_headers", | |
87 "//base", | |
88 "//base/third_party/dynamic_annotations", | |
89 ] | |
90 } else if (is_ios) { | |
91 sources += [ "url_canon_icu_alternatives_ios.mm" ] | |
92 } else { | |
93 assert(false, | |
94 "ICU alternative is not implemented for platform: " + target_os) | |
95 } | |
96 } else { | |
97 # use third-party ICU implementation. | |
brettw
2016/04/04 22:54:11
This comment is confusing me since it might be say
kapishnikov
2016/04/05 15:22:04
Done.
| |
98 sources += [ | |
99 "url_canon_icu.cc", | |
100 "url_canon_icu.h", | |
101 ] | |
102 deps += [ | |
103 "//third_party/icu", | |
104 "//third_party/icu:icudata", | |
105 ] | |
106 } | |
72 } | 107 } |
73 | 108 |
74 if (is_android) { | 109 if (is_android) { |
75 android_library("url_java") { | 110 android_library("url_java") { |
76 java_files = [ "android/java/src/org/chromium/url/IDNStringUtil.java" ] | 111 java_files = [ "android/java/src/org/chromium/url/IDNStringUtil.java" ] |
77 deps = [ | 112 deps = [ |
78 "//base:base_java", | 113 "//base:base_java", |
79 ] | 114 ] |
80 } | 115 } |
81 | 116 |
82 generate_jni("url_jni_headers") { | 117 generate_jni("url_jni_headers") { |
83 sources = [ | 118 sources = [ |
84 "android/java/src/org/chromium/url/IDNStringUtil.java", | 119 "android/java/src/org/chromium/url/IDNStringUtil.java", |
85 ] | 120 ] |
86 jni_package = "url" | 121 jni_package = "url" |
87 } | 122 } |
88 | |
89 component("url_lib_use_icu_alternatives_on_android") { | |
90 sources = url_shared_sources + [ | |
91 "android/url_jni_registrar.cc", | |
92 "android/url_jni_registrar.h", | |
93 "url_canon_icu_alternatives_android.cc", | |
94 "url_canon_icu_alternatives_android.h", | |
95 ] | |
96 | |
97 defines = [ | |
98 "URL_IMPLEMENTATION", | |
99 "USE_ICU_ALTERNATIVES_ON_ANDROID=1", | |
100 ] | |
101 | |
102 configs += [ | |
103 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. | |
104 "//build/config/compiler:no_size_t_to_int_warning", | |
105 ] | |
106 | |
107 deps = [ | |
108 ":url_java", | |
109 ":url_jni_headers", | |
110 "//base", | |
111 "//base/third_party/dynamic_annotations", | |
112 ] | |
113 } | |
114 } | 123 } |
115 | 124 |
116 test("url_unittests") { | 125 test("url_unittests") { |
117 sources = [ | 126 sources = [ |
118 "gurl_unittest.cc", | 127 "gurl_unittest.cc", |
119 "origin_unittest.cc", | 128 "origin_unittest.cc", |
120 "run_all_unittests.cc", | 129 "run_all_unittests.cc", |
121 "scheme_host_port_unittest.cc", | 130 "scheme_host_port_unittest.cc", |
122 "url_canon_icu_unittest.cc", | 131 "url_canon_icu_unittest.cc", |
123 "url_canon_unittest.cc", | 132 "url_canon_unittest.cc", |
124 "url_parse_unittest.cc", | 133 "url_parse_unittest.cc", |
125 "url_test_utils.h", | 134 "url_test_utils.h", |
126 "url_util_unittest.cc", | 135 "url_util_unittest.cc", |
127 ] | 136 ] |
128 | 137 |
129 if (!is_ios) { | 138 if (!is_ios) { |
130 sources += [ "mojo/url_gurl_struct_traits_unittest.cc" ] | 139 sources += [ "mojo/url_gurl_struct_traits_unittest.cc" ] |
131 } | 140 } |
132 | 141 |
142 # Unit tests that are not supported by the current ICU alternatives on Android . | |
143 if (is_android && use_platform_icu_alternatives) { | |
144 sources -= [ | |
145 "origin_unittest.cc", | |
146 "scheme_host_port_unittest.cc", | |
147 "url_canon_icu_unittest.cc", | |
mef
2016/04/04 22:25:43
It's a bit strange that it fails on Android, shoul
kapishnikov
2016/04/05 15:22:04
The test depends on ICUCharsetConverter
https://co
| |
148 "url_canon_unittest.cc", | |
149 ] | |
150 } | |
151 | |
152 # Unit tests that are not supported by the current ICU alternatives on iOS. | |
153 if (is_ios && use_platform_icu_alternatives) { | |
154 sources -= [ | |
155 "origin_unittest.cc", | |
156 "scheme_host_port_unittest.cc", | |
157 "url_canon_icu_unittest.cc", | |
158 "url_canon_unittest.cc", | |
159 ] | |
160 } | |
161 | |
133 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. | 162 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. |
134 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] | 163 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
135 | 164 |
136 deps = [ | 165 deps = [ |
137 ":url", | 166 ":url", |
138 "//base", | 167 "//base", |
139 "//base/test:test_support", | 168 "//base/test:test_support", |
140 "//testing/gtest", | 169 "//testing/gtest", |
141 "//third_party/icu:icuuc", | 170 "//third_party/icu:icuuc", |
142 ] | 171 ] |
143 | 172 |
144 if (!is_ios) { | 173 if (!is_ios) { |
145 deps += [ | 174 deps += [ |
146 "//mojo/edk/system", | 175 "//mojo/edk/system", |
147 "//mojo/edk/test:test_support", | 176 "//mojo/edk/test:test_support", |
148 "//url/mojo:test_url_mojom_gurl", | 177 "//url/mojo:test_url_mojom_gurl", |
149 ] | 178 ] |
150 } | 179 } |
151 } | 180 } |
OLD | NEW |