1#!/usr/bin/env python3
2#
3# Copyright 2020 The Chromium Authors. All rights reserved.
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
17
18def main():
19  classpath = [
20      os.path.join(DIR_SOURCE_ROOT, 'build', 'android', 'stacktrace',
21                   'java_deobfuscate.jar'),
22      os.path.join(DIR_SOURCE_ROOT, 'third_party', 'proguard', 'lib',
23                   'proguard603.jar'),
24      os.path.join(DIR_SOURCE_ROOT, 'third_party', 'proguard', 'lib',
25                   'retrace603.jar'),
26  ]
27  java_path = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'jdk', 'current',
28                           'bin', 'java')
29
30  cmd = [
31      java_path, '-classpath', ':'.join(classpath),
32      'org.chromium.build.FlushingReTrace'
33  ]
34  cmd.extend(sys.argv[1:])
35  os.execvp(cmd[0], cmd)
36
37
38if __name__ == '__main__':
39  main()
40