blob: cc4bebd5a61d658dc92b520390fcfe15323b4d23 [file] [log] [blame]
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +02001#!/usr/bin/env python
2# Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
3# for details. All rights reserved. Use of this source code is governed by a
4# BSD-style license that can be found in the LICENSE file.
5
6import argparse
7import datetime
8import os.path
9import re
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +020010import subprocess
11import sys
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +020012import urllib
Søren Gjesse975c5df2019-12-10 13:48:05 +010013import xml
Søren Gjesse975c5df2019-12-10 13:48:05 +010014import zipfile
Ian Zernycf1eb3c2020-09-24 08:27:23 +020015
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +020016import utils
17
Søren Gjessef595d0e2020-10-23 14:07:26 +020018R8_DEV_BRANCH = '3.0'
Ian Zerny59dfa4c2019-10-25 10:34:36 +020019R8_VERSION_FILE = os.path.join(
20 'src', 'main', 'java', 'com', 'android', 'tools', 'r8', 'Version.java')
Søren Gjesse27251592019-11-06 17:35:23 +010021THIS_FILE_RELATIVE = os.path.join('tools', 'r8_release.py')
Søren Gjesse376b74c2020-06-22 08:42:44 +020022GMAVEN_PUBLISHER = '/google/bin/releases/android-devtools/gmaven/publisher/gmaven-publisher'
Søren Gjesse975c5df2019-12-10 13:48:05 +010023
24DESUGAR_JDK_LIBS = 'desugar_jdk_libs'
25DESUGAR_JDK_LIBS_CONFIGURATION = DESUGAR_JDK_LIBS + '_configuration'
26ANDROID_TOOLS_PACKAGE = 'com.android.tools'
Ian Zerny59dfa4c2019-10-25 10:34:36 +020027
Søren Gjesse07b6aea2019-12-12 11:11:58 +010028GITHUB_DESUGAR_JDK_LIBS = 'https://github.com/google/desugar_jdk_libs'
Ian Zerny59dfa4c2019-10-25 10:34:36 +020029
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +010030def checkout_r8(temp, branch):
31 subprocess.check_call(['git', 'clone', utils.REPO_SOURCE, temp])
32 with utils.ChangedWorkingDirectory(temp):
33 subprocess.check_call([
34 'git',
35 'new-branch',
36 '--upstream',
37 'origin/%s' % branch,
38 'dev-release'])
39 return temp
40
41
Ian Zerny59dfa4c2019-10-25 10:34:36 +020042def prepare_release(args):
43 if args.version:
44 print "Cannot manually specify version when making a dev release."
45 sys.exit(1)
46
47 def make_release(args):
48 commithash = args.dev_release
49
50 with utils.TempDir() as temp:
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +010051 with utils.ChangedWorkingDirectory(checkout_r8(temp, R8_DEV_BRANCH)):
Ian Zerny59dfa4c2019-10-25 10:34:36 +020052 # Compute the current and new version on the branch.
53 result = None
54 for line in open(R8_VERSION_FILE, 'r'):
55 result = re.match(
56 r'.*LABEL = "%s\.(\d+)\-dev";' % R8_DEV_BRANCH, line)
57 if result:
58 break
59 if not result or not result.group(1):
60 print 'Failed to find version label matching %s(\d+)-dev'\
61 % R8_DEV_BRANCH
62 sys.exit(1)
63 try:
64 patch_version = int(result.group(1))
65 except ValueError:
66 print 'Failed to convert version to integer: %s' % result.group(1)
67
68 old_version = '%s.%s-dev' % (R8_DEV_BRANCH, patch_version)
69 version = '%s.%s-dev' % (R8_DEV_BRANCH, patch_version + 1)
70
71 # Verify that the merge point from master is not empty.
72 merge_diff_output = subprocess.check_output([
73 'git', 'diff', 'HEAD..%s' % commithash])
74 other_diff = version_change_diff(
75 merge_diff_output, old_version, "master")
76 if not other_diff:
77 print 'Merge point from master (%s)' % commithash, \
78 'is the same as exiting release (%s).' % old_version
79 sys.exit(1)
80
Rico Wind140a5642019-11-26 10:44:21 +010081 if args.dev_pre_cherry_pick:
82 for pre_commit in args.dev_pre_cherry_pick:
83 subprocess.check_call([
84 'git', 'cherry-pick', '--no-edit', pre_commit])
85
Ian Zerny59dfa4c2019-10-25 10:34:36 +020086 # Merge the desired commit from master on to the branch.
87 subprocess.check_call([
88 'git', 'merge', '--no-ff', '--no-edit', commithash])
89
90 # Rewrite the version, commit and validate.
91 sed(old_version, version, R8_VERSION_FILE)
92
93 subprocess.check_call([
Ian Zerny3224c812019-11-01 08:12:04 +010094 'git', 'commit', '-a', '-m', 'Version %s' % version])
Ian Zerny59dfa4c2019-10-25 10:34:36 +020095
96 version_diff_output = subprocess.check_output([
97 'git', 'diff', '%s..HEAD' % commithash])
98
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +010099 validate_version_change_diff(version_diff_output, "master", version)
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200100
101 # Double check that we want to push the release.
102 if not args.dry_run:
103 input = raw_input('Publish dev release version %s [y/N]:' % version)
104 if input != 'y':
105 print 'Aborting dev release for %s' % version
106 sys.exit(1)
107
108 maybe_check_call(args, [
109 'git', 'push', 'origin', 'HEAD:%s' % R8_DEV_BRANCH])
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100110 maybe_tag(args, version)
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200111
112 return "%s dev version %s from hash %s" % (
113 'DryRun: omitted publish of' if args.dry_run else 'Published',
114 version,
115 commithash)
116
117 return make_release
118
119
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100120def maybe_tag(args, version):
121 maybe_check_call(args, [
122 'git', 'tag', '-a', version, '-m', '"%s"' % version])
123 maybe_check_call(args, [
124 'git', 'push', 'origin', 'refs/tags/%s' % version])
125
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100126
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200127def version_change_diff(diff, old_version, new_version):
128 invalid_line = None
129 for line in diff.splitlines():
130 if line.startswith('- ') and \
131 line != '- public static final String LABEL = "%s";' % old_version:
132 invalid_line = line
133 elif line.startswith('+ ') and \
134 line != '+ public static final String LABEL = "%s";' % new_version:
135 invalid_line = line
136 return invalid_line
137
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100138
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100139def validate_version_change_diff(version_diff_output, old_version, new_version):
140 invalid = version_change_diff(version_diff_output, old_version, new_version)
141 if invalid:
142 print "Unexpected diff:"
143 print "=" * 80
144 print version_diff_output
145 print "=" * 80
146 accept_string = 'THE DIFF IS OK!'
147 input = raw_input(
148 "Accept the additonal diff as part of the release? "
149 "Type '%s' to accept: " % accept_string)
150 if input != accept_string:
151 print "You did not type '%s'" % accept_string
152 print 'Aborting dev release for %s' % version
153 sys.exit(1)
154
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200155
156def maybe_check_call(args, cmd):
157 if args.dry_run:
158 print 'DryRun:', ' '.join(cmd)
159 else:
160 print ' '.join(cmd)
161 return subprocess.check_call(cmd)
162
163
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100164def update_prebuilds(r8_checkout, version, checkout):
165 path = os.path.join(r8_checkout, 'tools', 'update_prebuilds_in_android.py')
166 subprocess.check_call([path, '--targets=lib', '--maps', '--version=' + version, checkout])
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200167
168
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100169def release_studio_or_aosp(r8_checkout, path, options, git_message):
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200170 with utils.ChangedWorkingDirectory(path):
Søren Gjesse5f90ec42019-12-02 16:03:51 +0100171 if not options.use_existing_work_branch:
172 subprocess.call(['repo', 'abandon', 'update-r8'])
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200173 if not options.no_sync:
Ian Zerny25cccae2019-10-21 11:07:24 +0200174 subprocess.check_call(['repo', 'sync', '-cq', '-j', '16'])
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200175
176 prebuilts_r8 = os.path.join(path, 'prebuilts', 'r8')
177
Søren Gjesse5f90ec42019-12-02 16:03:51 +0100178 if not options.use_existing_work_branch:
179 with utils.ChangedWorkingDirectory(prebuilts_r8):
180 subprocess.check_call(['repo', 'start', 'update-r8'])
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200181
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100182 update_prebuilds(r8_checkout, options.version, path)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200183
184 with utils.ChangedWorkingDirectory(prebuilts_r8):
Søren Gjesse5f90ec42019-12-02 16:03:51 +0100185 if not options.use_existing_work_branch:
186 subprocess.check_call(['git', 'commit', '-a', '-m', git_message])
187 else:
188 print ('Not committing when --use-existing-work-branch. '
189 + 'Commit message should be:\n\n'
190 + git_message
191 + '\n')
192 # Don't upload if requested not to, or if changes are not committed due
193 # to --use-existing-work-branch
194 if not options.no_upload and not options.use_existing_work_branch:
195 process = subprocess.Popen(['repo', 'upload', '.', '--verify'],
196 stdin=subprocess.PIPE)
197 return process.communicate(input='y\n')[0]
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200198
199
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200200def prepare_aosp(args):
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200201 assert args.version
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200202 assert os.path.exists(args.aosp), "Could not find AOSP path %s" % args.aosp
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200203
204 def release_aosp(options):
205 print "Releasing for AOSP"
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200206 if options.dry_run:
207 return 'DryRun: omitting AOSP release for %s' % options.version
208
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200209 git_message = ("""Update D8 and R8 to %s
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200210
Morten Krogh-Jespersendbbf9a82020-08-11 21:38:08 +0200211Version: %s
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200212This build IS NOT suitable for preview or public release.
213
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200214Built here: go/r8-releases/raw/%s
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200215
216Test: TARGET_PRODUCT=aosp_arm64 m -j core-oj"""
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200217 % (args.version, args.version, args.version))
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100218 return release_studio_or_aosp(
219 utils.REPO_ROOT, args.aosp, options, git_message)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200220
221 return release_aosp
222
223
Søren Gjesse376b74c2020-06-22 08:42:44 +0200224def prepare_maven(args):
225 assert args.version
226
227 def release_maven(options):
Søren Gjesseb093b672020-06-23 16:23:10 +0200228 gfile = '/bigstore/r8-releases/raw/%s/r8lib.zip' % args.version
229 release_id = gmaven_publisher_stage(options, [gfile])
Søren Gjesse376b74c2020-06-22 08:42:44 +0200230
Søren Gjesseb093b672020-06-23 16:23:10 +0200231 print "Staged Release ID " + release_id + ".\n"
232 gmaven_publisher_stage_redir_test_info(
233 release_id, "com.android.tools:r8:%s" % args.version, "r8lib.jar")
Søren Gjesse376b74c2020-06-22 08:42:44 +0200234
235 print
236 input = raw_input("Continue with publishing [y/N]:")
237
238 if input != 'y':
239 print 'Aborting release to Google maven'
240 sys.exit(1)
241
242 gmaven_publisher_publish(args, release_id)
243
244 print
245 print "Published. Use the email workflow for approval."
246
247 return release_maven
248
Ian Zernyacfaf292020-09-24 07:14:56 +0200249# ------------------------------------------------------ column 70 --v
Ian Zernycf1eb3c2020-09-24 08:27:23 +0200250def git_message_dev(version, bugs):
Morten Krogh-Jespersendbbf9a82020-08-11 21:38:08 +0200251 return """Update D8 R8 to %s
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200252
Ian Zernyacfaf292020-09-24 07:14:56 +0200253This is a development snapshot, it's fine to use for studio canary
254build, but not for BETA or release, for those we would need a release
255version of R8 binaries. This build IS suitable for preview release
256but IS NOT suitable for public release.
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200257
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200258Built here: go/r8-releases/raw/%s
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200259Test: ./gradlew check
Ian Zernycf1eb3c2020-09-24 08:27:23 +0200260Bug: %s""" % (version, version, '\nBug: '.join(bugs))
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200261
262
Morten Krogh-Jespersena1396cd2019-10-02 16:14:40 +0200263def git_message_release(version, bugs):
264 return """D8 R8 version %s
265
266Built here: go/r8-releases/raw/%s/
267Test: ./gradlew check
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100268
Ian Zernycf1eb3c2020-09-24 08:27:23 +0200269Bug: %s""" % (version, version, '\nBug: '.join(bugs))
Morten Krogh-Jespersena1396cd2019-10-02 16:14:40 +0200270
271
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200272def prepare_studio(args):
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200273 assert args.version
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200274 assert os.path.exists(args.studio), ("Could not find STUDIO path %s"
275 % args.studio)
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200276
277 def release_studio(options):
278 print "Releasing for STUDIO"
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200279 if options.dry_run:
280 return 'DryRun: omitting studio release for %s' % options.version
281
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100282 if 'dev' in options.version:
Ian Zernycf1eb3c2020-09-24 08:27:23 +0200283 git_message = git_message_dev(options.version, options.bug)
Morten Krogh-Jespersend86a3012020-02-21 15:06:13 +0100284 r8_checkout = utils.REPO_ROOT
285 return release_studio_or_aosp(
286 r8_checkout, args.studio, options, git_message)
287 else:
288 with utils.TempDir() as temp:
289 checkout_r8(temp, options.version[0:options.version.rindex('.')])
290 git_message = git_message_release(options.version, options.bug)
291 return release_studio_or_aosp(temp, args.studio, options, git_message)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200292
293 return release_studio
294
295
296def g4_cp(old, new, file):
297 subprocess.check_call('g4 cp {%s,%s}/%s' % (old, new, file), shell=True)
298
299
300def g4_open(file):
Søren Gjesse08967662020-05-06 19:46:32 +0200301 if not os.access(file, os.W_OK):
302 subprocess.check_call('g4 open %s' % file, shell=True)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200303
304
Rico Wind8d008ca2020-04-22 12:13:15 +0200305def g4_change(version):
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200306 return subprocess.check_output(
Rico Wind8d008ca2020-04-22 12:13:15 +0200307 'g4 change --desc "Update R8 to version %s\n"' % (version),
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200308 shell=True)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200309
Morten Krogh-Jespersen1f2f5142020-09-21 11:20:23 +0200310def get_cl_id(c4_change_output):
311 startIndex = c4_change_output.find('Change ') + len('Change ')
312 endIndex = c4_change_output.find(' ', startIndex)
313 cl = c4_change_output[startIndex:endIndex]
314 assert cl.isdigit()
315 return cl
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200316
317def sed(pattern, replace, path):
318 with open(path, "r") as sources:
319 lines = sources.readlines()
320 with open(path, "w") as sources:
321 for line in lines:
322 sources.write(re.sub(pattern, replace, line))
323
324
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200325def download_file(version, file, dst):
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200326 urllib.urlretrieve(
Rico Wind70d614f2020-01-31 08:45:21 +0100327 ('https://storage.googleapis.com/r8-releases/raw/%s/%s' % (version, file)),
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200328 dst)
329
Søren Gjesseb093b672020-06-23 16:23:10 +0200330def download_gfile(gfile, dst):
331 if not gfile.startswith('/bigstore/r8-releases'):
332 print 'Unexpected gfile prefix for %s' % gfile
333 sys.exit(1)
334
335 urllib.urlretrieve(
336 'https://storage.googleapis.com/%s' % gfile[len('/bigstore/'):],
337 dst)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200338
339def blaze_run(target):
340 return subprocess.check_output(
341 'blaze run %s' % target, shell=True, stderr=subprocess.STDOUT)
342
343
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200344def prepare_google3(args):
345 assert args.version
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200346 # Check if an existing client exists.
Søren Gjesse7e0ef852019-12-04 13:52:33 +0100347 if not args.use_existing_work_branch:
Søren Gjesse08967662020-05-06 19:46:32 +0200348 check_no_google3_client(args, args.p4_client)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200349
350 def release_google3(options):
351 print "Releasing for Google 3"
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200352 if options.dry_run:
353 return 'DryRun: omitting g3 release for %s' % options.version
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200354
355 google3_base = subprocess.check_output(
Søren Gjesse08967662020-05-06 19:46:32 +0200356 ['p4', 'g4d', '-f', args.p4_client]).rstrip()
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200357 third_party_r8 = os.path.join(google3_base, 'third_party', 'java', 'r8')
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200358 today = datetime.date.today()
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200359 with utils.ChangedWorkingDirectory(third_party_r8):
Rico Wind8d008ca2020-04-22 12:13:15 +0200360 # download files
361 g4_open('full.jar')
362 g4_open('src.jar')
363 g4_open('lib.jar')
364 g4_open('lib.jar.map')
Rico Wind369a21c2020-08-25 14:47:05 +0200365 g4_open('desugar_jdk_libs.json')
366 g4_open('desugar_jdk_libs_configuration.jar')
Rico Wind8d008ca2020-04-22 12:13:15 +0200367 download_file(options.version, 'r8-full-exclude-deps.jar', 'full.jar')
368 download_file(options.version, 'r8-src.jar', 'src.jar')
369 download_file(options.version, 'r8lib-exclude-deps.jar', 'lib.jar')
370 download_file(
371 options.version, 'r8lib-exclude-deps.jar.map', 'lib.jar.map')
Rico Wind369a21c2020-08-25 14:47:05 +0200372 download_file(options.version, 'desugar_jdk_libs.json',
373 'desugar_jdk_libs.json')
374 download_file(options.version, 'desugar_jdk_libs_configuration.jar',
375 'desugar_jdk_libs_configuration.jar')
Rico Wind8d008ca2020-04-22 12:13:15 +0200376 g4_open('METADATA')
377 sed(r'[1-9]\.[0-9]{1,2}\.[0-9]{1,3}-dev',
378 options.version,
379 os.path.join(third_party_r8, 'METADATA'))
380 sed(r'\{ year.*\}',
381 ('{ year: %i month: %i day: %i }'
382 % (today.year, today.month, today.day)),
383 os.path.join(third_party_r8, 'METADATA'))
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200384
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200385
Rico Wind8d008ca2020-04-22 12:13:15 +0200386 subprocess.check_output('chmod u+w *', shell=True)
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200387
388 with utils.ChangedWorkingDirectory(google3_base):
389 blaze_result = blaze_run('//third_party/java/r8:d8 -- --version')
390
391 assert options.version in blaze_result
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200392
Søren Gjesse5f90ec42019-12-02 16:03:51 +0100393 if not options.no_upload:
Morten Krogh-Jespersen1f2f5142020-09-21 11:20:23 +0200394 change_result = g4_change(options.version)
395 change_result += 'Run \'(g4d ' + args.p4_client \
396 + ' && tap_presubmit -p all --train -c ' \
397 + get_cl_id(change_result) + ')\' for running TAP presubmit.'
398 return change_result
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200399
400 return release_google3
401
402
Søren Gjesse73355ec2020-06-29 09:19:44 +0200403def update_desugar_library_in_studio(args):
404 assert os.path.exists(args.studio), ("Could not find STUDIO path %s"
405 % args.studio)
406
407 def make_release(args):
408 library_version = args.update_desugar_library_in_studio[0]
409 configuration_version = args.update_desugar_library_in_studio[1]
410 change_name = 'update-desugar-library-dependencies'
411
412 with utils.ChangedWorkingDirectory(args.studio):
413 if not args.use_existing_work_branch:
414 subprocess.call(['repo', 'abandon', change_name])
415 if not args.no_sync:
416 subprocess.check_call(['repo', 'sync', '-cq', '-j', '16'])
417
418 cmd = ['tools/base/bazel/bazel',
419 'run',
420 '//tools/base/bazel:add_dependency',
421 '--',
422 '--repo=https://maven.google.com com.android.tools:desugar_jdk_libs:%s' % library_version]
423 utils.PrintCmd(cmd)
424 subprocess.check_call(" ".join(cmd), shell=True)
425 cmd = ['tools/base/bazel/bazel', 'shutdown']
426 utils.PrintCmd(cmd)
427 subprocess.check_call(cmd)
428
429 prebuilts_tools = os.path.join(args.studio, 'prebuilts', 'tools')
430 with utils.ChangedWorkingDirectory(prebuilts_tools):
431 if not args.use_existing_work_branch:
432 with utils.ChangedWorkingDirectory(prebuilts_tools):
433 subprocess.check_call(['repo', 'start', change_name])
434 m2_dir = os.path.join(
435 'common', 'm2', 'repository', 'com', 'android', 'tools')
436 subprocess.check_call(
437 ['git',
438 'add',
439 os.path.join(m2_dir, DESUGAR_JDK_LIBS, library_version)])
440 subprocess.check_call(
441 ['git',
442 'add',
443 os.path.join(
444 m2_dir, DESUGAR_JDK_LIBS_CONFIGURATION, configuration_version)])
445
446 git_message = ("""Update library desugaring dependencies
447
448 com.android.tools:desugar_jdk_libs:%s
449 com.android.tools:desugar_jdk_libs_configuration:%s
450
451Bug: %s
452Test: L8ToolTest, L8DexDesugarTest"""
453 % (library_version,
454 configuration_version,
455 '\nBug: '.join(args.bug)))
456
457 if not args.use_existing_work_branch:
458 subprocess.check_call(['git', 'commit', '-a', '-m', git_message])
459 else:
460 print ('Not committing when --use-existing-work-branch. '
461 + 'Commit message should be:\n\n'
462 + git_message
463 + '\n')
464 # Don't upload if requested not to, or if changes are not committed due
465 # to --use-existing-work-branch
466 if not args.no_upload and not args.use_existing_work_branch:
467 process = subprocess.Popen(['repo', 'upload', '.', '--verify'],
468 stdin=subprocess.PIPE)
469 return process.communicate(input='y\n')[0]
470
471 return make_release
472
473
Søren Gjesse975c5df2019-12-10 13:48:05 +0100474def prepare_desugar_library(args):
475
476 def make_release(args):
477 library_version = args.desugar_library[0]
Søren Gjesseb093b672020-06-23 16:23:10 +0200478 configuration_version = args.desugar_library[1]
Søren Gjesse975c5df2019-12-10 13:48:05 +0100479
480 library_archive = DESUGAR_JDK_LIBS + '.zip'
Søren Gjesseb093b672020-06-23 16:23:10 +0200481 library_jar = DESUGAR_JDK_LIBS + '.jar'
Søren Gjesse975c5df2019-12-10 13:48:05 +0100482 library_artifact_id = \
483 '%s:%s:%s' % (ANDROID_TOOLS_PACKAGE, DESUGAR_JDK_LIBS, library_version)
484
Søren Gjesseb093b672020-06-23 16:23:10 +0200485 configuration_archive = DESUGAR_JDK_LIBS_CONFIGURATION + '.zip'
486
Søren Gjesse975c5df2019-12-10 13:48:05 +0100487 with utils.TempDir() as temp:
488 with utils.ChangedWorkingDirectory(temp):
Søren Gjesseb093b672020-06-23 16:23:10 +0200489 library_gfile = ('/bigstore/r8-releases/raw/%s/%s/%s'
490 % (DESUGAR_JDK_LIBS, library_version, library_archive))
491 configuration_gfile = ('/bigstore/r8-releases/raw/master/%s/%s'
492 % (configuration_version, configuration_archive))
Søren Gjesse975c5df2019-12-10 13:48:05 +0100493
Søren Gjesseb093b672020-06-23 16:23:10 +0200494 download_gfile(library_gfile, library_archive)
495 download_gfile(configuration_gfile, configuration_archive)
496 check_configuration(configuration_archive)
497
498 release_id = gmaven_publisher_stage(
499 args, [library_gfile, configuration_gfile])
500
501 print "Staged Release ID " + release_id + ".\n"
502 gmaven_publisher_stage_redir_test_info(
503 release_id,
504 "com.android.tools:%s:%s" % (DESUGAR_JDK_LIBS, library_version),
505 library_jar)
506
Søren Gjesse975c5df2019-12-10 13:48:05 +0100507 print
Søren Gjesseb093b672020-06-23 16:23:10 +0200508 input = raw_input("Continue with publishing [y/N]:")
Søren Gjesse975c5df2019-12-10 13:48:05 +0100509
Søren Gjesseb093b672020-06-23 16:23:10 +0200510 if input != 'y':
511 print 'Aborting release to Google maven'
512 sys.exit(1)
Søren Gjesse975c5df2019-12-10 13:48:05 +0100513
Søren Gjesseb093b672020-06-23 16:23:10 +0200514 gmaven_publisher_publish(args, release_id)
515
516 print
517 print "Published. Use the email workflow for approval."
Søren Gjesse975c5df2019-12-10 13:48:05 +0100518
519 return make_release
520
521
Søren Gjesseb093b672020-06-23 16:23:10 +0200522def check_configuration(configuration_archive):
523 zip = zipfile.ZipFile(configuration_archive)
Søren Gjesse975c5df2019-12-10 13:48:05 +0100524 zip.extractall()
525 dirs = os.listdir(
526 os.path.join('com', 'android', 'tools', DESUGAR_JDK_LIBS_CONFIGURATION))
527 if len(dirs) != 1:
528 print 'Unexpected archive content, %s' + dirs
529 sys.exit(1)
530
531 version = dirs[0]
532 pom_file = os.path.join(
533 'com',
534 'android',
535 'tools',
536 DESUGAR_JDK_LIBS_CONFIGURATION,
537 version,
538 '%s-%s.pom' % (DESUGAR_JDK_LIBS_CONFIGURATION, version))
539 version_from_pom = extract_version_from_pom(pom_file)
540 if version != version_from_pom:
541 print 'Version mismatch, %s != %s' % (version, version_from_pom)
542 sys.exit(1)
Søren Gjesse07b6aea2019-12-12 11:11:58 +0100543
544def check_no_google3_client(args, client_name):
545 if not args.use_existing_work_branch:
546 clients = subprocess.check_output('g4 myclients', shell=True)
547 if ':%s:' % client_name in clients:
Ian Zernyb8cd8b32020-04-27 14:51:41 +0200548 print ("Remove the existing '%s' client before continuing " +
549 "(force delete: 'g4 citc -d -f %s'), " +
550 "or use option --use-existing-work-branch.") % (client_name, client_name)
Søren Gjesse07b6aea2019-12-12 11:11:58 +0100551 sys.exit(1)
552
553
Søren Gjesse975c5df2019-12-10 13:48:05 +0100554def extract_version_from_pom(pom_file):
555 ns = "http://maven.apache.org/POM/4.0.0"
556 xml.etree.ElementTree.register_namespace('', ns)
557 tree = xml.etree.ElementTree.ElementTree()
558 tree.parse(pom_file)
559 return tree.getroot().find("{%s}version" % ns).text
560
Søren Gjesse376b74c2020-06-22 08:42:44 +0200561
562GMAVEN_PUBLISH_STAGE_RELEASE_ID_PATTERN = re.compile('Release ID = ([0-9a-f\-]+)')
563
Søren Gjesseb093b672020-06-23 16:23:10 +0200564
565def gmaven_publisher_stage(args, gfiles):
Søren Gjesse376b74c2020-06-22 08:42:44 +0200566 if args.dry_run:
Søren Gjesseb093b672020-06-23 16:23:10 +0200567 print 'Dry-run, would have staged %s' % gfiles
Søren Gjesse376b74c2020-06-22 08:42:44 +0200568 return 'dry-run-release-id'
569
Søren Gjesseb093b672020-06-23 16:23:10 +0200570 print "Staging: %s" % ', '.join(gfiles)
Søren Gjesse376b74c2020-06-22 08:42:44 +0200571 print
572
Søren Gjesseb093b672020-06-23 16:23:10 +0200573 cmd = [GMAVEN_PUBLISHER, 'stage', '--gfile', ','.join(gfiles)]
Søren Gjesse376b74c2020-06-22 08:42:44 +0200574 output = subprocess.check_output(cmd)
575
576 # Expect output to contain:
577 # [INFO] 06/19/2020 09:35:12 CEST: >>>>>>>>>> Staged
578 # [INFO] 06/19/2020 09:35:12 CEST: Release ID = 9171d015-18f6-4a90-9984-1c362589dc1b
579 # [INFO] 06/19/2020 09:35:12 CEST: Stage Path = /bigstore/studio_staging/maven2/sgjesse/9171d015-18f6-4a90-9984-1c362589dc1b
580
581 matches = GMAVEN_PUBLISH_STAGE_RELEASE_ID_PATTERN.findall(output)
582 if matches == None or len(matches) > 1:
583 print ("Could not determine the release ID from the gmaven_publisher " +
584 "output. Expected a line with 'Release ID = <release id>'.")
585 print "Output was:"
586 print output
587 sys.exit(1)
588
589 print output
590
591 release_id = matches[0]
592 return release_id
593
Søren Gjesseb093b672020-06-23 16:23:10 +0200594
595def gmaven_publisher_stage_redir_test_info(release_id, artifact, dst):
596
597 redir_command = ("/google/data/ro/teams/android-devtools-infra/tools/redir "
598 + "--alsologtostderr "
599 + "--gcs_bucket_path=/studio_staging/maven2/${USER}/%s "
600 + "--port=1480") % release_id
601
602 get_command = ("mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get "
603 + "-Dmaven.repo.local=/tmp/maven_repo_local "
604 + "-DremoteRepositories=http://localhost:1480 "
605 + "-Dartifact=%s "
606 + "-Ddest=%s") % (artifact, dst)
607
608 print """To test the staged content with 'redir' run:
609
610%s
611
612Add the following repository to gradle.build for using 'redir':
613
614repositories {
615 maven {
616 url 'http://localhost:1480'
617 }
618}
619
620Use this commands to get artifact from 'redir':
621
622rm -rf /tmp/maven_repo_local
623%s
624""" % (redir_command, get_command)
625
626
Søren Gjesse376b74c2020-06-22 08:42:44 +0200627def gmaven_publisher_publish(args, release_id):
Søren Gjesse376b74c2020-06-22 08:42:44 +0200628 if args.dry_run:
629 print 'Dry-run, would have published %s' % release_id
630 return
631
632 cmd = [GMAVEN_PUBLISHER, 'publish', release_id]
633 output = subprocess.check_output(cmd)
Søren Gjesse975c5df2019-12-10 13:48:05 +0100634
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100635def branch_change_diff(diff, old_version, new_version):
636 invalid_line = None
637 for line in diff.splitlines():
638 if line.startswith('-R8') and \
639 line != "-R8_DEV_BRANCH = '%s'" % old_version:
640 print line
641 invalid_line = line
642 elif line.startswith('+R8') and \
643 line != "+R8_DEV_BRANCH = '%s'" % new_version:
644 print line
645 invalid_line = line
646 return invalid_line
647
648
649def validate_branch_change_diff(version_diff_output, old_version, new_version):
650 invalid = branch_change_diff(version_diff_output, old_version, new_version)
651 if invalid:
652 print
653 print "The diff for the branch change in tools/release.py is not as expected:"
654 print
655 print "=" * 80
656 print version_diff_output
657 print "=" * 80
658 print
659 print "Validate the uploaded CL before landing."
660 print
661
662
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100663def prepare_branch(args):
664 branch_version = args.new_dev_branch[0]
665 commithash = args.new_dev_branch[1]
666
667 current_semver = utils.check_basic_semver_version(
668 R8_DEV_BRANCH, ", current release branch version should be x.y", 2)
669 semver = utils.check_basic_semver_version(
670 branch_version, ", release branch version should be x.y", 2)
671 if not semver.larger_than(current_semver):
672 print ('New branch version "'
673 + branch_version
674 + '" must be strictly larger than the current "'
675 + R8_DEV_BRANCH
676 + '"')
677 sys.exit(1)
678
679 def make_branch(options):
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100680 with utils.TempDir() as temp:
681 subprocess.check_call(['git', 'clone', utils.REPO_SOURCE, temp])
682 with utils.ChangedWorkingDirectory(temp):
683 subprocess.check_call(['git', 'branch', branch_version, commithash])
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100684
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100685 subprocess.check_call(['git', 'checkout', branch_version])
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100686
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100687 # Rewrite the version, commit and validate.
688 old_version = 'master'
689 full_version = branch_version + '.0-dev'
690 version_prefix = 'LABEL = "'
691 sed(version_prefix + old_version,
692 version_prefix + full_version,
693 R8_VERSION_FILE)
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100694
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100695 subprocess.check_call([
696 'git', 'commit', '-a', '-m', 'Version %s' % full_version])
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100697
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100698 version_diff_output = subprocess.check_output([
699 'git', 'diff', '%s..HEAD' % commithash])
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100700
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100701 validate_version_change_diff(version_diff_output, old_version, full_version)
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100702
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100703 # Double check that we want to create a new release branch.
704 if not options.dry_run:
705 input = raw_input('Create new branch for %s [y/N]:' % branch_version)
706 if input != 'y':
707 print 'Aborting new branch for %s' % branch_version
708 sys.exit(1)
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100709
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100710 maybe_check_call(options, [
711 'git', 'push', 'origin', 'HEAD:%s' % branch_version])
712 maybe_tag(options, full_version)
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100713
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100714 print ('Updating tools/r8_release.py to make new dev releases on %s'
715 % branch_version)
716
717 subprocess.check_call(['git', 'new-branch', 'update-release-script'])
718
719 # Check this file for the setting of the current dev branch.
720 result = None
Søren Gjesse27251592019-11-06 17:35:23 +0100721 for line in open(THIS_FILE_RELATIVE, 'r'):
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100722 result = re.match(
723 r"^R8_DEV_BRANCH = '(\d+).(\d+)'", line)
724 if result:
725 break
726 if not result or not result.group(1):
Søren Gjesse27251592019-11-06 17:35:23 +0100727 print 'Failed to find version label in %s' % THIS_FILE_RELATIVE
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100728 sys.exit(1)
729
730 # Update this file with the new dev branch.
731 sed("R8_DEV_BRANCH = '%s.%s" % (result.group(1), result.group(2)),
732 "R8_DEV_BRANCH = '%s.%s" % (str(semver.major), str(semver.minor)),
Søren Gjesse27251592019-11-06 17:35:23 +0100733 THIS_FILE_RELATIVE)
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100734
Søren Gjesse27251592019-11-06 17:35:23 +0100735 message = \
736 'Prepare %s for branch %s' % (THIS_FILE_RELATIVE, branch_version)
Søren Gjesseddeb02e2019-11-06 15:48:07 +0100737 subprocess.check_call(['git', 'commit', '-a', '-m', message])
738
739 branch_diff_output = subprocess.check_output(['git', 'diff', 'HEAD~'])
740
741 validate_branch_change_diff(
742 branch_diff_output, R8_DEV_BRANCH, branch_version)
743
744 maybe_check_call(options, ['git', 'cl', 'upload', '-f', '-m', message])
745
746 print
747 print 'Make sure to send out the branch change CL for review.'
748 print
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100749
750 return make_branch
751
752
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200753def parse_options():
754 result = argparse.ArgumentParser(description='Release r8')
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200755 group = result.add_mutually_exclusive_group()
756 group.add_argument('--dev-release',
Søren Gjesse53539ae2019-11-06 09:47:01 +0100757 metavar=('<master hash>'),
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200758 help='The hash to use for the new dev version of R8')
Søren Gjesse975c5df2019-12-10 13:48:05 +0100759 group.add_argument('--version',
760 metavar=('<version>'),
761 help='The new version of R8 (e.g., 1.4.51) to release to selected channels')
762 group.add_argument('--desugar-library',
763 nargs=2,
764 metavar=('<version>', '<configuration hash>'),
765 help='The new version of com.android.tools:desugar_jdk_libs')
Søren Gjesse73355ec2020-06-29 09:19:44 +0200766 group.add_argument('--update-desugar-library-in-studio',
767 nargs=2,
768 metavar=('<version>', '<configuration version>'),
769 help='Update studio mirror of com.android.tools:desugar_jdk_libs')
Søren Gjesse975c5df2019-12-10 13:48:05 +0100770 group.add_argument('--new-dev-branch',
771 nargs=2,
772 metavar=('<version>', '<master hash>'),
773 help='Create a new branch starting a version line (e.g. 2.0)')
Rico Wind140a5642019-11-26 10:44:21 +0100774 result.add_argument('--dev-pre-cherry-pick',
775 metavar=('<master hash(s)>'),
776 default=[],
777 action='append',
778 help='List of commits to cherry pick before doing full '
779 'merge, mostly used for reverting cherry picks')
Søren Gjesseb8dec612019-10-10 09:15:43 +0200780 result.add_argument('--no-sync', '--no_sync',
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200781 default=False,
782 action='store_true',
783 help='Do not sync repos before uploading')
Morten Krogh-Jespersena1396cd2019-10-02 16:14:40 +0200784 result.add_argument('--bug',
Søren Gjesse53539ae2019-11-06 09:47:01 +0100785 metavar=('<bug(s)>'),
Morten Krogh-Jespersena1396cd2019-10-02 16:14:40 +0200786 default=[],
787 action='append',
788 help='List of bugs for release version')
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200789 result.add_argument('--studio',
Søren Gjesse53539ae2019-11-06 09:47:01 +0100790 metavar=('<path>'),
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200791 help='Release for studio by setting the path to a studio '
792 'checkout')
793 result.add_argument('--aosp',
Søren Gjesse53539ae2019-11-06 09:47:01 +0100794 metavar=('<path>'),
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200795 help='Release for aosp by setting the path to the '
796 'checkout')
Søren Gjesse376b74c2020-06-22 08:42:44 +0200797 result.add_argument('--maven',
798 default=False,
799 action='store_true',
800 help='Release to Google Maven')
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200801 result.add_argument('--google3',
802 default=False,
803 action='store_true',
804 help='Release for google 3')
Søren Gjesse08967662020-05-06 19:46:32 +0200805 result.add_argument('--p4-client',
806 default='update-r8',
807 metavar=('<client name>'),
808 help='P4 client name for google 3')
Søren Gjesse5f90ec42019-12-02 16:03:51 +0100809 result.add_argument('--use-existing-work-branch', '--use_existing_work_branch',
810 default=False,
811 action='store_true',
812 help='Use existing work branch/CL in aosp/studio/google3')
813 result.add_argument('--no-upload', '--no_upload',
814 default=False,
815 action='store_true',
816 help="Don't upload for code review")
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200817 result.add_argument('--dry-run',
818 default=False,
819 action='store_true',
820 help='Only perform non-commiting tasks and print others.')
Søren Gjesse975c5df2019-12-10 13:48:05 +0100821 result.add_argument('--dry-run-output', '--dry_run_output',
822 default=os.getcwd(),
823 metavar=('<path>'),
824 help='Location for dry run output.')
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200825 args = result.parse_args()
Søren Gjesse376b74c2020-06-22 08:42:44 +0200826 if (args.studio
827 and args.version
828 and not 'dev' in args.version
829 and args.bug == []):
830 print ("When releasing a release version to Android Studio add the "
831 + "list of bugs by using '--bug'")
Morten Krogh-Jespersena1396cd2019-10-02 16:14:40 +0200832 sys.exit(1)
833
Morten Krogh-Jespersen52d3ab02019-10-29 08:57:06 +0100834 if args.version and not 'dev' in args.version and args.google3:
835 print "You should not roll a release version into google 3"
836 sys.exit(1)
837
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200838 return args
839
840
841def main():
842 args = parse_options()
843 targets_to_run = []
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200844
Søren Gjesse4e5c6fe2019-11-05 17:17:43 +0100845 if args.new_dev_branch:
846 if args.google3 or args.studio or args.aosp:
847 print 'Cannot create a branch and roll at the same time.'
848 sys.exit(1)
849 targets_to_run.append(prepare_branch(args))
850
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200851 if args.dev_release:
852 if args.google3 or args.studio or args.aosp:
853 print 'Cannot create a dev release and roll at the same time.'
854 sys.exit(1)
855 targets_to_run.append(prepare_release(args))
856
Søren Gjesse975c5df2019-12-10 13:48:05 +0100857 if (args.google3
Søren Gjesse376b74c2020-06-22 08:42:44 +0200858 or args.maven
Søren Gjesse975c5df2019-12-10 13:48:05 +0100859 or (args.studio and not args.no_sync)
Søren Gjesse53ef9172020-06-10 15:04:01 +0200860 or (args.desugar_library and not args.dry_run)):
Morten Krogh-Jespersenec3047b2020-08-18 13:09:06 +0200861 utils.check_gcert()
Søren Gjesseb8dec612019-10-10 09:15:43 +0200862
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200863 if args.google3:
Ian Zerny59dfa4c2019-10-25 10:34:36 +0200864 targets_to_run.append(prepare_google3(args))
Søren Gjesse73355ec2020-06-29 09:19:44 +0200865 if args.studio and not args.update_desugar_library_in_studio:
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200866 targets_to_run.append(prepare_studio(args))
Morten Krogh-Jespersen00db27f2019-10-02 16:14:46 +0200867 if args.aosp:
Morten Krogh-Jespersenb4a7acc2019-10-02 10:46:32 +0200868 targets_to_run.append(prepare_aosp(args))
Søren Gjesse376b74c2020-06-22 08:42:44 +0200869 if args.maven:
870 targets_to_run.append(prepare_maven(args))
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200871
Søren Gjesse975c5df2019-12-10 13:48:05 +0100872 if args.desugar_library:
873 targets_to_run.append(prepare_desugar_library(args))
874
Søren Gjesse73355ec2020-06-29 09:19:44 +0200875 if args.update_desugar_library_in_studio:
876 if not args.studio:
877 print ("--studio required")
878 sys.exit(1)
879 if args.bug == []:
880 print ("Update studio mirror of com.android.tools:desugar_jdk_libs "
881 + "requires at least one bug by using '--bug'")
882 sys.exit(1)
883 targets_to_run.append(update_desugar_library_in_studio(args))
884
Morten Krogh-Jespersen1947a862019-09-26 14:06:48 +0200885 final_results = []
886 for target_closure in targets_to_run:
887 final_results.append(target_closure(args))
888
889 print '\n\n**************************************************************'
890 print 'PRINTING SUMMARY'
891 print '**************************************************************\n\n'
892
893 for result in final_results:
894 if result is not None:
895 print result
896
897
898if __name__ == '__main__':
899 sys.exit(main())