summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/android/webapk/libs/runtime_library/BUILD.gn
blob: 7b3b7d7e34f74df2eb885263ee48203b1b016f0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# 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") {
  jacoco_never_instrument = true
  java_files =
      [ "src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java" ]
  srcjar_deps = [ ":webapk_service_aidl" ]
  deps = [
    "//third_party/android_deps:com_android_support_support_compat_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_deps:com_android_support_support_compat_java",
  ]
}

proguarded_dist_dex("webapk_runtime_library") {
  deps = [
    ":runtime_library_for_assets_java",
  ]
  proguard_configs = [
    "runtime_library.proguard.flags",
    "//base/android/proguard/chromium_code.flags",
    "//base/android/proguard/chromium_apk.flags",
  ]
  output = "$target_out_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/webapk_dex_version.txt",
    "$target_out_dir/$runtime_library_dex_asset_name",
  ]

  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",
  ]
}