Update desugared library release scripts
* Include test_base jar when running Undesugar
* Better error messages
Bug: b/356561585
Change-Id: I134d8ef24146bda271be6f877ad598ce8da5c164
diff --git a/tools/archive_desugar_jdk_libs.py b/tools/archive_desugar_jdk_libs.py
index ead0bdd..1a9dd57 100755
--- a/tools/archive_desugar_jdk_libs.py
+++ b/tools/archive_desugar_jdk_libs.py
@@ -268,7 +268,9 @@
def Undesugar(variant, maven_zip, version, undesugared_maven_zip):
gradle.RunGradle([
- utils.GRADLE_TASK_R8, utils.GRADLE_TASK_TEST_JAR,
+ utils.GRADLE_TASK_R8,
+ utils.GRADLE_TASK_TEST_BASE_JAR,
+ utils.GRADLE_TASK_TEST_JAR,
utils.GRADLE_TASK_TEST_DEPS_JAR, '-Pno_internal'
])
with utils.TempDir() as tmp:
@@ -282,8 +284,8 @@
buildLibs = os.path.join(defines.REPO_ROOT, 'build', 'libs')
cmd = [
jdk.GetJavaExecutable(), '-cp',
- '%s:%s:%s' %
- (utils.R8_JAR, utils.R8_TESTS_JAR, utils.R8_TESTS_DEPS_JAR),
+ '%s:%s:%s:%s' %
+ (utils.R8_JAR, utils.R8_TESTBASE_JAR, utils.R8_TESTS_JAR, utils.R8_TESTS_DEPS_JAR),
'com.android.tools.r8.desugar.desugaredlibrary.jdk11.DesugaredLibraryJDK11Undesugarer',
desugar_jdk_libs_jar, undesugared_jar
]
diff --git a/tools/desugar_jdk_libs_repository.py b/tools/desugar_jdk_libs_repository.py
index 36268c4..dfe4ed6 100755
--- a/tools/desugar_jdk_libs_repository.py
+++ b/tools/desugar_jdk_libs_repository.py
@@ -88,7 +88,7 @@
configuration = None
conversions = None
implementation = None
- version_file = None
+ version_file_name = None
implementation_build_target = None
implementation_maven_zip = None
release_archive_location = None
@@ -99,7 +99,7 @@
configuration = utils.DESUGAR_CONFIGURATION
conversions = utils.LIBRARY_DESUGAR_CONVERSIONS_LEGACY_ZIP
implementation = utils.DESUGAR_IMPLEMENTATION
- version_file = 'VERSION.txt'
+ version_file_name = 'VERSION.txt'
implementation_build_target = ':maven_release'
implementation_maven_zip = 'desugar_jdk_libs.zip'
release_archive_location = 'desugar_jdk_libs'
@@ -109,7 +109,7 @@
configuration = utils.DESUGAR_CONFIGURATION_JDK11_LEGACY
conversions = utils.LIBRARY_DESUGAR_CONVERSIONS_LEGACY_ZIP
implementation = utils.DESUGAR_IMPLEMENTATION_JDK11
- version_file = 'VERSION_JDK11_LEGACY.txt'
+ version_file_name = 'VERSION_JDK11_LEGACY.txt'
implementation_build_target = ':maven_release_jdk11_legacy'
implementation_maven_zip = 'desugar_jdk_libs_jdk11_legacy.zip'
release_archive_location = 'desugar_jdk_libs'
@@ -119,7 +119,7 @@
configuration = utils.DESUGAR_CONFIGURATION_JDK11_MINIMAL
conversions = utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP
implementation = utils.DESUGAR_IMPLEMENTATION_JDK11
- version_file = 'VERSION_JDK11_MINIMAL.txt'
+ version_file_name = 'VERSION_JDK11_MINIMAL.txt'
implementation_build_target = ':maven_release_jdk11_minimal'
implementation_maven_zip = 'desugar_jdk_libs_jdk11_minimal.zip'
release_archive_location = 'desugar_jdk_libs_minimal'
@@ -129,7 +129,7 @@
configuration = utils.DESUGAR_CONFIGURATION_JDK11
conversions = utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP
implementation = utils.DESUGAR_IMPLEMENTATION_JDK11
- version_file = 'VERSION_JDK11.txt'
+ version_file_name = 'VERSION_JDK11.txt'
implementation_build_target = ':maven_release_jdk11'
implementation_maven_zip = 'desugar_jdk_libs_jdk11.zip'
release_archive_location = 'desugar_jdk_libs'
@@ -139,7 +139,7 @@
configuration = utils.DESUGAR_CONFIGURATION_JDK11_NIO
conversions = utils.LIBRARY_DESUGAR_CONVERSIONS_ZIP
implementation = utils.DESUGAR_IMPLEMENTATION_JDK11
- version_file = 'VERSION_JDK11_NIO.txt'
+ version_file_name = 'VERSION_JDK11_NIO.txt'
implementation_build_target = ':maven_release_jdk11_nio'
implementation_maven_zip = 'desugar_jdk_libs_jdk11_nio.zip'
release_archive_location = 'desugar_jdk_libs_nio'
@@ -171,8 +171,9 @@
'git', '-C', checkout_dir, 'checkout',
args.desugar_jdk_libs_revision
])
+ if not args.release_version:
with utils.ChangedWorkingDirectory(checkout_dir):
- with open(version_file) as version_file:
+ with open(version_file_name) as version_file:
version_file_lines = version_file.readlines()
for line in version_file_lines:
if not line.startswith('#'):
@@ -180,9 +181,13 @@
if (version != desugar_jdk_libs_version):
raise Exception(
"Version mismatch. Configuration has version '"
- + version +
- "', and desugar_jdk_libs has version '" +
- desugar_jdk_libs_version + "'")
+ + version
+ + "', and desugar_jdk_libs has version '"
+ + desugar_jdk_libs_version
+ + " in '" + version_file_name
+ + "'. If testing a new version use "
+ + "--desugar-jdk-libs-checkout with updated "
+ + "VERSION_*.txt and DEPENDENCIES_*.txt files.")
# Build desugared library configuration.
print("Building desugared library configuration " + version)
diff --git a/tools/utils.py b/tools/utils.py
index 2b77ed5..86d7e8d 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -55,6 +55,7 @@
GRADLE_TASK_ALL_TESTS_WITH_APPLY_MAPPING_JAR = ':test:rewriteTestsForR8LibWithRelocatedDeps'
GRADLE_TASK_TESTBASE_WITH_APPLY_MAPPING_JAR = ':test:rewriteTestBaseForR8LibWithRelocatedDeps'
GRADLE_TASK_TEST_DEPS_JAR = ':test:packageTestDeps'
+GRADLE_TASK_TEST_BASE_JAR = ':test:relocateTestBaseForR8LibWithRelocatedDeps'
GRADLE_TASK_TEST_JAR = ':test:relocateTestsForR8LibWithRelocatedDeps'
GRADLE_TASK_TEST_UNZIP_TESTBASE = ':test:unzipTestBase'