webrtc_m130/examples/androidtests/gradle_project_test.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
2.5 KiB
Python
Raw Normal View History

#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""
This scripts tests creating an Android Studio project using the
generate_gradle.py script and making a debug build using it.
It expect to be given the webrtc output build directory as the first argument
all other arguments are optional.
"""
import argparse
import logging
import os
import shutil
import subprocess
import sys
import tempfile
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
GENERATE_GRADLE_SCRIPT = os.path.join(SRC_DIR,
'build/android/gradle/generate_gradle.py')
GRADLEW_BIN = os.path.join(SCRIPT_DIR, 'third_party/gradle/gradlew')
def _RunCommand(argv, cwd=SRC_DIR, **kwargs):
logging.info('Running %r', argv)
subprocess.check_call(argv, cwd=cwd, **kwargs)
def _ParseArgs():
parser = argparse.ArgumentParser(
description='Test generating Android gradle project.')
parser.add_argument('build_dir_android',
help='The path to the build directory for Android.')
parser.add_argument('--project_dir',
help='A temporary directory to put the output.')
args = parser.parse_args()
return args
def main():
logging.basicConfig(level=logging.INFO)
args = _ParseArgs()
project_dir = args.project_dir
if not project_dir:
project_dir = tempfile.mkdtemp()
output_dir = os.path.abspath(args.build_dir_android)
project_dir = os.path.abspath(project_dir)
try:
env = os.environ.copy()
env['PATH'] = os.pathsep.join([
os.path.join(SRC_DIR, 'third_party', 'depot_tools'), env.get('PATH', '')
])
_RunCommand([GENERATE_GRADLE_SCRIPT, '--output-directory', output_dir,
'--target', '//examples:AppRTCMobile',
'--project-dir', project_dir,
Roll chromium_revision f93b8b19f2..adf969a7cb (513366:514871) and more. MORE: ----- * Get rid of canary in gradle_project_test. This follows http://crrev.com/a959a6cf * Switch Android binary deps to be managed by CIPD. This mirrors http://crrev.com/b80cf484 CHROMIUM ROLL: -------------- Change log: https://chromium.googlesource.com/chromium/src/+log/f93b8b19f2..adf969a7cb Full diff: https://chromium.googlesource.com/chromium/src/+/f93b8b19f2..adf969a7cb Changed dependencies: * src/base: https://chromium.googlesource.com/chromium/src/base/+log/eec763edae..a7b41d733d * src/build: https://chromium.googlesource.com/chromium/src/build/+log/4ef2624fab..f157e447ed * src/buildtools: https://chromium.googlesource.com/chromium/buildtools.git/+log/3275a099f3..73ddd64be6 * src/ios: https://chromium.googlesource.com/chromium/src/ios/+log/9e4709d134..4aa21e3299 * src/testing: https://chromium.googlesource.com/chromium/src/testing/+log/a8c077a658..fc66e396f9 * src/third_party: https://chromium.googlesource.com/chromium/src/third_party/+log/3bd34f929d..7b30c21c2c * src/third_party/android_tools: https://chromium.googlesource.com/android_tools.git/+log/ca0bd08387..4a9623af57 * src/third_party/boringssl/src: https://boringssl.googlesource.com/boringssl.git/+log/664e99a648..6cc352e216 * src/third_party/catapult: https://chromium.googlesource.com/catapult.git/+log/14715602e0..af046c52f1 * src/third_party/depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+log/70dea4270e..c4ccb4b623 * src/third_party/ffmpeg: https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/f9e8b42758..c33a5ee8e7 * src/third_party/icu: https://chromium.googlesource.com/chromium/deps/icu.git/+log/21d33b1a09..b31896655a * src/tools: https://chromium.googlesource.com/chromium/src/tools/+log/b512b7250b..29a3411140 * src/tools/swarming_client: https://chromium.googlesource.com/infra/luci/client-py.git/+log/5da404cf35..6fd3c7b6eb DEPS diff: https://chromium.googlesource.com/chromium/src/+/f93b8b19f2..adf969a7cb/DEPS Clang version changed 315613:317263 Details: https://chromium.googlesource.com/chromium/src/+/f93b8b19f2..adf969a7cb/tools/clang/scripts/update.py TBR=phoglund@webrtc.org, sakal@webrtc.org CQ_INCLUDE_TRYBOTS=master.internal.tryserver.corp.webrtc:linux_internal Bug: webrtc:8501 Change-Id: I28b0e78748e2441247d7d3b7976eec957ac47726 Reviewed-on: https://webrtc-review.googlesource.com/21400 Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org> Reviewed-by: Edward Lemur <ehmaldonado@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20603}
2017-11-08 19:08:54 +01:00
'--use-gradle-process-resources', '--split-projects'],
env=env)
_RunCommand([GRADLEW_BIN, 'assembleDebug'], project_dir)
finally:
# Do not delete temporary directory if user specified it manually.
if not args.project_dir:
shutil.rmtree(project_dir, True)
if __name__ == '__main__':
sys.exit(main())