• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/android/rules.gni")
6
7java_binary("bytecode_processor") {
8  main_class = "org.chromium.bytecode.ByteCodeProcessor"
9  wrapper_script_name = "helper/bytecode_processor"
10  deps = [ ":bytecode_processor_java" ]
11}
12
13java_library("bytecode_processor_java") {
14  sources = [
15    "java/org/chromium/bytecode/ByteCodeProcessor.java",
16    "java/org/chromium/bytecode/ClassPathValidator.java",
17    "java/org/chromium/bytecode/TypeUtils.java",
18  ]
19  deps = [
20    "//third_party/android_deps:org_ow2_asm_asm_java",
21    "//third_party/android_deps:org_ow2_asm_asm_util_java",
22  ]
23  enable_bytecode_checks = false
24}
25
26# A bytecode rewriter that replaces all calls to
27# `FragmentActivity Fragment.getActivity()` with
28# `Activity Fragment.getActivity()`.
29java_binary("fragment_activity_replacer") {
30  main_class = "org.chromium.bytecode.FragmentActivityReplacer"
31  deps = [ ":fragment_activity_replacer_java" ]
32  wrapper_script_name = "helper/fragment_activity_replacer"
33}
34
35# A bytecode rewriter that replaces all calls to
36# `FragmentActivity Fragment.getActivity()` with
37# `Activity Fragment.getActivity()`  followed by a cast to FragmentActivity.
38# Prefer :fragment_activity_replacer. This rewriter should only be used for
39# libraries that rely on getActivity() returning a FragmentActivity *and* are
40# not going to be used in an app that contains multiple copies of the AndroidX
41# Fragment library (i.e. WebLayer).
42java_binary("fragment_activity_replacer_single_androidx") {
43  main_class = "org.chromium.bytecode.FragmentActivityReplacer"
44  deps = [ ":fragment_activity_replacer_java" ]
45  wrapper_script_name = "helper/fragment_activity_replacer_single_androidx"
46  wrapper_script_args = [ "--single-androidx" ]
47}
48
49java_library("fragment_activity_replacer_java") {
50  visibility = [ ":*" ]
51  sources = [
52    "java/org/chromium/bytecode/ByteCodeRewriter.java",
53    "java/org/chromium/bytecode/FragmentActivityReplacer.java",
54  ]
55  deps = [
56    "//third_party/android_deps:org_ow2_asm_asm_commons_java",
57    "//third_party/android_deps:org_ow2_asm_asm_java",
58    "//third_party/android_deps:org_ow2_asm_asm_util_java",
59  ]
60}
61
62java_binary("trace_event_adder") {
63  main_class = "org.chromium.bytecode.TraceEventAdder"
64  deps = [ ":trace_event_adder_java" ]
65  wrapper_script_name = "helper/trace_event_adder"
66}
67
68java_library("trace_event_adder_java") {
69  visibility = [ ":*" ]
70  sources = [
71    "java/org/chromium/bytecode/ByteCodeRewriter.java",
72    "java/org/chromium/bytecode/EmptyOverrideGeneratorClassAdapter.java",
73    "java/org/chromium/bytecode/MethodCheckerClassAdapter.java",
74    "java/org/chromium/bytecode/MethodDescription.java",
75    "java/org/chromium/bytecode/ParentMethodCheckerClassAdapter.java",
76    "java/org/chromium/bytecode/TraceEventAdder.java",
77    "java/org/chromium/bytecode/TraceEventAdderClassAdapter.java",
78    "java/org/chromium/bytecode/TraceEventAdderMethodAdapter.java",
79  ]
80  deps = [
81    ":bytecode_processor_java",
82    "//third_party/android_deps:org_ow2_asm_asm_commons_java",
83    "//third_party/android_deps:org_ow2_asm_asm_java",
84    "//third_party/android_deps:org_ow2_asm_asm_util_java",
85  ]
86}
87