Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: third_party/libadblockplus_android/prepare_build_tools.py

Issue 29670562: Issue 6272 - Can't sync because of changes in android_tools (Closed)
Patch Set: Created Jan. 16, 2018, 7:43 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libadblockplus_android/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libadblockplus_android/prepare_build_tools.py
diff --git a/third_party/libadblockplus_android/prepare_build_tools.py b/third_party/libadblockplus_android/prepare_build_tools.py
index f3dacec733929505eb613c4469168209bdcbd8bf..e50de5a05f9a8d119439bcff0bd026451458fca0 100644
--- a/third_party/libadblockplus_android/prepare_build_tools.py
+++ b/third_party/libadblockplus_android/prepare_build_tools.py
@@ -3,12 +3,33 @@ import urllib
import zipfile
import sys
import subprocess
+import shutil
+
+def get_dst_path():
+ cwd = os.getcwd()
+ return os.path.join(cwd, 'src', 'third_party', 'libadblockplus_android', 'third_party', 'android_sdk')
+
+def duplicate_sdk():
+ cwd = os.getcwd()
+ sdk_src = os.path.join(cwd, 'src', 'third_party', 'android_tools', 'sdk')
+ sdk_dst = get_dst_path()
+
+ if os.path.exists(sdk_dst):
+ print('Deleting %s' % sdk_dst)
+ shutil.rmtree(sdk_dst)
+ else:
+ dst_parent = os.path.abspath(os.path.join(sdk_dst, os.pardir))
+ print('Creating %s' % dst_parent)
+ os.makedirs(dst_parent)
+
+ print('Copying Android SDK from %s to %s' % (sdk_src, sdk_dst))
+ shutil.copytree(sdk_src, sdk_dst)
def install(title, package, version, verbose=False):
print('Installing %s ...' % title)
cwd = os.getcwd()
- sdk_root = os.path.join(cwd, 'src', 'third_party', 'android_tools', 'sdk')
+ sdk_root = get_dst_path()
sdkmanager = os.path.join(sdk_root, 'tools', 'bin', 'sdkmanager')
args = [
@@ -31,6 +52,8 @@ def install(title, package, version, verbose=False):
return process.returncode
def main(argv):
+ duplicate_sdk()
+
# TODO: update when different version of built-tools and platform are required
bt25 = install("Build tools", "build-tools", "25.0.0", True)
if bt25 != 0:
« no previous file with comments | « third_party/libadblockplus_android/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld