blob: 1ca239e52b1ba36b9e3ccb9cf575697b2a15c267 [file] [log] [blame]
Ian Zernydcb172e2022-02-22 15:36:45 +01001#!/usr/bin/env python3
Mads Agera9745612017-11-02 12:42:15 +01002# 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 Agera9745612017-11-02 12:42:15 +01006import argparse
Mads Agera4911eb2017-11-22 13:19:36 +01007import gradle
8import hashlib
Søren Gjessea70d3bd2019-09-24 15:07:00 +02009import jdk
Søren Gjesse6e5e5842019-09-03 08:48:30 +020010import json
Mads Agera9745612017-11-02 12:42:15 +010011from os import makedirs
Rico Windcdc39b62022-04-08 12:37:57 +020012from os.path import join, basename
Søren Gjesse6e5e5842019-09-03 08:48:30 +020013from shutil import copyfile, make_archive, move, rmtree
Mads Agera9745612017-11-02 12:42:15 +010014import subprocess
15import sys
16from string import Template
17import tempfile
Mads Ager0fab4912017-11-20 13:52:48 +010018import utils
Søren Gjesse17fc67d2019-12-04 14:50:17 +010019import zipfile
Mads Agera9745612017-11-02 12:42:15 +010020
Mads Agera4911eb2017-11-22 13:19:36 +010021DEPENDENCYTEMPLATE = Template(
Mads Agera9745612017-11-02 12:42:15 +010022"""
Mads Agera4911eb2017-11-22 13:19:36 +010023 <dependency>
24 <groupId>$group</groupId>
25 <artifactId>$artifact</artifactId>
26 <version>$version</version>
27 </dependency>""")
Mads Agera9745612017-11-02 12:42:15 +010028
Søren Gjessec425e6a2019-06-28 11:41:14 +020029LICENSETEMPLATE = Template(
30"""
31 <license>
32 <name>$name</name>
33 <url>$url</url>
34 <distribution>repo</distribution>
35 </license>""")
36
Søren Gjesse6e5e5842019-09-03 08:48:30 +020037R8_POMTEMPLATE = Template(
Mads Agera9745612017-11-02 12:42:15 +010038"""<project
39 xmlns="http://maven.apache.org/POM/4.0.0"
40 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
41 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
42 <modelVersion>4.0.0</modelVersion>
43 <groupId>com.android.tools</groupId>
44 <artifactId>r8</artifactId>
45 <version>$version</version>
46 <name>D8 dexer and R8 shrinker</name>
47 <description>
48 D8 dexer and R8 shrinker.
49 </description>
50 <url>http://r8.googlesource.com/r8</url>
51 <inceptionYear>2016</inceptionYear>
52 <licenses>
53 <license>
54 <name>BSD-3-Clause</name>
55 <url>https://opensource.org/licenses/BSD-3-Clause</url>
56 <distribution>repo</distribution>
Søren Gjessec425e6a2019-06-28 11:41:14 +020057 </license>$library_licenses
Mads Ager73460192017-11-08 10:02:50 +010058 </licenses>
Mads Agera4911eb2017-11-22 13:19:36 +010059 <dependencies>$dependencies
60 </dependencies>
Mads Agera9745612017-11-02 12:42:15 +010061 <developers>
62 <developer>
63 <name>The Android Open Source Project</name>
64 </developer>
65 </developers>
66 <scm>
67 <connection>
68 https://r8.googlesource.com/r8.git
69 </connection>
70 <url>
71 https://r8.googlesource.com/r8
72 </url>
73 </scm>
74</project>
75""")
76
Søren Gjesse6e5e5842019-09-03 08:48:30 +020077DESUGAR_CONFIGUATION_POMTEMPLATE = Template(
78"""<project
79 xmlns="http://maven.apache.org/POM/4.0.0"
80 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
81 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
82 <modelVersion>4.0.0</modelVersion>
83 <groupId>com.android.tools</groupId>
Søren Gjesse2b047692022-08-19 16:34:38 +020084 <artifactId>$artifactId</artifactId>
Søren Gjesse6e5e5842019-09-03 08:48:30 +020085 <version>$version</version>
86 <name>D8 configuration to desugar desugar_jdk_libs</name>
87 <description>
88 D8 configuration to desugar desugar_jdk_libs.
89 </description>
90 <url>http://r8.googlesource.com/r8</url>
91 <inceptionYear>2019</inceptionYear>
92 <licenses>
93 <license>
94 <name>BSD-3-Clause</name>
95 <url>https://opensource.org/licenses/BSD-3-Clause</url>
96 <distribution>repo</distribution>
97 </license>
98 </licenses>
Søren Gjesse6e5e5842019-09-03 08:48:30 +020099 <developers>
100 <developer>
101 <name>The Android Open Source Project</name>
102 </developer>
103 </developers>
104 <scm>
105 <connection>
106 https://r8.googlesource.com/r8.git
107 </connection>
108 <url>
109 https://r8.googlesource.com/r8
110 </url>
111 </scm>
112</project>
113""")
114
Mads Agera9745612017-11-02 12:42:15 +0100115def parse_options(argv):
116 result = argparse.ArgumentParser()
Rico Wind8fc8bfa2019-03-22 09:57:36 +0100117 result.add_argument('--out', help='The zip file to output')
Søren Gjesse705a3b12022-03-17 11:37:30 +0100118 group = result.add_mutually_exclusive_group()
119 group.add_argument('--r8lib', action='store_true',
Rico Wind8fc8bfa2019-03-22 09:57:36 +0100120 help='Build r8 with dependencies included shrunken')
Søren Gjesse705a3b12022-03-17 11:37:30 +0100121 group.add_argument('--desugar-configuration', action='store_true',
122 help='Build desugar library configuration (original JDK-8)')
123 group.add_argument('--desugar-configuration-jdk8', action='store_true',
124 help='Build desugar library configuration (original JDK-8)')
125 group.add_argument('--desugar-configuration-jdk11-legacy', action='store_true',
126 help='Build desugar library configuration (JDK-11 legacy)')
Søren Gjesse1a8ccad2023-06-06 15:00:46 +0200127 group.add_argument('--desugar-configuration-jdk11-minimal', action='store_true',
128 help='Build desugar library configuration (JDK-11 minimal)')
129 group.add_argument('--desugar-configuration-jdk11', action='store_true',
130 help='Build desugar library configuration (JDK-11)')
131 group.add_argument('--desugar-configuration-jdk11-nio', action='store_true',
132 help='Build desugar library configuration (JDK-11 nio)')
Mads Agera9745612017-11-02 12:42:15 +0100133 return result.parse_args(argv)
134
Mads Agera4911eb2017-11-22 13:19:36 +0100135def determine_version():
136 version_file = join(
137 utils.SRC_ROOT, 'com', 'android', 'tools', 'r8', 'Version.java')
138 with open(version_file, 'r') as file:
139 for line in file:
140 if 'final String LABEL ' in line:
Rico Wind6feccf22018-05-08 11:18:22 +0200141 result = line[line.find('"') + 1:]
Mads Agera4911eb2017-11-22 13:19:36 +0100142 result = result[:result.find('"')]
143 return result
144 raise Exception('Unable to determine version.')
Mads Agera9745612017-11-02 12:42:15 +0100145
146def generate_library_licenses():
Søren Gjessec425e6a2019-06-28 11:41:14 +0200147 artifact_prefix = '- artifact: '
Mads Agera9745612017-11-02 12:42:15 +0100148 license_prefix = 'license: '
149 licenses = []
150 license_url_prefix = 'licenseUrl: '
151 license_urls = []
Søren Gjesseea678302019-08-27 14:41:03 +0200152 # The ./LIBRARY-LICENSE file is a simple yaml file, which for each dependency
153 # has the following information:
154 #
155 # - artifact: <maven artifact> // in the form <group-id>:<artifact-id>:+
156 # name: <name of dependency>
157 # copyrightHolder: <name of copyright holder>
158 # license: <license name>
159 # licenseUrl: <url to license test>
160 #
161 # E.g. for Guava:
162 #
163 # - artifact: com.google.guava:guava:+
164 # name: Guava Google Core Libraries for Java
165 # copyrightHolder: The Guava Authors
166 # license: The Apache Software License, Version 2.0
167 # licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
168 #
169 # This file should always be up to date as the build will fail if it
170 # is does not have information for all dependencies.
Mads Agera9745612017-11-02 12:42:15 +0100171 with open('LIBRARY-LICENSE', 'r') as file:
Søren Gjessec425e6a2019-06-28 11:41:14 +0200172 name = None
173 url = None
Mads Agera9745612017-11-02 12:42:15 +0100174 for line in file:
175 trimmed = line.strip()
Søren Gjessec425e6a2019-06-28 11:41:14 +0200176 # Collect license name and url for each artifact. They must come in
177 # pairs for each artifact.
178 if trimmed.startswith(artifact_prefix):
179 assert not name
180 assert not url
Mads Agera9745612017-11-02 12:42:15 +0100181 if trimmed.startswith(license_prefix):
Mads Agera9745612017-11-02 12:42:15 +0100182 name = trimmed[len(license_prefix):]
Mads Agera9745612017-11-02 12:42:15 +0100183 if trimmed.startswith(license_url_prefix):
184 url = trimmed[len(license_url_prefix):]
Søren Gjessec425e6a2019-06-28 11:41:14 +0200185 # Licenses come in name/url pairs. When both are present add pair
186 # to collected licenses if either name or url has not been recorded yet,
187 # as some licenses with slightly different names point to the same url.
188 if name and url:
189 if (not name in licenses) or (not url in license_urls):
190 licenses.append(name)
Mads Agera9745612017-11-02 12:42:15 +0100191 license_urls.append(url)
Søren Gjessec425e6a2019-06-28 11:41:14 +0200192 name = None
193 url = None
194 assert len(licenses) == len(license_urls)
Mads Agera9745612017-11-02 12:42:15 +0100195 result = ''
196 for i in range(len(licenses)):
197 name = licenses[i]
198 url = license_urls[i]
199 result += LICENSETEMPLATE.substitute(name=name, url=url)
200 return result
201
Mads Agera4911eb2017-11-22 13:19:36 +0100202
203# Generate the dependencies block for the pom file.
204#
205# We ask gradle to list all dependencies. In that output
206# we locate the runtimeClasspath block for 'main' which
207# looks something like:
208#
209# runtimeClasspath - Runtime classpath of source set 'main'.
210# +--- net.sf.jopt-simple:jopt-simple:4.6
211# +--- com.googlecode.json-simple:json-simple:1.1
212# +--- com.google.guava:guava:23.0
213# +--- it.unimi.dsi:fastutil:7.2.0
214# +--- org.ow2.asm:asm:6.0
215# +--- org.ow2.asm:asm-commons:6.0
216# | \--- org.ow2.asm:asm-tree:6.0
217# | \--- org.ow2.asm:asm:6.0
218# +--- org.ow2.asm:asm-tree:6.0 (*)
219# +--- org.ow2.asm:asm-analysis:6.0
220# | \--- org.ow2.asm:asm-tree:6.0 (*)
221# \--- org.ow2.asm:asm-util:6.0
222# \--- org.ow2.asm:asm-tree:6.0 (*)
223#
224# We filter out the repeats that are marked by '(*)'.
225#
226# For each remaining line, we remove the junk at the start
227# in chunks. As an example:
228#
229# ' | \--- org.ow2.asm:asm-tree:6.0 ' --strip-->
230# '| \--- org.ow2.asm:asm-tree:6.0' -->
231# '\--- org.ow2.asm:asm-tree:6.0' -->
232# 'org.ow2.asm:asm-tree:6.0'
233#
234# The end result is the dependency we are looking for:
235#
236# groupId: org.ow2.asm
237# artifact: asm-tree
238# version: 6.0
239def generate_dependencies():
240 dependencies = gradle.RunGradleGetOutput(['dependencies'])
241 dependency_lines = []
242 collect = False
243 for line in dependencies.splitlines():
Rico Wind5f2d5a72022-02-22 14:23:37 +0100244 if line and 'runtimeClasspath' in line and "'main'" in line:
Mads Agera4911eb2017-11-22 13:19:36 +0100245 collect = True
246 continue
247 if collect:
248 if not len(line) == 0:
249 if not '(*)' in line:
250 trimmed = line.strip()
251 while trimmed.find(' ') != -1:
252 trimmed = trimmed[trimmed.find(' ') + 1:].strip()
253 if not trimmed in dependency_lines:
254 dependency_lines.append(trimmed)
255 else:
256 break
257 result = ''
258 for dep in dependency_lines:
259 components = dep.split(':')
260 assert len(components) == 3
261 group = components[0]
262 artifact = components[1]
263 version = components[2]
264 result += DEPENDENCYTEMPLATE.substitute(
265 group=group, artifact=artifact, version=version)
266 return result
267
Rico Wind257044c2019-11-22 08:21:21 +0100268def write_default_r8_pom_file(pom_file, version):
Søren Gjesse2b047692022-08-19 16:34:38 +0200269 write_pom_file(R8_POMTEMPLATE, pom_file, version, dependencies=generate_dependencies())
Rico Wind257044c2019-11-22 08:21:21 +0100270
Søren Gjesse2b047692022-08-19 16:34:38 +0200271def write_pom_file(
272 template, pom_file, version, artifact_id=None, dependencies='', library_licenses=''):
273 version_pom = (
274 template.substitute(
275 artifactId=artifact_id,
276 version=version,
277 dependencies=dependencies,
278 library_licenses=library_licenses)
279 if artifact_id else
280 template.substitute(
281 version=version, dependencies=dependencies, library_licenses=library_licenses))
Mads Agera9745612017-11-02 12:42:15 +0100282 with open(pom_file, 'w') as file:
283 file.write(version_pom)
284
285def hash_for(file, hash):
286 with open(file, 'rb') as f:
287 while True:
288 # Read chunks of 1MB
289 chunk = f.read(2 ** 20)
290 if not chunk:
291 break
292 hash.update(chunk)
293 return hash.hexdigest()
294
295def write_md5_for(file):
296 hexdigest = hash_for(file, hashlib.md5())
297 with (open(file + '.md5', 'w')) as file:
298 file.write(hexdigest)
299
300def write_sha1_for(file):
301 hexdigest = hash_for(file, hashlib.sha1())
302 with (open(file + '.sha1', 'w')) as file:
303 file.write(hexdigest)
304
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200305def generate_maven_zip(name, version, pom_file, jar_file, out):
Mads Ager14d9b072017-11-20 13:42:55 +0100306 with utils.TempDir() as tmp_dir:
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200307 # Create the base maven version directory
308 version_dir = join(tmp_dir, utils.get_maven_path(name, version))
Mads Ager14d9b072017-11-20 13:42:55 +0100309 makedirs(version_dir)
310 # Write the pom file.
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200311 pom_file_location = join(version_dir, name + '-' + version + '.pom')
312 copyfile(pom_file, pom_file_location)
313 # Write the jar file.
314 jar_file_location = join(version_dir, name + '-' + version + '.jar')
315 copyfile(jar_file, jar_file_location)
Mads Ager14d9b072017-11-20 13:42:55 +0100316 # Create check sums.
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200317 write_md5_for(jar_file_location)
318 write_md5_for(pom_file_location)
319 write_sha1_for(jar_file_location)
320 write_sha1_for(pom_file_location)
Rico Wind8fc8bfa2019-03-22 09:57:36 +0100321 # Zip it up - make_archive will append zip to the file, so remove.
322 assert out.endswith('.zip')
323 base_no_zip = out[0:len(out)-4]
324 make_archive(base_no_zip, 'zip', tmp_dir)
325
Søren Gjesse1b035b32022-08-19 08:53:57 +0200326def generate_r8_maven_zip(out, is_r8lib=False, version_file=None, skip_gradle_build=False):
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200327 # Build the R8 no deps artifact.
Søren Gjesse1b035b32022-08-19 08:53:57 +0200328 if not skip_gradle_build:
329 if not is_r8lib:
330 gradle.RunGradleExcludeDeps([utils.R8])
331 else:
332 gradle.RunGradle([utils.R8LIB, '-Pno_internal'])
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200333
334 version = determine_version()
Rico Wind52ece1b2020-08-25 14:33:17 +0200335 with utils.TempDir() as tmp_dir:
Rico Windcdc39b62022-04-08 12:37:57 +0200336 file_copy = join(tmp_dir, 'copy_of_jar.jar')
337 copyfile(utils.R8LIB_JAR if is_r8lib else utils.R8_JAR, file_copy)
338
339 if version_file:
340 with zipfile.ZipFile(file_copy, 'a') as zip:
341 zip.write(version_file, basename(version_file))
342
Rico Wind52ece1b2020-08-25 14:33:17 +0200343 # Generate the pom file.
344 pom_file = join(tmp_dir, 'r8.pom')
345 write_pom_file(
346 R8_POMTEMPLATE,
347 pom_file,
348 version,
Søren Gjesse2b047692022-08-19 16:34:38 +0200349 dependencies='' if is_r8lib else generate_dependencies(),
350 library_licenses=generate_library_licenses() if is_r8lib else '')
Rico Wind52ece1b2020-08-25 14:33:17 +0200351 # Write the maven zip file.
352 generate_maven_zip(
353 'r8',
354 version,
355 pom_file,
Rico Windcdc39b62022-04-08 12:37:57 +0200356 file_copy,
Rico Wind52ece1b2020-08-25 14:33:17 +0200357 out)
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200358
359# Write the desugaring configuration of a jar file with the following content:
Søren Gjesse17fc67d2019-12-04 14:50:17 +0100360# java/
361# util/
362# <java.util conversions classes>
363# time/
364# <java.time conversions classes>
365# META-INF/
366# desugar/
367# d8/
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200368# desugar.json
Søren Gjesse17fc67d2019-12-04 14:50:17 +0100369# lint/
370# <lint files>
Søren Gjessed98f24c2020-10-30 12:42:31 +0100371def generate_jar_with_desugar_configuration(
372 configuration, implementation, conversions, destination):
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200373 with utils.TempDir() as tmp_dir:
Søren Gjesse17fc67d2019-12-04 14:50:17 +0100374 # Add conversion classes.
375 with zipfile.ZipFile(conversions, 'r') as conversions_zip:
376 conversions_zip.extractall(tmp_dir)
377
Søren Gjesse1a8ccad2023-06-06 15:00:46 +0200378 # Add configuration.
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200379 configuration_dir = join(tmp_dir, 'META-INF', 'desugar', 'd8')
380 makedirs(configuration_dir)
381 copyfile(configuration, join(configuration_dir, 'desugar.json'))
Søren Gjessea70d3bd2019-09-24 15:07:00 +0200382
Søren Gjesse17fc67d2019-12-04 14:50:17 +0100383 # Add lint configuartion.
Søren Gjessea70d3bd2019-09-24 15:07:00 +0200384 lint_dir = join(configuration_dir, 'lint')
385 makedirs(lint_dir)
386 cmd = [
387 jdk.GetJavaExecutable(),
388 '-cp',
389 utils.R8_JAR,
Clément Béra9ef8f842023-05-01 09:16:50 +0200390 'com.android.tools.r8.ir.desugar.desugaredlibrary.lint.GenerateDesugaredLibraryLintFiles',
Søren Gjessea70d3bd2019-09-24 15:07:00 +0200391 configuration,
Søren Gjessed98f24c2020-10-30 12:42:31 +0100392 implementation,
Søren Gjessea70d3bd2019-09-24 15:07:00 +0200393 lint_dir]
394 utils.PrintCmd(cmd)
395 subprocess.check_call(cmd)
396
Søren Gjesse1a8ccad2023-06-06 15:00:46 +0200397 # Add LICENSE file.
398 copyfile(join(utils.REPO_ROOT, 'LICENSE'), join(tmp_dir, 'LICENSE'))
399
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200400 make_archive(destination, 'zip', tmp_dir)
401 move(destination + '.zip', destination)
402
Søren Gjesse79298102022-08-23 16:25:41 +0200403def convert_desugar_configuration(
404 configuration, conversions, implementation, machine_configuration):
Søren Gjesse2b047692022-08-19 16:34:38 +0200405 cmd = [jdk.GetJavaExecutable(),
406 '-cp',
407 utils.R8_JAR,
408 'com.android.tools.r8.ir.desugar.desugaredlibrary.specificationconversion.DesugaredLibraryConverter',
409 configuration,
Søren Gjesse79298102022-08-23 16:25:41 +0200410 implementation,
411 conversions,
Søren Gjesse2b047692022-08-19 16:34:38 +0200412 utils.get_android_jar(33),
413 machine_configuration]
414 subprocess.check_call(cmd)
415
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200416# Generate the maven zip for the configuration to desugar desugar_jdk_libs.
Søren Gjessee18fa6e2022-06-24 15:14:53 +0200417def generate_desugar_configuration_maven_zip(
418 out, configuration, implementation, conversions):
Rico Wind52ece1b2020-08-25 14:33:17 +0200419 with utils.TempDir() as tmp_dir:
Søren Gjesse2b047692022-08-19 16:34:38 +0200420 (name, version) = utils.desugar_configuration_name_and_version(configuration, False)
421
422 if (not version.startswith("1.")):
423 machine_configuration = join(tmp_dir, "machine.json")
Søren Gjesse79298102022-08-23 16:25:41 +0200424 convert_desugar_configuration(configuration, conversions, implementation, machine_configuration)
Søren Gjesse2b047692022-08-19 16:34:38 +0200425 configuration = machine_configuration
426
Rico Wind52ece1b2020-08-25 14:33:17 +0200427 # Generate the pom file.
428 pom_file = join(tmp_dir, 'desugar_configuration.pom')
Søren Gjesse2b047692022-08-19 16:34:38 +0200429 write_pom_file(DESUGAR_CONFIGUATION_POMTEMPLATE, pom_file, version, artifact_id=name)
Rico Wind52ece1b2020-08-25 14:33:17 +0200430 # Generate the jar with the configuration file.
431 jar_file = join(tmp_dir, 'desugar_configuration.jar')
432 generate_jar_with_desugar_configuration(
Søren Gjesse705a3b12022-03-17 11:37:30 +0100433 configuration,
434 implementation,
Søren Gjessee18fa6e2022-06-24 15:14:53 +0200435 conversions,
Rico Wind52ece1b2020-08-25 14:33:17 +0200436 jar_file)
437 # Write the maven zip file.
Søren Gjesse2b047692022-08-19 16:34:38 +0200438 generate_maven_zip(name, version, pom_file, jar_file, out)
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200439
Rico Wind8fc8bfa2019-03-22 09:57:36 +0100440def main(argv):
441 options = parse_options(argv)
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200442 if options.out == None:
443 raise Exception(
444 'Need to supply output zip with --out.')
Søren Gjesse705a3b12022-03-17 11:37:30 +0100445 if options.desugar_configuration or options.desugar_configuration_jdk8:
446 generate_desugar_configuration_maven_zip(
Søren Gjesse1a8ccad2023-06-06 15:00:46 +0200447 options.out,
448 utils.DESUGAR_CONFIGURATION,
449 utils.DESUGAR_IMPLEMENTATION,
450 utils.LIBRARY_DESUGAR_CONVERSIONS_LEGACY_ZIP)
Søren Gjesse705a3b12022-03-17 11:37:30 +0100451 elif options.desugar_configuration_jdk11_legacy:
452 generate_desugar_configuration_maven_zip(
Søren Gjesse1a8ccad2023-06-06 15:00:46 +0200453 options.out,
454 utils.DESUGAR_CONFIGURATION_JDK11_LEGACY,
455 utils.DESUGAR_IMPLEMENTATION_JDK11,
456 utils.LIBRARY_DESUGAR_CONVERSIONS_LEGACY_ZIP)
457 elif options.desugar_configuration_jdk11_minimal:
458 generate_desugar_configuration_maven_zip(
459 options.out,
460 utils.DESUGAR_CONFIGURATION_JDK11_MINIMAL,
461 utils.DESUGAR_IMPLEMENTATION_JDK11,
462 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP)
463 elif options.desugar_configuration_jdk11:
464 generate_desugar_configuration_maven_zip(
465 options.out,
466 utils.DESUGAR_CONFIGURATION_JDK11,
467 utils.DESUGAR_IMPLEMENTATION_JDK11,
468 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP)
469 elif options.desugar_configuration_jdk11_nio:
470 generate_desugar_configuration_maven_zip(
471 options.out,
472 utils.DESUGAR_CONFIGURATION_JDK11_NIO,
473 utils.DESUGAR_IMPLEMENTATION_JDK11,
474 utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP)
Søren Gjesse6e5e5842019-09-03 08:48:30 +0200475 else:
476 generate_r8_maven_zip(options.out, options.r8lib)
Mads Agera9745612017-11-02 12:42:15 +0100477
478if __name__ == "__main__":
479 exit(main(sys.argv[1:]))