Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: webrtc/examples/androidtests/gradle_project_test.py

Issue 2858043006: Test for Gradle project generation. (Closed)
Patch Set: Test for Gradle project generation. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/examples/androidtests/gradle/gradlew.bat ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 #
4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree.
9
10 """
11 This scripts tests creating an Android Studio project using the
12 generate_gradle.py script and making a debug build using it.
13
14 It expect to be given the webrtc output build directory as the first argument
15 all other arguments are optional.
16 """
17
18 import argparse
19 import logging
20 import os
21 import shutil
22 import subprocess
23 import sys
24 import tempfile
25
kjellander_webrtc 2017/05/05 07:30:13 "Two blank lines between top-level definitions, on
sakal 2017/05/05 07:53:26 Done.
26 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
27 SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
28 os.pardir))
29 GENERATE_GRADLE_SCRIPT = os.path.join(SRC_DIR,
30 'build/android/gradle/generate_gradle.py')
31 GRADLEW_BIN = os.path.join(SCRIPT_DIR, 'gradle/gradlew')
32
33 def _RunCommand(argv, cwd=SRC_DIR, **kwargs):
34 logging.info('Running %r', argv)
35 subprocess.check_call(argv, cwd=cwd, **kwargs)
36
37 def _ParseArgs():
38 parser = argparse.ArgumentParser(
39 description='Test generating Android gradle project.')
40 parser.add_argument('build_dir_android',
41 help='The path to the build directory for Android.')
42 parser.add_argument('--project_dir',
43 help='A temporary directory to put the output.')
44
45 args = parser.parse_args()
46 return args
47
48 def main():
49 logging.basicConfig(level=logging.INFO)
50 args = _ParseArgs()
51
52 project_dir = args.project_dir
53 if not project_dir:
54 project_dir = tempfile.mkdtemp()
55
56 output_dir = os.path.abspath(args.build_dir_android)
57 project_dir = os.path.abspath(project_dir)
58
59 _RunCommand([GENERATE_GRADLE_SCRIPT, '--output-directory', output_dir,
60 '--target', '//webrtc/examples:AppRTCMobile',
61 '--project-dir', project_dir,
62 '--use-gradle-process-resources', '--split-projects'])
63 _RunCommand([GRADLEW_BIN, 'assembleDebug'], project_dir)
kjellander_webrtc 2017/05/05 07:30:13 Is this going to build AppRTCMobile or everything?
sakal 2017/05/05 07:53:26 This is building AppRTCMobile. It is copying pre-c
kjellander_webrtc 2017/05/05 08:38:45 That's fine, let's just build this now, 15 seconds
64
65 shutil.rmtree(project_dir, True)
kjellander_webrtc 2017/05/05 07:30:13 Please put lines 59-63 within a a try: block and p
sakal 2017/05/05 07:53:26 Done.
66
67 if __name__ == '__main__':
68 sys.exit(main())
OLDNEW
« no previous file with comments | « webrtc/examples/androidtests/gradle/gradlew.bat ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698