tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bundletool.py (1360B)


      1 #!/usr/bin/env python3
      2 # Copyright 2018 The Chromium Authors
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 """Simple wrapper around the bundletool tool.
      7 
      8 Bundletool is distributed as a versioned jar file. This script abstracts the
      9 location and version of this jar file, as well as the JVM invokation."""
     10 
     11 # Warning: Check if still being run as python2: https://crbug.com/1322618
     12 
     13 import logging
     14 import os
     15 import sys
     16 
     17 from util import build_utils
     18 
     19 # Assume this is stored under build/android/gyp/
     20 BUNDLETOOL_DIR = os.path.abspath(os.path.join(
     21    __file__, '..', '..', '..', '..', 'third_party', 'android_build_tools',
     22    'bundletool', 'cipd'))
     23 
     24 BUNDLETOOL_JAR_PATH = os.path.join(BUNDLETOOL_DIR, 'bundletool.jar')
     25 
     26 
     27 def RunBundleTool(args, print_stdout=False):
     28  # ASAN builds failed with the default of 1GB (crbug.com/1120202).
     29  # Bug for bundletool: https://issuetracker.google.com/issues/165911616
     30  cmd = build_utils.JavaCmd(xmx='4G')
     31  cmd += ['-jar', BUNDLETOOL_JAR_PATH]
     32  cmd += args
     33  logging.debug(' '.join(cmd))
     34  return build_utils.CheckOutput(
     35      cmd,
     36      print_stdout=print_stdout,
     37      print_stderr=True,
     38      fail_on_output=False,
     39      stderr_filter=build_utils.FilterReflectiveAccessJavaWarnings)
     40 
     41 
     42 if __name__ == '__main__':
     43  RunBundleTool(sys.argv[1:], print_stdout=True)