2018-01-28 19:30:36 +03:00
|
|
|
# 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("//build/buildflag_header.gni")
|
|
|
|
import("//testing/test.gni")
|
|
|
|
import("features.gni")
|
|
|
|
|
|
|
|
if (is_android) {
|
|
|
|
import("//build/config/android/rules.gni")
|
|
|
|
}
|
|
|
|
|
|
|
|
buildflag_header("url_features") {
|
|
|
|
header = "url_features.h"
|
|
|
|
flags = [ "USE_PLATFORM_ICU_ALTERNATIVES=$use_platform_icu_alternatives" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
component("url") {
|
|
|
|
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",
|
|
|
|
"url_util_internal.h",
|
|
|
|
]
|
|
|
|
|
|
|
|
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",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (is_win) {
|
|
|
|
# Don't conflict with Windows' "url.dll".
|
|
|
|
output_name = "url_lib"
|
|
|
|
}
|
|
|
|
|
|
|
|
# ICU support.
|
|
|
|
if (use_platform_icu_alternatives) {
|
|
|
|
if (is_android) {
|
|
|
|
sources += [ "url_canon_icu_alternatives_android.cc" ]
|
|
|
|
deps += [
|
|
|
|
":url_features",
|
|
|
|
":url_java",
|
|
|
|
":url_jni_headers",
|
|
|
|
"//base",
|
|
|
|
"//base/third_party/dynamic_annotations",
|
|
|
|
]
|
|
|
|
} else if (is_ios) {
|
|
|
|
sources += [ "url_canon_icu_alternatives_ios.mm" ]
|
|
|
|
} else {
|
2018-01-25 13:02:13 +03:00
|
|
|
sources += [ "url_canon_icu_alternatives_dummy.cc" ]
|
2018-01-28 19:30:36 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Use ICU.
|
|
|
|
sources += [
|
|
|
|
"url_canon_icu.cc",
|
|
|
|
"url_canon_icu.h",
|
|
|
|
]
|
|
|
|
deps += [ "//third_party/icu" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_android) {
|
|
|
|
android_library("url_java") {
|
|
|
|
java_files = [ "android/java/src/org/chromium/url/IDNStringUtil.java" ]
|
|
|
|
deps = [
|
|
|
|
"//base:base_java",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
generate_jni("url_jni_headers") {
|
|
|
|
sources = [
|
|
|
|
"android/java/src/org/chromium/url/IDNStringUtil.java",
|
|
|
|
]
|
|
|
|
jni_package = "url"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("url_unittests") {
|
|
|
|
sources = [
|
|
|
|
"gurl_unittest.cc",
|
|
|
|
"origin_unittest.cc",
|
|
|
|
"run_all_unittests.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",
|
|
|
|
]
|
|
|
|
|
|
|
|
deps = [
|
|
|
|
":url",
|
|
|
|
"//base",
|
|
|
|
"//base/test:test_support",
|
|
|
|
"//testing/gtest",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (!is_ios) {
|
|
|
|
sources += [ "mojo/url_gurl_struct_traits_unittest.cc" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (use_platform_icu_alternatives) {
|
|
|
|
# Unit tests that are not supported by the current ICU alternatives on Android.
|
|
|
|
if (is_android) {
|
|
|
|
sources -= [
|
|
|
|
"url_canon_icu_unittest.cc",
|
|
|
|
"url_canon_unittest.cc",
|
|
|
|
]
|
|
|
|
deps += [ ":url_java" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
# Unit tests that are not supported by the current ICU alternatives on iOS.
|
|
|
|
if (is_ios) {
|
|
|
|
sources -= [
|
|
|
|
"origin_unittest.cc",
|
|
|
|
"scheme_host_port_unittest.cc",
|
|
|
|
"url_canon_icu_unittest.cc",
|
|
|
|
"url_canon_unittest.cc",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
} else { # !use_platform_icu_alternatives
|
|
|
|
deps += [ "//third_party/icu:icuuc" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
|
|
|
|
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
|
|
|
|
|
|
|
|
if (!is_ios) {
|
|
|
|
deps += [
|
|
|
|
"//mojo/edk/system",
|
|
|
|
"//mojo/edk/test:test_support",
|
|
|
|
"//url/mojo:test_url_mojom_gurl",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|