Archive LICENSE file and copy that when updating prebuilts.
R=ricow@google.com
Change-Id: If62129d775dff13e29c48aa7d435be3b5aed0b8c
diff --git a/tools/archive.py b/tools/archive.py
index 8e7436b..2e83649 100755
--- a/tools/archive.py
+++ b/tools/archive.py
@@ -94,7 +94,8 @@
utils.R8_EXCLUDE_DEPS_JAR,
utils.COMPATDX_JAR,
utils.COMPATPROGUARD_JAR,
- utils.MAVEN_ZIP]:
+ utils.MAVEN_ZIP,
+ utils.GENERATED_LICENSE]:
file_name = os.path.basename(file)
tagged_jar = os.path.join(temp, file_name)
shutil.copyfile(file, tagged_jar)
diff --git a/tools/update_prebuilds_in_android.py b/tools/update_prebuilds_in_android.py
index 4b38d25..126bab0 100755
--- a/tools/update_prebuilds_in_android.py
+++ b/tools/update_prebuilds_in_android.py
@@ -13,7 +13,8 @@
import urllib
MASTER_BUILD_ROOT = "http://storage.googleapis.com/r8-releases/raw/master/"
-TARGETS = [utils.D8, utils.R8, utils.COMPATDX, utils.COMPATPROGUARD]
+JAR_TARGETS = [utils.D8, utils.R8, utils.COMPATDX, utils.COMPATPROGUARD]
+OTHER_TARGETS = ["LICENSE"]
def parse_arguments():
parser = argparse.ArgumentParser(
@@ -23,29 +24,41 @@
parser.add_argument('--commit_hash', default=None, help='Commit hash')
return parser.parse_args()
-def copy_targets(root, target_root):
- for target in TARGETS:
- src = os.path.join(root, target + '.jar')
- dest = os.path.join(
- target_root, 'prebuilts', 'r8', target + '-master.jar')
+def copy_targets(root, target_root, srcs, dests):
+ for i in range(len(srcs)):
+ src = os.path.join(root, srcs[i])
+ dest = os.path.join(target_root, 'prebuilts', 'r8', dests[i])
print 'Copying: ' + src + ' -> ' + dest
copyfile(src, dest)
+def copy_jar_targets(root, target_root):
+ srcs = map((lambda t: t + '.jar'), JAR_TARGETS)
+ dests = map((lambda t: t + '-master.jar'), JAR_TARGETS)
+ copy_targets(root, target_root, srcs, dests)
+
+def copy_other_targets(root, target_root):
+ copy_targets(root, target_root, OTHER_TARGETS, OTHER_TARGETS)
+
+def download_target(root, commit_hash, target):
+ url = MASTER_BUILD_ROOT + commit_hash + '/' + target
+ download_path = os.path.join(root, target)
+ print 'Downloading: ' + url + ' -> ' + download_path
+ urllib.urlretrieve(url, download_path)
+
def Main():
args = parse_arguments()
target_root = args.android_root[0]
if args.commit_hash == None:
- gradle.RunGradle(TARGETS)
- root = os.path.join(utils.REPO_ROOT, 'build', 'libs')
- copy_targets(root, target_root)
+ gradle.RunGradle(JAR_TARGETS)
+ copy_jar_targets(utils.LIBS, target_root)
+ copy_other_targets(utils.GENERATED_LICENSE_DIR, target_root)
else:
+ targets = map((lambda t: t + '.jar'), JAR_TARGETS) + OTHER_TARGETS
with utils.TempDir() as root:
- for target in TARGETS:
- url = MASTER_BUILD_ROOT + args.commit_hash + '/' + target + '.jar'
- download_path = os.path.join(root, target + '.jar')
- print 'Downloading: ' + url + ' -> ' + download_path
- urllib.urlretrieve(url, download_path)
- copy_targets(root, target_root)
+ for target in targets:
+ download_target(root, args.commit_hash, target)
+ copy_jar_targets(root, target_root)
+ copy_other_targets(root, target_root)
if __name__ == '__main__':
sys.exit(Main())
diff --git a/tools/utils.py b/tools/utils.py
index cf01d3b..62936db 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -18,8 +18,9 @@
DEX_SEGMENTS_JAR = os.path.join(REPO_ROOT, 'build', 'libs',
'dexsegments.jar')
DEX_SEGMENTS_RESULT_PATTERN = re.compile('- ([^:]+): ([0-9]+)')
-LIBS = os.path.join(REPO_ROOT, 'build', 'libs')
-MAVEN_ZIP = os.path.join(LIBS, 'r8.zip')
+BUILD = os.path.join(REPO_ROOT, 'build')
+LIBS = os.path.join(BUILD, 'libs')
+GENERATED_LICENSE_DIR = os.path.join(BUILD, 'generatedLicense')
SRC_ROOT = os.path.join(REPO_ROOT, 'src', 'main', 'java')
D8 = 'd8'
@@ -32,6 +33,8 @@
R8_EXCLUDE_DEPS_JAR = os.path.join(LIBS, 'r8-exclude-deps.jar')
COMPATDX_JAR = os.path.join(LIBS, 'compatdx.jar')
COMPATPROGUARD_JAR = os.path.join(LIBS, 'compatproguard.jar')
+MAVEN_ZIP = os.path.join(LIBS, 'r8.zip')
+GENERATED_LICENSE = os.path.join(GENERATED_LICENSE_DIR, 'LICENSE')
def PrintCmd(s):
if type(s) is list: