Description: Replaces proguard with jarjar to assemble the kotlin-reflect jar.
 Proguard 6 is unable to parse the classes of OpenJDK 17, and it looks like
 Kotlin classes are evicted even if minimization is disabled, which breaks the build.
 To be retried with Proguard 7.
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
Last-Update: 2023-01-31

--- a/libraries/reflect/build.gradle
+++ b/libraries/reflect/build.gradle
@@ -152,17 +152,16 @@
 
 ext.proguardOutput = "$libsDir/${property("archivesBaseName")}-proguard.jar"
 
-task("proguard",type:ProGuardTask) {
+task("proguard") {
     dependsOn(stripMetadata)
-    configuration "$core/reflection.jvm/reflection.pro"
-    inputs.files(stripMetadata.outputs.files)
-    outputs.file(proguardOutput)
 
-    injars(stripMetadata.outputs.files,filter:"!META-INF/versions/**")
-    injars(project.configurations.proguardAdditionalInJars,filter:"!META-INF/**")
-    outjars(proguardOutput)
-
-    libraryjars(filter:"!META-INF/versions/**", project.configurations.proguardDeps)
+    doLast {
+        ant.taskdef(name: 'jarjar', classname: 'com.tonicsystems.jarjar.JarJarTask', classpath: '/usr/share/java/jarjar.jar')
+        ant.jarjar(destfile: proguardOutput) {
+            zipfileset(src: 'build/libs/kotlin-reflect-stripped.jar', excludes: '**/META-INF/versions/**')
+            zipfileset(src: '../../libraries/tools/kotlin-annotations-jvm/build/libs/kotlin-annotations-jvm-1.3.31.jar', excludes: '**/META-INF/**')
+        }
+    }
 }
 
 task("relocateCoreSources", type: Copy) {
