123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- # 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
- }
- 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
- }
- }
- generate_build_config_srcjar("build_config_gen") {
- use_final_fields = false
- }
- generate_build_config_srcjar("build_config_for_testing_gen") {
- use_final_fields = false
- testonly = true
- }
- write_native_libraries_java("native_libraries_gen") {
- use_final_fields = false
- }
- java_library("build_java") {
- supports_android = true
- srcjar_deps = [
- ":build_config_gen",
- ":native_libraries_gen",
- ]
- sources = [
- "java/src/org/chromium/base/annotations/CheckDiscard.java",
- "java/src/org/chromium/base/annotations/DoNotClassMerge.java",
- "java/src/org/chromium/base/annotations/DoNotInline.java",
- "java/src/org/chromium/base/annotations/IdentifierNameString.java",
- "java/src/org/chromium/base/annotations/MainDex.java",
- "java/src/org/chromium/base/annotations/MockedInTests.java",
- "java/src/org/chromium/base/annotations/UsedByReflection.java",
- ]
- jar_excluded_patterns = [ "*/build/BuildConfig.class" ]
- # New version of NativeLibraries.java (with the actual correct values) will
- # be created when creating an apk.
- jar_excluded_patterns += [ "*/NativeLibraries.class" ]
- }
- # Not all //build embedders pull in junit_binary deps that live in //third_party.
- if (build_with_chromium) {
- android_assets("junit_test_assets") {
- testonly = true
- # We just need any file here, so use the test itself.
- sources = [ "junit/src/org/chromium/build/AndroidAssetsTest.java" ]
- }
- android_resources("junit_test_resources") {
- testonly = true
- sources = [ "junit/res/values/strings.xml" ]
- mergeable_android_manifests = [ "junit/AndroidManifest_mergetest.xml" ]
- }
- robolectric_binary("build_junit_tests") {
- # Test has no JNI, so skip JNI Generator step.
- generate_final_jni = false
- resources_package = "org.chromium.build"
- sources = [
- "junit/src/org/chromium/build/AndroidAssetsTest.java",
- "junit/src/org/chromium/build/IncrementalJavacTest.java",
- ]
- deps = [
- ":junit_test_assets",
- ":junit_test_resources",
- "//build/android/test/incremental_javac_gn:no_signature_change_prebuilt_java",
- "//third_party/junit",
- ]
- }
- }
- }
- # TODO(go/turn-down-test-results): Remove once we turn down
- # test-results.appspot.com
- python_library("test_result_presentations_py") {
- pydeps_file = "pylib/results/presentation/test_results_presentation.pydeps"
- data = [
- "//build/android/pylib/results/presentation/template",
- "//build/android/pylib/results/presentation/javascript/main_html.js",
- "//third_party/catapult/third_party/gsutil/",
- "//third_party/jinja2/debug.py",
- "//third_party/six",
- ]
- }
- 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",
- # Read by gn_helpers.BuildWithChromium()
- "//build/config/gclient_args.gni",
- ]
- }
- # Contains runtime deps for installing apks.
- # E.g. from test_runner.py or from apk_operations.py.
- group("apk_installer_data") {
- # Other //build users let devil library fetch these from Google Storage.
- if (build_with_chromium) {
- data_deps = [
- "//build/android/pylib/device/commands",
- "//tools/android/md5sum",
- ]
- data = [ "//third_party/android_build_tools/bundletool/bundletool.jar" ]
- }
- }
- python_library("apk_operations_py") {
- pydeps_file = "apk_operations.pydeps"
- deps = [ ":apk_installer_data" ]
- }
- group("test_runner_py") {
- testonly = true
- deps = [
- ":test_runner_core_py",
- ":test_runner_device_support",
- ]
- }
- python_library("test_runner_core_py") {
- testonly = true
- pydeps_file = "test_runner.pydeps"
- data = [
- "pylib/gtest/filter/",
- "pylib/instrumentation/render_test.html.jinja",
- "test_wrapper/logdog_wrapper.py",
- "//third_party/requests/",
- ]
- data_deps = [ ":logdog_wrapper_py" ]
- }
- group("test_runner_device_support") {
- testonly = true
- data = [
- "${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",
- ]
- data_deps = [
- ":apk_installer_data",
- ":devil_chromium_py",
- ":stack_tools",
- ]
- # Other //build users let devil library fetch these from Google Storage.
- if (build_with_chromium) {
- data_deps += [ "//tools/android/forwarder2" ]
- data += [ "//tools/android/avd/proto/" ]
- 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) {
- data_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,
- rebase_path("$android_ndk_library_path/libc++.so.1", root_build_dir),
- ]
- }
- # 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.
- # TODO(crbug.com/1120190): Move stack script into //build/third_party
- # and enable unconditionally.
- group("stack_tools") {
- if (build_with_chromium) {
- 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")
|