skia2/infra/bots/assets/android_ndk_linux/create.py

42 lines
907 B
Python
Raw Normal View History

#!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Create the asset."""
import argparse
import glob
import os.path
import shutil
import subprocess
Revert "Update bots' NDK to r23" This reverts commit 3bce5d13972fec9e773583eda5d3357a70c25e9e. Reason for revert: Speculative fix for ASAN failures on waterfall Original change's description: > Update bots' NDK to r23 > > Bug: skia:12273 > Bug: skia:10754 > > The latest version (r23) includes APIs from Android 12. It also allows > referencing enums and structs even if __ANDROID_API__ is not set to the > level that included them. This allows code to reference them and use > dlsym to access the methods. This will ultimately allow Skia (or client > - in this case Flutter) to use a single build to use the NDK APIs if > present and fail gracefully if not. > > With r23, the Mac version of the NDK is now in a DMG, so rewrite its > script to properly download, mount, and eject it. > > Also update the path to asan_device_setup. (See > Iae6515b7e78c7660b4fb9fe32fd969ba563c4517.) > > Change-Id: I4b2eb4f49a1d45a3c18d2399f6b8006668c310ea > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439336 > Reviewed-by: Eric Boren <borenet@google.com> > Reviewed-by: Derek Sollenberger <djsollen@google.com> > Commit-Queue: Leon Scroggins <scroggo@google.com> TBR=borenet@google.com,djsollen@google.com,scroggo@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com Change-Id: I77f803c51cba6672958210b5270b8b4301e12301 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:12273 Bug: skia:10754 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440176 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
2021-08-17 17:40:34 +00:00
NDK_VER = "android-ndk-r21d"
NDK_URL = \
Revert "Update bots' NDK to r23" This reverts commit 3bce5d13972fec9e773583eda5d3357a70c25e9e. Reason for revert: Speculative fix for ASAN failures on waterfall Original change's description: > Update bots' NDK to r23 > > Bug: skia:12273 > Bug: skia:10754 > > The latest version (r23) includes APIs from Android 12. It also allows > referencing enums and structs even if __ANDROID_API__ is not set to the > level that included them. This allows code to reference them and use > dlsym to access the methods. This will ultimately allow Skia (or client > - in this case Flutter) to use a single build to use the NDK APIs if > present and fail gracefully if not. > > With r23, the Mac version of the NDK is now in a DMG, so rewrite its > script to properly download, mount, and eject it. > > Also update the path to asan_device_setup. (See > Iae6515b7e78c7660b4fb9fe32fd969ba563c4517.) > > Change-Id: I4b2eb4f49a1d45a3c18d2399f6b8006668c310ea > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439336 > Reviewed-by: Eric Boren <borenet@google.com> > Reviewed-by: Derek Sollenberger <djsollen@google.com> > Commit-Queue: Leon Scroggins <scroggo@google.com> TBR=borenet@google.com,djsollen@google.com,scroggo@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com Change-Id: I77f803c51cba6672958210b5270b8b4301e12301 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:12273 Bug: skia:10754 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440176 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
2021-08-17 17:40:34 +00:00
"https://dl.google.com/android/repository/%s-linux-x86_64.zip" % NDK_VER
def create_asset(target_dir):
"""Create the asset."""
subprocess.check_call(["curl", NDK_URL, "-o", "ndk.zip"])
subprocess.check_call(["unzip", "ndk.zip", "-d", target_dir])
for f in glob.glob(os.path.join(target_dir, NDK_VER, "*")):
shutil.move(f, target_dir)
subprocess.check_call(["rm", "ndk.zip"])
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--target_dir', '-t', required=True)
args = parser.parse_args()
create_asset(args.target_dir)
if __name__ == '__main__':
main()