summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/build/android/bytecode/BUILD.gn
blob: 8d717eb0adaa80aa6702f497bc21aec04a875c2b (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
# Copyright 2017 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")

java_binary("bytecode_processor") {
  main_class = "org.chromium.bytecode.ByteCodeProcessor"
  wrapper_script_name = "helper/bytecode_processor"
  deps = [ ":bytecode_processor_java" ]
}

java_library("bytecode_processor_java") {
  sources = [
    "java/org/chromium/bytecode/ByteCodeProcessor.java",
    "java/org/chromium/bytecode/ClassPathValidator.java",
    "java/org/chromium/bytecode/TypeUtils.java",
  ]
  deps = [
    "//third_party/android_deps:org_ow2_asm_asm_java",
    "//third_party/android_deps:org_ow2_asm_asm_util_java",
  ]
  enable_bytecode_checks = false
}

# A bytecode rewriter that replaces all calls to
# `FragmentActivity Fragment.getActivity()` with
# `Activity Fragment.getActivity()`.
java_binary("fragment_activity_replacer") {
  main_class = "org.chromium.bytecode.FragmentActivityReplacer"
  deps = [ ":fragment_activity_replacer_java" ]
  wrapper_script_name = "helper/fragment_activity_replacer"
}

# A bytecode rewriter that replaces all calls to
# `FragmentActivity Fragment.getActivity()` with
# `Activity Fragment.getActivity()`  followed by a cast to FragmentActivity.
# Prefer :fragment_activity_replacer. This rewriter should only be used for
# libraries that rely on getActivity() returning a FragmentActivity *and* are
# not going to be used in an app that contains multiple copies of the AndroidX
# Fragment library (i.e. WebLayer).
java_binary("fragment_activity_replacer_single_androidx") {
  main_class = "org.chromium.bytecode.FragmentActivityReplacer"
  deps = [ ":fragment_activity_replacer_java" ]
  wrapper_script_name = "helper/fragment_activity_replacer_single_androidx"
  wrapper_script_args = [ "--single-androidx" ]
}

java_library("fragment_activity_replacer_java") {
  visibility = [ ":*" ]
  sources = [
    "java/org/chromium/bytecode/ByteCodeRewriter.java",
    "java/org/chromium/bytecode/FragmentActivityReplacer.java",
  ]
  deps = [
    "//third_party/android_deps:org_ow2_asm_asm_commons_java",
    "//third_party/android_deps:org_ow2_asm_asm_java",
    "//third_party/android_deps:org_ow2_asm_asm_util_java",
  ]
}

java_binary("trace_event_adder") {
  main_class = "org.chromium.bytecode.TraceEventAdder"
  deps = [ ":trace_event_adder_java" ]
  wrapper_script_name = "helper/trace_event_adder"
}

java_library("trace_event_adder_java") {
  visibility = [ ":*" ]
  sources = [
    "java/org/chromium/bytecode/ByteCodeRewriter.java",
    "java/org/chromium/bytecode/EmptyOverrideGeneratorClassAdapter.java",
    "java/org/chromium/bytecode/MethodCheckerClassAdapter.java",
    "java/org/chromium/bytecode/MethodDescription.java",
    "java/org/chromium/bytecode/ParentMethodCheckerClassAdapter.java",
    "java/org/chromium/bytecode/TraceEventAdder.java",
    "java/org/chromium/bytecode/TraceEventAdderClassAdapter.java",
    "java/org/chromium/bytecode/TraceEventAdderMethodAdapter.java",
  ]
  deps = [
    ":bytecode_processor_java",
    "//third_party/android_deps:org_ow2_asm_asm_commons_java",
    "//third_party/android_deps:org_ow2_asm_asm_java",
    "//third_party/android_deps:org_ow2_asm_asm_util_java",
  ]
}