java_deobfuscate.py 975 B

123456789101112131415161718192021222324252627282930313233343536
  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. This is also a buildable target, but having it pre-built here simplifies usage.
  8. """
  9. import os
  10. import sys
  11. DIR_SOURCE_ROOT = os.path.normpath(
  12. os.path.join(os.path.dirname(__file__), '../../../'))
  13. def main():
  14. classpath = [
  15. os.path.join(DIR_SOURCE_ROOT, 'build', 'android', 'stacktrace',
  16. 'java_deobfuscate_java.jar'),
  17. os.path.join(DIR_SOURCE_ROOT, 'third_party', 'r8', 'lib', 'r8.jar')
  18. ]
  19. java_path = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'jdk', 'current',
  20. 'bin', 'java')
  21. cmd = [
  22. java_path, '-classpath', ':'.join(classpath),
  23. 'org.chromium.build.FlushingReTrace'
  24. ]
  25. cmd.extend(sys.argv[1:])
  26. os.execvp(cmd[0], cmd)
  27. if __name__ == '__main__':
  28. main()