diff options
author | Ravi Mistry <rmistry@google.com> | 2017-09-12 09:40:46 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-12 13:54:30 +0000 |
commit | ff72a0857f4d1b13f3fe9f8d99020e04e2507729 (patch) | |
tree | a40592ffb982dd624e21b7b7eead140278c0a6eb /tools/android | |
parent | a8e5744afadd20e217a7c70099a79a222d2e7e4f (diff) |
Add SK_DEBUG to SkUserConfig.h from upload_to_android.py if "--debug" flag is specified
Example uploaded change: https://googleplex-android-review.git.corp.google.com/#/c/platform/external/skia/+/2884102/
NoTry: true
Bug: skia:7016
Change-Id: Ia213e04532c7e4b8c90d01b8138a720f267bfa56
Reviewed-on: https://skia-review.googlesource.com/44822
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tools/android')
-rw-r--r-- | tools/android/upload_to_android.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/android/upload_to_android.py b/tools/android/upload_to_android.py index 01213db1e5..4704b43c1a 100644 --- a/tools/android/upload_to_android.py +++ b/tools/android/upload_to_android.py @@ -41,6 +41,7 @@ SKIA_PATH_IN_ANDROID = os.path.join('external', 'skia') ANDROID_REPO_URL = 'https://googleplex-android.googlesource.com' REPO_BRANCH_NAME = 'experiment' SKIA_GERRIT_INSTANCE = 'https://skia-review.googlesource.com' +SK_USER_CONFIG_PATH = os.path.join('include', 'config', 'SkUserConfig.h') def get_change_details(change_num): @@ -51,7 +52,7 @@ def get_change_details(change_num): return json.loads(content[5:]) -def upload_to_android(work_dir, change_num): +def upload_to_android(work_dir, change_num, debug): if not os.path.isdir(work_dir): print 'Creating %s' % work_dir os.makedirs(work_dir) @@ -121,6 +122,14 @@ About to run repo init. If it hangs asking you to run glogin then please: shell=True) subprocess.check_call('git cherry-pick FETCH_HEAD', shell=True) + if debug: + # Add SK_DEBUG to SkUserConfig.h. + with open(SK_USER_CONFIG_PATH, 'a') as f: + f.write('#ifndef SK_DEBUG\n') + f.write('#define SK_DEBUG\n') + f.write('#endif//SK_DEBUG\n') + subprocess.check_call('git add %s' % SK_USER_CONFIG_PATH, shell=True) + # Amend the commit message to add a "[DO NOT SUBMIT]" prefix and a "Test:" # line which is required by Android presubmit checks. original_commit_message = change_details['subject'] @@ -155,8 +164,11 @@ def main(): '--change-num', '-c', required=True, help='The skia-rev Gerrit change number that should be patched into ' 'Android.') + parser.add_argument( + '--debug', '-d', action='store_true', default=False, + help='Adds SK_DEBUG to SkUserConfig.h.') args = parser.parse_args() - upload_to_android(args.work_dir, args.change_num) + upload_to_android(args.work_dir, args.change_num, args.debug) if __name__ == '__main__': |