Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # 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 | |
Mads Ager | ac79413 | 2017-11-09 11:38:45 +0100 | [diff] [blame] | 6 | import create_maven_release |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 7 | import gradle |
Ian Zerny | 3f54e22 | 2019-02-12 10:51:17 +0100 | [diff] [blame] | 8 | import jdk |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 9 | import optparse |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 10 | import os |
Morten Krogh-Jespersen | fe0d7e1 | 2020-01-31 08:50:17 +0100 | [diff] [blame] | 11 | try: |
| 12 | import resource |
| 13 | except ImportError: |
| 14 | # Not a Unix system. Do what Gandalf tells you not to. |
| 15 | pass |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 16 | import shutil |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 17 | import subprocess |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 18 | import sys |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 19 | import toolhelper |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 20 | import utils |
Yohann Roussel | 73f58e1 | 2017-10-13 17:33:14 +0200 | [diff] [blame] | 21 | import zipfile |
Tamas Kenez | 180be09 | 2018-12-05 15:23:06 +0100 | [diff] [blame] | 22 | from build_r8lib import build_r8lib |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 23 | |
Rico Wind | 792e8c7 | 2017-08-30 09:43:46 +0200 | [diff] [blame] | 24 | ARCHIVE_BUCKET = 'r8-releases' |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 25 | |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 26 | def ParseOptions(): |
| 27 | result = optparse.OptionParser() |
| 28 | result.add_option('--dry-run', '--dry_run', |
| 29 | help='Build only, no upload.', |
| 30 | default=False, action='store_true') |
Søren Gjesse | c425e6a | 2019-06-28 11:41:14 +0200 | [diff] [blame] | 31 | result.add_option('--dry-run-output', '--dry_run_output', |
| 32 | help='Output directory for \'build only, no upload\'.', |
| 33 | type="string", action="store") |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 34 | return result.parse_args() |
| 35 | |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 36 | def GetToolVersion(jar_path): |
Morten Krogh-Jespersen | 0de1373 | 2019-03-01 08:56:39 +0100 | [diff] [blame] | 37 | # TODO(mkroghj) This would not work for r8-lib, maybe use utils.getR8Version. |
Ian Zerny | 3f54e22 | 2019-02-12 10:51:17 +0100 | [diff] [blame] | 38 | output = subprocess.check_output([ |
| 39 | jdk.GetJavaExecutable(), '-jar', jar_path, '--version' |
| 40 | ]) |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 41 | return output.splitlines()[0].strip() |
| 42 | |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 43 | def GetVersion(): |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 44 | r8_version = GetToolVersion(utils.R8_JAR) |
| 45 | d8_version = GetToolVersion(utils.D8_JAR) |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 46 | # The version printed is "D8 vVERSION_NUMBER" and "R8 vVERSION_NUMBER" |
| 47 | # Sanity check that versions match. |
| 48 | if d8_version.split()[1] != r8_version.split()[1]: |
| 49 | raise Exception( |
| 50 | 'Version mismatch: \n%s\n%s' % (d8_version, r8_version)) |
| 51 | return d8_version.split()[1] |
| 52 | |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 53 | def GetGitBranches(): |
| 54 | return subprocess.check_output(['git', 'show', '-s', '--pretty=%d', 'HEAD']) |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 55 | |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 56 | def GetGitHash(): |
| 57 | return subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip() |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 58 | |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 59 | def IsMain(version): |
Rico Wind | 2f72029 | 2017-10-06 14:32:12 +0200 | [diff] [blame] | 60 | branches = subprocess.check_output(['git', 'branch', '-r', '--contains', |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 61 | 'HEAD']) |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 62 | # CL runs from gerrit does not have a branch, we always treat them as main |
Rico Wind | d450ba1 | 2019-04-24 13:18:40 +0200 | [diff] [blame] | 63 | # commits to archive these to the hash based location |
| 64 | if len(branches) == 0: |
| 65 | return True |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 66 | if not version == 'main': |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 67 | # Sanity check, we don't want to archive on top of release builds EVER |
| 68 | # Note that even though we branch, we never push the bots to build the same |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 69 | # commit as main on a branch since we always change the version to |
| 70 | # not be just 'main' (or we crash here :-)). |
| 71 | if 'origin/main' in branches: |
| 72 | raise Exception('We are seeing origin/main in a commit that ' |
| 73 | 'don\'t have \'main\' as version') |
Mads Ager | ac79413 | 2017-11-09 11:38:45 +0100 | [diff] [blame] | 74 | return False |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 75 | if not 'origin/main' in branches: |
| 76 | raise Exception('We are not seeing origin/main ' |
| 77 | 'in a commit that have \'main\' as version') |
Mads Ager | ac79413 | 2017-11-09 11:38:45 +0100 | [diff] [blame] | 78 | return True |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 79 | |
Rico Wind | c0b1638 | 2018-05-17 13:23:43 +0200 | [diff] [blame] | 80 | def GetStorageDestination(storage_prefix, |
| 81 | version_or_path, |
| 82 | file_name, |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 83 | is_main): |
| 84 | # We archive main commits under raw/main instead of directly under raw |
Rico Wind | c0b1638 | 2018-05-17 13:23:43 +0200 | [diff] [blame] | 85 | version_dir = GetVersionDestination(storage_prefix, |
| 86 | version_or_path, |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 87 | is_main) |
Rico Wind | 1a29c4f | 2018-01-25 08:43:08 +0100 | [diff] [blame] | 88 | return '%s/%s' % (version_dir, file_name) |
| 89 | |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 90 | def GetVersionDestination(storage_prefix, version_or_path, is_main): |
| 91 | archive_dir = 'raw/main' if is_main else 'raw' |
Rico Wind | c0b1638 | 2018-05-17 13:23:43 +0200 | [diff] [blame] | 92 | return '%s%s/%s/%s' % (storage_prefix, ARCHIVE_BUCKET, |
| 93 | archive_dir, version_or_path) |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 94 | |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 95 | def GetUploadDestination(version_or_path, file_name, is_main): |
| 96 | return GetStorageDestination('gs://', version_or_path, file_name, is_main) |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 97 | |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 98 | def GetUrl(version_or_path, file_name, is_main): |
Rico Wind | 70d614f | 2020-01-31 08:45:21 +0100 | [diff] [blame] | 99 | return GetStorageDestination('https://storage.googleapis.com/', |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 100 | version_or_path, file_name, is_main) |
Rico Wind | c0b1638 | 2018-05-17 13:23:43 +0200 | [diff] [blame] | 101 | |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 102 | def GetMavenUrl(is_main): |
| 103 | return GetVersionDestination('https://storage.googleapis.com/', '', is_main) |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 104 | |
Rico Wind | 7219bb0 | 2019-03-18 08:30:12 +0100 | [diff] [blame] | 105 | def SetRLimitToMax(): |
| 106 | (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE) |
| 107 | resource.setrlimit(resource.RLIMIT_NOFILE, (hard, hard)) |
| 108 | |
Rico Wind | cea9ce0 | 2019-03-06 14:25:52 +0100 | [diff] [blame] | 109 | def PrintResourceInfo(): |
| 110 | (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE) |
| 111 | print('INFO: Open files soft limit: %s' % soft) |
| 112 | print('INFO: Open files hard limit: %s' % hard) |
| 113 | |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 114 | def Main(): |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 115 | (options, args) = ParseOptions() |
Rico Wind | 089ca04 | 2019-03-06 13:27:25 +0000 | [diff] [blame] | 116 | if not utils.is_bot() and not options.dry_run: |
Søren Gjesse | c425e6a | 2019-06-28 11:41:14 +0200 | [diff] [blame] | 117 | raise Exception('You are not a bot, don\'t archive builds. ' |
| 118 | + 'Use --dry-run to test locally') |
Søren Gjesse | c425e6a | 2019-06-28 11:41:14 +0200 | [diff] [blame] | 119 | if (options.dry_run_output and |
| 120 | (not os.path.exists(options.dry_run_output) or |
| 121 | not os.path.isdir(options.dry_run_output))): |
| 122 | raise Exception(options.dry_run_output |
| 123 | + ' does not exist or is not a directory') |
Tamas Kenez | 180be09 | 2018-12-05 15:23:06 +0100 | [diff] [blame] | 124 | |
Morten Krogh-Jespersen | fe0d7e1 | 2020-01-31 08:50:17 +0100 | [diff] [blame] | 125 | if utils.is_bot() and not utils.IsWindows(): |
Rico Wind | 7219bb0 | 2019-03-18 08:30:12 +0100 | [diff] [blame] | 126 | SetRLimitToMax() |
Morten Krogh-Jespersen | fe0d7e1 | 2020-01-31 08:50:17 +0100 | [diff] [blame] | 127 | if not utils.IsWindows(): |
| 128 | PrintResourceInfo() |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 129 | |
Tamas Kenez | 180be09 | 2018-12-05 15:23:06 +0100 | [diff] [blame] | 130 | # Create maven release which uses a build that exclude dependencies. |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 131 | create_maven_release.generate_r8_maven_zip(utils.MAVEN_ZIP) |
| 132 | create_maven_release.generate_r8_maven_zip( |
| 133 | utils.MAVEN_ZIP_LIB, is_r8lib=True) |
Mads Ager | a4911eb | 2017-11-22 13:19:36 +0100 | [diff] [blame] | 134 | |
Tamas Kenez | 180be09 | 2018-12-05 15:23:06 +0100 | [diff] [blame] | 135 | # Generate and copy a full build without dependencies. |
Mads Ager | b10c07f | 2017-11-27 13:25:52 +0100 | [diff] [blame] | 136 | gradle.RunGradleExcludeDeps([utils.R8, utils.R8_SRC]) |
Tamas Kenez | 180be09 | 2018-12-05 15:23:06 +0100 | [diff] [blame] | 137 | shutil.copyfile(utils.R8_JAR, utils.R8_FULL_EXCLUDE_DEPS_JAR) |
Mads Ager | 0bd1ebd | 2017-11-22 13:40:21 +0100 | [diff] [blame] | 138 | |
Mads Ager | ac79413 | 2017-11-09 11:38:45 +0100 | [diff] [blame] | 139 | # Ensure all archived artifacts has been built before archiving. |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 140 | # The target tasks postfixed by 'lib' depend on the actual target task so |
Tamas Kenez | f960e9c | 2018-12-03 16:13:29 +0100 | [diff] [blame] | 141 | # building it invokes the original task first. |
Morten Krogh-Jespersen | e28db46 | 2019-01-09 13:32:15 +0100 | [diff] [blame] | 142 | # The '-Pno_internal' flag is important because we generate the lib based on uses in tests. |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 143 | gradle.RunGradle([ |
| 144 | utils.R8, |
| 145 | utils.D8, |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 146 | utils.R8LIB, |
Morten Krogh-Jespersen | cae32a7 | 2019-01-11 11:02:19 +0100 | [diff] [blame] | 147 | utils.R8LIB_NO_DEPS, |
Søren Gjesse | 17fc67d | 2019-12-04 14:50:17 +0100 | [diff] [blame] | 148 | utils.LIBRARY_DESUGAR_CONVERSIONS, |
Morten Krogh-Jespersen | e28db46 | 2019-01-09 13:32:15 +0100 | [diff] [blame] | 149 | '-Pno_internal' |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 150 | ]) |
Søren Gjesse | a70d3bd | 2019-09-24 15:07:00 +0200 | [diff] [blame] | 151 | |
| 152 | # Create maven release of the desuage_jdk_libs configuration. This require |
| 153 | # an r8.jar with dependencies to have been built. |
| 154 | create_maven_release.generate_desugar_configuration_maven_zip( |
| 155 | utils.DESUGAR_CONFIGURATION_MAVEN_ZIP) |
| 156 | |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 157 | version = GetVersion() |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 158 | is_main = IsMain(version) |
| 159 | if is_main: |
| 160 | # On main we use the git hash to archive with |
| 161 | print('On main, using git hash for archiving') |
Rico Wind | 0c24ae7 | 2017-09-08 11:33:56 +0200 | [diff] [blame] | 162 | version = GetGitHash() |
| 163 | |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 164 | destination = GetVersionDestination('gs://', version, is_main) |
Søren Gjesse | de7dd45 | 2019-03-06 16:03:17 +0100 | [diff] [blame] | 165 | if utils.cloud_storage_exists(destination) and not options.dry_run: |
Rico Wind | 1a29c4f | 2018-01-25 08:43:08 +0100 | [diff] [blame] | 166 | raise Exception('Target archive directory %s already exists' % destination) |
Yohann Roussel | 73f58e1 | 2017-10-13 17:33:14 +0200 | [diff] [blame] | 167 | with utils.TempDir() as temp: |
Rico Wind | 257044c | 2019-11-22 08:21:21 +0100 | [diff] [blame] | 168 | # Create pom file for our maven repository that we build for testing. |
| 169 | default_pom_file = os.path.join(temp, 'r8.pom') |
| 170 | create_maven_release.write_default_r8_pom_file(default_pom_file, version) |
| 171 | |
Yohann Roussel | 73f58e1 | 2017-10-13 17:33:14 +0200 | [diff] [blame] | 172 | version_file = os.path.join(temp, 'r8-version.properties') |
| 173 | with open(version_file,'w') as version_writer: |
| 174 | version_writer.write('version.sha=' + GetGitHash() + '\n') |
Søren Gjesse | c425e6a | 2019-06-28 11:41:14 +0200 | [diff] [blame] | 175 | if not os.environ.get('SWARMING_BOT_ID') and not options.dry_run: |
| 176 | raise Exception('Environment variable SWARMING_BOT_ID not set') |
| 177 | |
| 178 | releaser = \ |
| 179 | ("<local developer build>" if options.dry_run |
| 180 | else 'releaser=go/r8bot (' |
| 181 | + os.environ.get('SWARMING_BOT_ID') + ')\n') |
| 182 | version_writer.write(releaser) |
Yohann Roussel | 73f58e1 | 2017-10-13 17:33:14 +0200 | [diff] [blame] | 183 | version_writer.write('version-file.version.code=1\n') |
| 184 | |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 185 | for file in [ |
| 186 | utils.D8_JAR, |
| 187 | utils.R8_JAR, |
| 188 | utils.R8LIB_JAR, |
Tamas Kenez | 54b939a | 2018-12-07 15:55:26 +0100 | [diff] [blame] | 189 | utils.R8LIB_JAR + '.map', |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 190 | utils.R8_SRC_JAR, |
| 191 | utils.R8_FULL_EXCLUDE_DEPS_JAR, |
| 192 | utils.R8LIB_EXCLUDE_DEPS_JAR, |
Tamas Kenez | 54b939a | 2018-12-07 15:55:26 +0100 | [diff] [blame] | 193 | utils.R8LIB_EXCLUDE_DEPS_JAR + '.map', |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 194 | utils.MAVEN_ZIP, |
Rico Wind | 8fc8bfa | 2019-03-22 09:57:36 +0100 | [diff] [blame] | 195 | utils.MAVEN_ZIP_LIB, |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 196 | utils.DESUGAR_CONFIGURATION, |
| 197 | utils.DESUGAR_CONFIGURATION_MAVEN_ZIP, |
Tamas Kenez | 03ab76f | 2018-12-07 14:33:25 +0100 | [diff] [blame] | 198 | utils.GENERATED_LICENSE, |
| 199 | ]: |
Mads Ager | ac79413 | 2017-11-09 11:38:45 +0100 | [diff] [blame] | 200 | file_name = os.path.basename(file) |
Yohann Roussel | 73f58e1 | 2017-10-13 17:33:14 +0200 | [diff] [blame] | 201 | tagged_jar = os.path.join(temp, file_name) |
Mads Ager | ac79413 | 2017-11-09 11:38:45 +0100 | [diff] [blame] | 202 | shutil.copyfile(file, tagged_jar) |
Mads Ager | b10c07f | 2017-11-27 13:25:52 +0100 | [diff] [blame] | 203 | if file_name.endswith('.jar') and not file_name.endswith('-src.jar'): |
Mads Ager | afc0cda | 2017-11-27 13:04:27 +0100 | [diff] [blame] | 204 | with zipfile.ZipFile(tagged_jar, 'a') as zip: |
| 205 | zip.write(version_file, os.path.basename(version_file)) |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 206 | destination = GetUploadDestination(version, file_name, is_main) |
Yohann Roussel | 73f58e1 | 2017-10-13 17:33:14 +0200 | [diff] [blame] | 207 | print('Uploading %s to %s' % (tagged_jar, destination)) |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 208 | if options.dry_run: |
Søren Gjesse | c425e6a | 2019-06-28 11:41:14 +0200 | [diff] [blame] | 209 | if options.dry_run_output: |
| 210 | dry_run_destination = os.path.join(options.dry_run_output, file_name) |
| 211 | print('Dry run, not actually uploading. Copying to ' |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 212 | + dry_run_destination) |
Søren Gjesse | c425e6a | 2019-06-28 11:41:14 +0200 | [diff] [blame] | 213 | shutil.copyfile(tagged_jar, dry_run_destination) |
| 214 | else: |
| 215 | print('Dry run, not actually uploading') |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 216 | else: |
| 217 | utils.upload_file_to_cloud_storage(tagged_jar, destination) |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 218 | print('File available at: %s' % GetUrl(version, file_name, is_main)) |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 219 | |
| 220 | # Upload R8 to a maven compatible location. |
Rico Wind | c0b1638 | 2018-05-17 13:23:43 +0200 | [diff] [blame] | 221 | if file == utils.R8_JAR: |
Søren Gjesse | 1c115b5 | 2019-08-14 12:43:57 +0200 | [diff] [blame] | 222 | maven_dst = GetUploadDestination(utils.get_maven_path('r8', version), |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 223 | 'r8-%s.jar' % version, is_main) |
Rico Wind | 257044c | 2019-11-22 08:21:21 +0100 | [diff] [blame] | 224 | maven_pom_dst = GetUploadDestination( |
| 225 | utils.get_maven_path('r8', version), |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 226 | 'r8-%s.pom' % version, is_main) |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 227 | if options.dry_run: |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 228 | print('Dry run, not actually creating maven repo for R8') |
Rico Wind | 63a1356 | 2018-12-10 14:31:02 +0100 | [diff] [blame] | 229 | else: |
| 230 | utils.upload_file_to_cloud_storage(tagged_jar, maven_dst) |
Rico Wind | 257044c | 2019-11-22 08:21:21 +0100 | [diff] [blame] | 231 | utils.upload_file_to_cloud_storage(default_pom_file, maven_pom_dst) |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 232 | print('Maven repo root available at: %s' % GetMavenUrl(is_main)) |
Rico Wind | c0b1638 | 2018-05-17 13:23:43 +0200 | [diff] [blame] | 233 | |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 234 | # Upload desugar_jdk_libs configuration to a maven compatible location. |
| 235 | if file == utils.DESUGAR_CONFIGURATION: |
Rico Wind | 92f796f | 2020-08-25 14:36:18 +0200 | [diff] [blame] | 236 | jar_basename = 'desugar_jdk_libs_configuration.jar' |
| 237 | jar_version_name = 'desugar_jdk_libs_configuration-%s.jar' % version |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 238 | maven_dst = GetUploadDestination( |
| 239 | utils.get_maven_path('desugar_jdk_libs_configuration', version), |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 240 | jar_version_name, is_main) |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 241 | |
| 242 | with utils.TempDir() as tmp_dir: |
Rico Wind | 92f796f | 2020-08-25 14:36:18 +0200 | [diff] [blame] | 243 | desugar_jdk_libs_configuration_jar = os.path.join(tmp_dir, |
| 244 | jar_version_name) |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 245 | create_maven_release.generate_jar_with_desugar_configuration( |
Søren Gjesse | 17fc67d | 2019-12-04 14:50:17 +0100 | [diff] [blame] | 246 | utils.DESUGAR_CONFIGURATION, |
Søren Gjesse | dd1f815 | 2020-10-30 13:00:01 +0100 | [diff] [blame] | 247 | utils.DESUGAR_IMPLEMENTATION, |
Søren Gjesse | 17fc67d | 2019-12-04 14:50:17 +0100 | [diff] [blame] | 248 | utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP, |
| 249 | desugar_jdk_libs_configuration_jar) |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 250 | |
| 251 | if options.dry_run: |
| 252 | print('Dry run, not actually creating maven repo for ' |
| 253 | + 'desugar configuration.') |
Søren Gjesse | 706f755 | 2019-09-23 13:34:58 +0200 | [diff] [blame] | 254 | if options.dry_run_output: |
| 255 | shutil.copyfile( |
| 256 | desugar_jdk_libs_configuration_jar, |
Rico Wind | 92f796f | 2020-08-25 14:36:18 +0200 | [diff] [blame] | 257 | os.path.join(options.dry_run_output, jar_version_name)) |
Søren Gjesse | 6e5e584 | 2019-09-03 08:48:30 +0200 | [diff] [blame] | 258 | else: |
| 259 | utils.upload_file_to_cloud_storage( |
| 260 | desugar_jdk_libs_configuration_jar, maven_dst) |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 261 | print('Maven repo root available at: %s' % GetMavenUrl(is_main)) |
Rico Wind | 92f796f | 2020-08-25 14:36:18 +0200 | [diff] [blame] | 262 | # Also archive the jar as non maven destination for Google3 |
| 263 | jar_destination = GetUploadDestination( |
Rico Wind | 1b52acf | 2021-03-21 12:36:55 +0100 | [diff] [blame] | 264 | version, jar_basename, is_main) |
Rico Wind | 92f796f | 2020-08-25 14:36:18 +0200 | [diff] [blame] | 265 | utils.upload_file_to_cloud_storage( |
| 266 | desugar_jdk_libs_configuration_jar, jar_destination) |
| 267 | |
Rico Wind | b4621c1 | 2017-08-28 12:48:53 +0200 | [diff] [blame] | 268 | |
| 269 | if __name__ == '__main__': |
| 270 | sys.exit(Main()) |