xref: /aosp_15_r20/external/cronet/build/android/stacktrace/java_deobfuscate.py (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1#!/usr/bin/env python3
2#
3# Copyright 2020 The Chromium Authors
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6"""Wrapper script for java_deobfuscate.
7
8This is also a buildable target, but having it pre-built here simplifies usage.
9"""
10
11import os
12import sys
13
14DIR_SOURCE_ROOT = os.path.normpath(
15    os.path.join(os.path.dirname(__file__), '../../../'))
16
17def main():
18  classpath = [
19      os.path.join(DIR_SOURCE_ROOT, 'build', 'android', 'stacktrace',
20                   'java_deobfuscate_java.jar'),
21      os.path.join(DIR_SOURCE_ROOT, 'third_party', 'r8', 'lib', 'r8.jar')
22  ]
23  java_path = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'jdk', 'current',
24                           'bin', 'java')
25
26  cmd = [
27      java_path, '-classpath', ':'.join(classpath),
28      'org.chromium.build.FlushingReTrace'
29  ]
30  cmd.extend(sys.argv[1:])
31
32  os.execvp(cmd[0], cmd)
33
34
35if __name__ == '__main__':
36  main()
37