blob: fc26e9317778b83294c1c31270d8782690671223 [file] [log] [blame]
# Copyright 2014 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/config/android/build_vars.gni")
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/python.gni")
import("//build_overrides/build.gni")
if (enable_java_templates) {
# Create or update the API versions cache if necessary by running a
# functionally empty lint task. This prevents racy creation of the
# cache while linting java targets in android_lint.
android_lint("prepare_android_lint_cache") {
create_cache = true
}
android_library("lint_test_java") {
sources = [ "java/test/LintTest.java" ]
}
android_apk("lint_test_apk") {
# This cannot be marked testonly since lint has special ignores for testonly
# targets. We need to test linting a normal apk target.
apk_name = "LintTest"
deps = [ ":lint_test_java" ]
android_manifest = "//build/android/AndroidManifest.xml"
}
android_lint("android_lint_test") {
lint_expected_warnings = "DefaultLocale,NewApi"
_test_apk_target = ":lint_test_apk"
deps = [ "${_test_apk_target}__java" ]
build_config_dep = "$_test_apk_target$build_config_target_suffix"
build_config = get_label_info(_test_apk_target, "target_gen_dir") + "/" +
get_label_info(_test_apk_target, "name") + ".build_config"
}
if (enable_jdk_library_desugaring) {
dex_jdk_libs("all_jdk_libs") {
output = "$target_out_dir/$target_name.l8.dex"
min_sdk_version = default_min_sdk_version
}
}
}
python_library("devil_chromium_py") {
pydeps_file = "devil_chromium.pydeps"
data = [
"devil_chromium.py",
"devil_chromium.json",
"//third_party/catapult/third_party/gsutil/",
"//third_party/catapult/devil/devil/devil_dependencies.json",
]
}
python_library("test_runner_py") {
testonly = true
pydeps_file = "test_runner.pydeps"
data = [
"pylib/gtest/filter/",
"pylib/instrumentation/render_test.html.jinja",
"test_wrapper/logdog_wrapper.py",
"${android_sdk_build_tools}/aapt",
"${android_sdk_build_tools}/dexdump",
"${android_sdk_build_tools}/lib64/libc++.so",
"${android_sdk_build_tools}/split-select",
"${android_sdk_root}/platform-tools/adb",
"//third_party/requests/",
]
data_deps = [ ":devil_chromium_py" ]
if (build_with_chromium) {
data += [
"//third_party/android_build_tools/bundletool/bundletool-all-1.2.0.jar",
"//tools/android/avd/proto/",
]
data_deps +=
[ "//third_party/android_platform/development/scripts:stack_py" ]
if (is_asan) {
data_deps += [ "//tools/android/asan/third_party:asan_device_setup" ]
}
}
# Proguard is needed only when using apks (rather than native executables).
if (enable_java_templates) {
deps = [ "//build/android/stacktrace:java_deobfuscate" ]
}
}
python_library("logdog_wrapper_py") {
pydeps_file = "test_wrapper/logdog_wrapper.pydeps"
}
python_library("resource_sizes_py") {
pydeps_file = "resource_sizes.pydeps"
data_deps = [
":devil_chromium_py",
"//third_party/catapult/tracing:convert_chart_json",
]
data = [
build_vars_file,
android_readelf,
]
}
python_library("bundle_wrapper_script_py") {
pydeps_file = "gyp/create_bundle_wrapper_script.pydeps"
data = [
"//third_party/android_build_tools/bundletool/bundletool-all-1.2.0.jar",
]
}
# Tools necessary for symbolizing tombstones or stack traces that are output to
# logcat.
# Hidden behind build_with_chromium because some third party repos that use
# //build don't pull in //third_party/android_platform.
if (build_with_chromium) {
group("stack_tools") {
data = [
"tombstones.py",
"pylib/symbols/",
"stacktrace/",
]
data_deps =
[ "//third_party/android_platform/development/scripts:stack_py" ]
}
}
# GN evaluates each .gn file once per toolchain, so restricting to default
# toolchain will ensure write_file() is called only once.
assert(current_toolchain == default_toolchain)
# NOTE: If other platforms would benefit from exporting variables, we should
# move this to a more top-level place.
# It is currently here (instead of //BUILD.gn) to ensure that the file is
# written even for non-chromium embedders of //build.
_build_vars_json = {
# Underscore prefix so that it appears at the top.
_HEADER = "Generated during 'gn gen' by //build/android/BUILD.gn."
forward_variables_from(android_build_vars_json, "*")
}
write_file(build_vars_file, _build_vars_json, "json")