blob: d9f8335dde20bada8f445a30a84377a5551edcac [file] [log] [blame]
Ian Zernydcb172e2022-02-22 15:36:45 +01001#!/usr/bin/env python3
Rico Windb4621c12017-08-28 12:48:53 +02002# Copyright (c) 2017, 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
Ian Zerny3f54e222019-02-12 10:51:17 +01006import jdk
Rico Wind63a13562018-12-10 14:31:02 +01007import optparse
Rico Windb4621c12017-08-28 12:48:53 +02008import os
Clément Béra3718ad02023-09-05 14:12:48 +02009
10import create_maven_release
11import gradle
12
Morten Krogh-Jespersenfe0d7e12020-01-31 08:50:17 +010013try:
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020014 import resource
Morten Krogh-Jespersenfe0d7e12020-01-31 08:50:17 +010015except ImportError:
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020016 # Not a Unix system. Do what Gandalf tells you not to.
17 pass
Mathias Ravdd6a6de2018-05-18 10:18:33 +020018import shutil
Rico Wind0c24ae72017-09-08 11:33:56 +020019import subprocess
Rico Windb4621c12017-08-28 12:48:53 +020020import sys
21import utils
Yohann Roussel73f58e12017-10-13 17:33:14 +020022import zipfile
Rico Windb4621c12017-08-28 12:48:53 +020023
Rico Wind792e8c72017-08-30 09:43:46 +020024ARCHIVE_BUCKET = 'r8-releases'
Rico Windb4621c12017-08-28 12:48:53 +020025
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020026
Rico Wind63a13562018-12-10 14:31:02 +010027def ParseOptions():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020028 result = optparse.OptionParser()
29 result.add_option('--dry-run',
30 '--dry_run',
31 help='Build only, no upload.',
32 default=False,
33 action='store_true')
34 result.add_option('--dry-run-output',
35 '--dry_run_output',
36 help='Output directory for \'build only, no upload\'.',
37 type="string",
38 action="store")
39 result.add_option(
40 '--skip-gradle-build',
41 '--skip_gradle_build',
42 help='Skip Gradle build. Can only be used for local testing.',
43 default=False,
44 action='store_true')
45 return result.parse_args()
46
Rico Wind63a13562018-12-10 14:31:02 +010047
Rico Windb4621c12017-08-28 12:48:53 +020048def GetVersion():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020049 output = subprocess.check_output([
50 jdk.GetJavaExecutable(), '-cp', utils.R8_JAR, 'com.android.tools.r8.R8',
51 '--version'
52 ]).decode('utf-8')
53 r8_version = output.splitlines()[0].strip()
54 return r8_version.split()[1]
55
Rico Windb4621c12017-08-28 12:48:53 +020056
Rico Wind0c24ae72017-09-08 11:33:56 +020057def GetGitBranches():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020058 return subprocess.check_output(['git', 'show', '-s', '--pretty=%d', 'HEAD'])
59
Rico Windb4621c12017-08-28 12:48:53 +020060
Rico Wind0c24ae72017-09-08 11:33:56 +020061def GetGitHash():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020062 return subprocess.check_output(['git', 'rev-parse',
63 'HEAD']).decode('utf-8').strip()
64
Rico Windb4621c12017-08-28 12:48:53 +020065
Rico Wind1b52acf2021-03-21 12:36:55 +010066def IsMain(version):
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020067 branches = subprocess.check_output(
68 ['git', 'branch', '-r', '--contains', 'HEAD']).decode('utf-8')
69 # CL runs from gerrit does not have a branch, we always treat them as main
70 # commits to archive these to the hash based location
71 if len(branches) == 0:
72 return True
73 if not version == 'main':
74 # Sanity check, we don't want to archive on top of release builds EVER
75 # Note that even though we branch, we never push the bots to build the same
76 # commit as main on a branch since we always change the version to
77 # not be just 'main' (or we crash here :-)).
78 if 'origin/main' in branches:
79 raise Exception('We are seeing origin/main in a commit that '
80 'don\'t have \'main\' as version')
81 return False
82 if not 'origin/main' in branches:
83 raise Exception('We are not seeing origin/main '
84 'in a commit that have \'main\' as version')
Rico Windd450ba12019-04-24 13:18:40 +020085 return True
Rico Wind0c24ae72017-09-08 11:33:56 +020086
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020087
88def GetStorageDestination(storage_prefix, version_or_path, file_name, is_main):
89 # We archive main commits under raw/main instead of directly under raw
90 version_dir = GetVersionDestination(storage_prefix, version_or_path,
91 is_main)
92 return '%s/%s' % (version_dir, file_name)
93
Rico Wind1a29c4f2018-01-25 08:43:08 +010094
Rico Wind72e88702023-10-03 16:55:30 +020095def GetVersionDestination(storage_prefix, version_or_path, is_main):
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020096 archive_dir = 'raw/main' if is_main else 'raw'
97 return '%s%s/%s/%s' % (storage_prefix, ARCHIVE_BUCKET, archive_dir,
98 version_or_path)
99
Rico Wind0c24ae72017-09-08 11:33:56 +0200100
Rico Wind72e88702023-10-03 16:55:30 +0200101def GetUploadDestination(version_or_path, file_name, is_main):
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200102 return GetStorageDestination('gs://', version_or_path, file_name, is_main)
103
Rico Wind0c24ae72017-09-08 11:33:56 +0200104
Rico Wind72e88702023-10-03 16:55:30 +0200105def GetUrl(version_or_path, file_name, is_main):
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200106 return GetStorageDestination('https://storage.googleapis.com/',
107 version_or_path, file_name, is_main)
108
Rico Windc0b16382018-05-17 13:23:43 +0200109
Rico Wind72e88702023-10-03 16:55:30 +0200110def GetMavenUrl(is_main):
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200111 return GetVersionDestination('https://storage.googleapis.com/', '', is_main)
112
Rico Windb4621c12017-08-28 12:48:53 +0200113
Rico Wind7219bb02019-03-18 08:30:12 +0100114def SetRLimitToMax():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200115 (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE)
116 resource.setrlimit(resource.RLIMIT_NOFILE, (hard, hard))
117
Rico Wind7219bb02019-03-18 08:30:12 +0100118
Rico Windcea9ce02019-03-06 14:25:52 +0100119def PrintResourceInfo():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200120 (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE)
121 print('INFO: Open files soft limit: %s' % soft)
122 print('INFO: Open files hard limit: %s' % hard)
Rico Windcea9ce02019-03-06 14:25:52 +0100123
Rico Wind293d6e02023-09-14 15:15:47 +0200124
Ian Zerny566046e2024-01-04 14:24:56 +0100125def RSyncDir(src_dir, version_or_path, dst_dir, is_main, options):
126 destination = GetUploadDestination(version_or_path, dst_dir, is_main)
127 print(f'RSyncing {src_dir} to {destination}')
128 if options.dry_run:
129 if options.dry_run_output:
130 dry_run_destination = os.path.join(options.dry_run_output, version_or_path, dst_dir)
131 print(f'Dry run, not actually syncing. Copying to {dry_run_destination}')
132 shutil.copytree(src_dir, dry_run_destination)
133 else:
134 print('Dry run, not actually uploading')
135 else:
136 utils.rsync_directory_to_cloud_storage(src_dir, destination)
137 print(f'Directory available at: {GetUrl(version_or_path, dst_dir, is_main)}')
138
Ian Zerny1548e3e2023-11-22 10:11:37 +0100139def UploadDir(src_dir, version_or_path, dst_dir, is_main, options):
140 destination = GetUploadDestination(version_or_path, dst_dir, is_main)
141 print(f'Uploading {src_dir} to {destination}')
142 if options.dry_run:
143 if options.dry_run_output:
144 dry_run_destination = os.path.join(options.dry_run_output, version_or_path, dst_dir)
145 print(f'Dry run, not actually uploading. Copying to {dry_run_destination}')
146 shutil.copytree(src_dir, dry_run_destination)
147 else:
148 print('Dry run, not actually uploading')
149 else:
150 utils.upload_directory_to_cloud_storage(src_dir, destination)
151 print(f'Directory available at: {GetUrl(version_or_path, dst_dir, is_main)}')
152
153
Rico Windb4621c12017-08-28 12:48:53 +0200154def Main():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200155 (options, args) = ParseOptions()
156 Run(options)
157
Rico Wind293d6e02023-09-14 15:15:47 +0200158
Rico Wind72e88702023-10-03 16:55:30 +0200159def Run(options):
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200160 if not utils.is_bot() and not options.dry_run:
161 raise Exception('You are not a bot, don\'t archive builds. ' +
162 'Use --dry-run to test locally')
163 if (options.dry_run_output and
164 (not os.path.exists(options.dry_run_output) or
165 not os.path.isdir(options.dry_run_output))):
166 raise Exception(options.dry_run_output +
167 ' does not exist or is not a directory')
168 if (options.skip_gradle_build and not options.dry_run):
169 raise Exception(
170 'Using --skip-gradle-build only supported with --dry-run')
Tamas Kenez180be092018-12-05 15:23:06 +0100171
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200172 if utils.is_bot() and not utils.IsWindows():
173 SetRLimitToMax()
174 if not utils.IsWindows():
175 PrintResourceInfo()
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200176
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200177 with utils.TempDir() as temp:
178 version_file = os.path.join(temp, 'r8-version.properties')
179 with open(version_file, 'w') as version_writer:
180 version_writer.write('version.sha=' + GetGitHash() + '\n')
181 if not os.environ.get('SWARMING_BOT_ID') and not options.dry_run:
182 raise Exception('Environment variable SWARMING_BOT_ID not set')
Søren Gjessec425e6a2019-06-28 11:41:14 +0200183
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200184 releaser = \
185 ("<local developer build>" if options.dry_run
186 else 'releaser=go/r8bot ('
187 + (os.environ.get('SWARMING_BOT_ID') or 'foo') + ')\n')
188 version_writer.write(releaser)
189 version_writer.write('version-file.version.code=1\n')
Yohann Roussel73f58e12017-10-13 17:33:14 +0200190
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200191 create_maven_release.generate_r8_maven_zip(
192 utils.MAVEN_ZIP_LIB,
193 version_file=version_file,
194 skip_gradle_build=options.skip_gradle_build)
Rico Wind293d6e02023-09-14 15:15:47 +0200195
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200196 # Ensure all archived artifacts has been built before archiving.
197 # The target tasks postfixed by 'lib' depend on the actual target task so
198 # building it invokes the original task first.
199 # The '-Pno_internal' flag is important because we generate the lib based on uses in tests.
200 if (not options.skip_gradle_build):
201 gradle.RunGradle([
202 utils.GRADLE_TASK_CONSOLIDATED_LICENSE,
Ian Zernya6af7772023-11-21 14:05:57 +0100203 utils.GRADLE_TASK_KEEP_ANNO_JAR,
204 utils.GRADLE_TASK_KEEP_ANNO_DOC,
205 utils.GRADLE_TASK_R8,
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200206 utils.GRADLE_TASK_R8LIB, utils.GRADLE_TASK_R8LIB_NO_DEPS,
Ian Zerny077a73f2023-10-31 09:05:47 +0100207 utils.GRADLE_TASK_THREADING_MODULE_BLOCKING,
208 utils.GRADLE_TASK_THREADING_MODULE_SINGLE_THREADED,
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200209 utils.GRADLE_TASK_SOURCE_JAR,
210 utils.GRADLE_TASK_SWISS_ARMY_KNIFE, '-Pno_internal'
211 ])
Rico Windcdc39b62022-04-08 12:37:57 +0200212
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200213 # Create maven release of the desuage_jdk_libs configuration. This require
214 # an r8.jar with dependencies to have been built.
215 create_maven_release.generate_desugar_configuration_maven_zip(
216 utils.DESUGAR_CONFIGURATION_MAVEN_ZIP, utils.DESUGAR_CONFIGURATION,
217 utils.DESUGAR_IMPLEMENTATION,
218 utils.LIBRARY_DESUGAR_CONVERSIONS_LEGACY_ZIP)
219 create_maven_release.generate_desugar_configuration_maven_zip(
220 utils.DESUGAR_CONFIGURATION_JDK11_LEGACY_MAVEN_ZIP,
221 utils.DESUGAR_CONFIGURATION_JDK11_LEGACY,
222 utils.DESUGAR_IMPLEMENTATION_JDK11,
223 utils.LIBRARY_DESUGAR_CONVERSIONS_LEGACY_ZIP)
Rico Windcdc39b62022-04-08 12:37:57 +0200224
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200225 create_maven_release.generate_desugar_configuration_maven_zip(
226 utils.DESUGAR_CONFIGURATION_JDK11_MINIMAL_MAVEN_ZIP,
227 utils.DESUGAR_CONFIGURATION_JDK11_MINIMAL,
228 utils.DESUGAR_IMPLEMENTATION_JDK11,
229 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP)
230 create_maven_release.generate_desugar_configuration_maven_zip(
231 utils.DESUGAR_CONFIGURATION_JDK11_MAVEN_ZIP,
232 utils.DESUGAR_CONFIGURATION_JDK11,
233 utils.DESUGAR_IMPLEMENTATION_JDK11,
234 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP)
235 create_maven_release.generate_desugar_configuration_maven_zip(
236 utils.DESUGAR_CONFIGURATION_JDK11_NIO_MAVEN_ZIP,
237 utils.DESUGAR_CONFIGURATION_JDK11_NIO,
238 utils.DESUGAR_IMPLEMENTATION_JDK11,
239 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP)
Søren Gjesse2b047692022-08-19 16:34:38 +0200240
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200241 version = GetVersion()
242 is_main = IsMain(version)
243 if is_main:
244 # On main we use the git hash to archive with
245 print('On main, using git hash for archiving')
246 version = GetGitHash()
Rico Windcdc39b62022-04-08 12:37:57 +0200247
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200248 destination = GetVersionDestination('gs://', version, is_main)
249 if utils.cloud_storage_exists(destination) and not options.dry_run:
250 raise Exception('Target archive directory %s already exists' %
251 destination)
Rico Windcdc39b62022-04-08 12:37:57 +0200252
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200253 # Create pom file for our maven repository that we build for testing.
254 default_pom_file = os.path.join(temp, 'r8.pom')
255 create_maven_release.write_default_r8_pom_file(default_pom_file,
256 version)
Søren Gjesse4569e472023-10-25 15:15:17 +0200257 gradle.RunGradle([
258 ':main:spdxSbom',
259 '-PspdxVersion=' + version,
260 '-PspdxRevision=' + GetGitHash()
261 ])
262
Ian Zerny1548e3e2023-11-22 10:11:37 +0100263 # Upload keep-anno javadoc to a fixed "docs" location.
264 if is_main:
265 version_or_path = 'docs'
266 dst_dir = 'keepanno/javadoc'
Ian Zerny566046e2024-01-04 14:24:56 +0100267 RSyncDir(utils.KEEPANNO_ANNOTATIONS_DOC, version_or_path, dst_dir, is_main, options)
Ian Zerny1548e3e2023-11-22 10:11:37 +0100268
Ian Zernya6af7772023-11-21 14:05:57 +0100269 # Upload directories.
270 dirs_for_archiving = [
Ian Zerny1548e3e2023-11-22 10:11:37 +0100271 (utils.KEEPANNO_ANNOTATIONS_DOC, 'keepanno/javadoc'),
Ian Zernya6af7772023-11-21 14:05:57 +0100272 ]
273 for (src_dir, dst_dir) in dirs_for_archiving:
Ian Zerny1548e3e2023-11-22 10:11:37 +0100274 UploadDir(src_dir, version, dst_dir, is_main, options)
Ian Zernya6af7772023-11-21 14:05:57 +0100275
276 # Upload files.
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200277 for_archiving = [
278 utils.R8_JAR, utils.R8LIB_JAR, utils.R8LIB_JAR + '.map',
279 utils.R8LIB_JAR + '_map.zip', utils.R8_FULL_EXCLUDE_DEPS_JAR,
280 utils.R8LIB_EXCLUDE_DEPS_JAR, utils.R8LIB_EXCLUDE_DEPS_JAR + '.map',
281 utils.R8LIB_EXCLUDE_DEPS_JAR + '_map.zip', utils.MAVEN_ZIP_LIB,
Ian Zerny077a73f2023-10-31 09:05:47 +0100282 utils.THREADING_MODULE_BLOCKING_JAR,
283 utils.THREADING_MODULE_SINGLE_THREADED_JAR,
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200284 utils.DESUGAR_CONFIGURATION, utils.DESUGAR_CONFIGURATION_MAVEN_ZIP,
285 utils.DESUGAR_CONFIGURATION_JDK11_LEGACY,
286 utils.DESUGAR_CONFIGURATION_JDK11_LEGACY_MAVEN_ZIP,
287 utils.DESUGAR_CONFIGURATION_JDK11_MINIMAL_MAVEN_ZIP,
288 utils.DESUGAR_CONFIGURATION_JDK11_MAVEN_ZIP,
289 utils.DESUGAR_CONFIGURATION_JDK11_NIO_MAVEN_ZIP, utils.R8_SRC_JAR,
Søren Gjesse4569e472023-10-25 15:15:17 +0200290 utils.KEEPANNO_ANNOTATIONS_JAR,
291 utils.GENERATED_LICENSE,
292 'd8_r8/main/build/spdx/r8.spdx.json'
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200293 ]
294 for file in for_archiving:
295 file_name = os.path.basename(file)
296 tagged_jar = os.path.join(temp, file_name)
297 shutil.copyfile(file, tagged_jar)
298 if file_name.endswith(
299 '.jar') and not file_name.endswith('-src.jar'):
300 with zipfile.ZipFile(tagged_jar, 'a') as zip:
301 zip.write(version_file, os.path.basename(version_file))
302 destination = GetUploadDestination(version, file_name, is_main)
303 print('Uploading %s to %s' % (tagged_jar, destination))
304 if options.dry_run:
305 if options.dry_run_output:
Ian Zerny1548e3e2023-11-22 10:11:37 +0100306 dry_run_destination = os.path.join(
307 options.dry_run_output, version, file_name)
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200308 print('Dry run, not actually uploading. Copying to ' +
309 dry_run_destination)
310 shutil.copyfile(tagged_jar, dry_run_destination)
311 else:
312 print('Dry run, not actually uploading')
313 else:
314 utils.upload_file_to_cloud_storage(tagged_jar, destination)
315 print('File available at: %s' %
316 GetUrl(version, file_name, is_main))
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200317
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200318 # Upload R8 to a maven compatible location.
319 if file == utils.R8_JAR:
320 maven_dst = GetUploadDestination(
321 utils.get_maven_path('r8', version), 'r8-%s.jar' % version,
322 is_main)
323 maven_pom_dst = GetUploadDestination(
324 utils.get_maven_path('r8', version), 'r8-%s.pom' % version,
325 is_main)
326 if options.dry_run:
327 print('Dry run, not actually creating maven repo for R8')
328 else:
329 utils.upload_file_to_cloud_storage(tagged_jar, maven_dst)
330 utils.upload_file_to_cloud_storage(default_pom_file,
331 maven_pom_dst)
332 print('Maven repo root available at: %s' %
333 GetMavenUrl(is_main))
Rico Windc0b16382018-05-17 13:23:43 +0200334
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200335 # Upload desugar_jdk_libs configuration to a maven compatible location.
336 if file == utils.DESUGAR_CONFIGURATION:
337 jar_basename = 'desugar_jdk_libs_configuration.jar'
338 jar_version_name = 'desugar_jdk_libs_configuration-%s.jar' % version
339 maven_dst = GetUploadDestination(
340 utils.get_maven_path('desugar_jdk_libs_configuration',
341 version), jar_version_name, is_main)
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200342
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200343 with utils.TempDir() as tmp_dir:
344 desugar_jdk_libs_configuration_jar = os.path.join(
345 tmp_dir, jar_version_name)
346 create_maven_release.generate_jar_with_desugar_configuration(
347 utils.DESUGAR_CONFIGURATION,
348 utils.DESUGAR_IMPLEMENTATION,
349 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP,
350 desugar_jdk_libs_configuration_jar)
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200351
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200352 if options.dry_run:
353 print('Dry run, not actually creating maven repo for ' +
354 'desugar configuration.')
355 if options.dry_run_output:
356 shutil.copyfile(
357 desugar_jdk_libs_configuration_jar,
358 os.path.join(options.dry_run_output,
359 jar_version_name))
360 else:
361 utils.upload_file_to_cloud_storage(
362 desugar_jdk_libs_configuration_jar, maven_dst)
363 print('Maven repo root available at: %s' %
364 GetMavenUrl(is_main))
365 # Also archive the jar as non maven destination for Google3
366 jar_destination = GetUploadDestination(
367 version, jar_basename, is_main)
368 utils.upload_file_to_cloud_storage(
369 desugar_jdk_libs_configuration_jar, jar_destination)
Rico Wind92f796f2020-08-25 14:36:18 +0200370
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200371 # TODO(b/237636871): Refactor this to avoid the duplication of what is above.
372 # Upload desugar_jdk_libs JDK-11 legacyconfiguration to a maven compatible location.
373 if file == utils.DESUGAR_CONFIGURATION_JDK11_LEGACY:
374 jar_basename = 'desugar_jdk_libs_configuration.jar'
375 jar_version_name = 'desugar_jdk_libs_configuration-%s-jdk11-legacy.jar' % version
376 maven_dst = GetUploadDestination(
377 utils.get_maven_path('desugar_jdk_libs_configuration',
378 version), jar_version_name, is_main)
Søren Gjessee18fa6e2022-06-24 15:14:53 +0200379
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200380 with utils.TempDir() as tmp_dir:
381 desugar_jdk_libs_configuration_jar = os.path.join(
382 tmp_dir, jar_version_name)
383 create_maven_release.generate_jar_with_desugar_configuration(
384 utils.DESUGAR_CONFIGURATION_JDK11_LEGACY,
385 utils.DESUGAR_IMPLEMENTATION_JDK11,
386 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP,
387 desugar_jdk_libs_configuration_jar)
Søren Gjessee18fa6e2022-06-24 15:14:53 +0200388
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200389 if options.dry_run:
390 print('Dry run, not actually creating maven repo for ' +
391 'desugar configuration.')
392 if options.dry_run_output:
393 shutil.copyfile(
394 desugar_jdk_libs_configuration_jar,
395 os.path.join(options.dry_run_output,
396 jar_version_name))
397 else:
398 utils.upload_file_to_cloud_storage(
399 desugar_jdk_libs_configuration_jar, maven_dst)
400 print('Maven repo root available at: %s' %
401 GetMavenUrl(is_main))
402 # Also archive the jar as non maven destination for Google3
403 jar_destination = GetUploadDestination(
404 version, jar_basename, is_main)
405 utils.upload_file_to_cloud_storage(
406 desugar_jdk_libs_configuration_jar, jar_destination)
407
Rico Windb4621c12017-08-28 12:48:53 +0200408
409if __name__ == '__main__':
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +0200410 sys.exit(Main())