# Copyright 2016 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/rules.gni") import("//chrome/android/webapk/libs/runtime_library_version.gni") # runtime_library_version.gni must be updated whenever the runtime library is # updated. The WebAPK re-extracts the runtime library from the Chrome APK when # |runtime_library_version| is incremented. # Whenever this constant is changed, WebApkUtils#getRuntimeDexName() must also # be changed. runtime_library_dex_asset_name = "webapk$runtime_library_version.dex" android_aidl("webapk_service_aidl") { import_include = [ "src/org/chromium/webapk/lib/runtime_library" ] interface_file = "src/org/chromium/webapk/lib/runtime_library/common.aidl" sources = [ "src/org/chromium/webapk/lib/runtime_library/IWebApkApi.aidl", ] } # A standalone jar for the aidl's generated java files so that multiple places # can depend on the aidl. android_library("webapk_service_aidl_java") { srcjar_deps = [ ":webapk_service_aidl" ] } # runtime_library_from_assets_java cannot be used as a dependency of another # library because the dx tool expects files ending in .dex.jar android_library("runtime_library_for_assets_java") { java_files = [ "src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java" ] srcjar_deps = [ ":webapk_service_aidl" ] deps = [ "//third_party/android_tools:android_support_v4_java", ] } # The subset of runtime_library_from_assets_java needed for tests. android_library("runtime_library_for_tests_java") { java_files = [ "src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java" ] deps = [ ":webapk_service_aidl_java", "//third_party/android_tools:android_support_v4_java", ] } dist_jar("webapk_runtime_library") { requires_android = true deps = [ ":runtime_library_for_assets_java", ] proguard_enabled = true proguard_configs = [ "runtime_library.proguard.flags", "//base/android/proguard/chromium_code.flags", "//base/android/proguard/chromium_apk.flags", ] output = "$target_gen_dir/$target_name.jar" dex_path = "$target_gen_dir/$runtime_library_dex_asset_name" } android_assets("runtime_library_assets") { write_file("$target_gen_dir/webapk_dex_version.txt", runtime_library_version) sources = [ "$target_gen_dir/$runtime_library_dex_asset_name", "$target_gen_dir/webapk_dex_version.txt", ] deps = [ ":webapk_runtime_library", ] } android_library("runtime_library_javatests") { testonly = true java_files = [ "javatests/src/org/chromium/webapk/lib/runtime_library/WebApkServiceImplTest.java" ] deps = [ ":runtime_library_for_tests_java", ":webapk_service_aidl_java", "//base:base_java_test_support", "//chrome/test/android:chrome_java_test_support", "//content/public/test/android:content_java_test_support", "//third_party/android_support_test_runner:runner_java", "//third_party/junit", ] }