82e3afa99d
gn_to_bp: wrap defines in ifndef create_apk.py assumes you are either run from the aosp tree, or you are being run from make_universal_apk.py, which now defers to create_apk.py for all functionality, even argument parsing. tools/skqp/generate_gn_args moved some functionity into skqp_gn_args.py, which is now used by create_apk.py create_apk now accepts android sdk license for you. create_apk and make_universal_apk.py now are better about cleaning up after exceptions happen. Old script make_apk.sh now just points at make_universal_apk.py CQ_INCLUDE_TRYBOTS=skia.primary:Build-Debian9-Clang-x86-devrel-Android_SKQP,Test-Debian9-Clang-NUC7i5BNK-CPU-Emulator-x86-devrel-All-Android_SKQP Change-Id: I2dba20ef7017987cabb2bd49f070e2b1594785d5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235678 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
47 lines
1.6 KiB
Python
Executable File
47 lines
1.6 KiB
Python
Executable File
#! /usr/bin/env python
|
|
|
|
# Copyright 2018 Google Inc.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import argparse
|
|
import os
|
|
import sys
|
|
|
|
import skqp_gn_args
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser(description='Generate args.gn file.')
|
|
parser.add_argument('target_build_dir')
|
|
parser.add_argument('android_ndk_dir' )
|
|
parser.add_argument('--arch', metavar='architecture', default='arm',
|
|
help='defaults to "arm", valid values: "arm" "arm64" "x86" "x64"')
|
|
parser.add_argument('--api_level', type=int, metavar='api_level',
|
|
default=26, help='android API level, defaults to 26')
|
|
parser.add_argument('--debug', default=False, action='store_true',
|
|
help='compile native code in debug mode, defaults to false')
|
|
args = parser.parse_args()
|
|
result = skqp_gn_args.GetGNArgs(args.arch,
|
|
os.path.abspath(args.android_ndk_dir),
|
|
args.debug,
|
|
args.api_level)
|
|
return args.target_build_dir, result)
|
|
|
|
def write_gn(o, args):
|
|
l = max(len(k) for k in args)
|
|
for k, v in sorted(args.items()):
|
|
o.write('%-*s = %s\n' % (l, k, v))
|
|
|
|
def make_args_gn(out_dir, args):
|
|
if out_dir == '-':
|
|
write_gn(sys.stdout, args)
|
|
return
|
|
if not os.path.exists(out_dir):
|
|
os.makedirs(out_dir)
|
|
with open(os.path.join(out_dir, 'args.gn'), 'w') as o:
|
|
write_gn(o, args)
|
|
|
|
if __name__ == '__main__':
|
|
build_dir, args = parse_args()
|
|
make_args_gn(build_dir, args)
|