From c53ac2e91fa46d25eca2b32ec6c0b9806da53cad Mon Sep 17 00:00:00 2001 From: cristiangarcia Date: Mon, 15 Jan 2024 21:57:13 +0100 Subject: [PATCH] Update Proguard to 7.4.1 --- core/reflection.jvm/reflection.pro | 2 + gradle/libs.versions.toml | 4 +- gradle/verification-metadata.xml | 36 +- .../dependencies-maven.pro | 2 + libraries/tools/kotlin-main-kts/main-kts.pro | 2 + prepare/compiler/compiler.pro | 2 + .../backend-native-for-ide.pro | 1 + .../src/main/kotlin/CacheableProguradTask.kt | 359 +----------------- 8 files changed, 38 insertions(+), 370 deletions(-) diff --git a/core/reflection.jvm/reflection.pro b/core/reflection.jvm/reflection.pro index 31b8b12047d..fdd3b8319cc 100644 --- a/core/reflection.jvm/reflection.pro +++ b/core/reflection.jvm/reflection.pro @@ -3,6 +3,8 @@ -target 1.6 -dontoptimize -dontobfuscate +-dontprocesskotlinmetadata +-keep class kotlin.Metadata # -dontshrink -keep public class kotlin.reflect.* { *; } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 377c0dc9a86..a91d3b9f644 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ jdom2 = "2.0.6.1" kotlinx-serialization = "1.5.0" shadow = "8.1.1" # Should be in sync with version in kotlin-native/ spdx = "0.1.0-dev-10" -proguard = "6.2.2" +proguard = "7.4.1" ktor = "2.3.7" kotlinx-metadataJvm = "0.7.0" # Forcing gson version because of https://github.com/google/gson/pull/1991 @@ -38,7 +38,7 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa kotlinx-metadataJvm = { module = "org.jetbrains.kotlinx:kotlinx-metadata-jvm", version.ref = "kotlinx-metadataJvm" } shadow-gradlePlugin = { module = "com.github.johnrengelman:shadow", version.ref = "shadow" } spdx-gradlePlugin = { module = "org.spdx:spdx-gradle-plugin", version.ref = "spdx" } -proguard-gradlePlugin = { module = "net.sf.proguard:proguard-gradle", version.ref = "proguard" } +proguard-gradlePlugin = { module = "com.guardsquare:proguard-gradle", version.ref = "proguard" } ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 4435de3d522..8a36a97eb64 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -756,6 +756,12 @@ + + + + + + @@ -1014,6 +1020,24 @@ + + + + + + + + + + + + + + + + + + @@ -2434,18 +2458,6 @@ - - - - - - - - - - - - diff --git a/libraries/scripting/dependencies-maven-all/dependencies-maven.pro b/libraries/scripting/dependencies-maven-all/dependencies-maven.pro index 024e7deb1a5..64bbdfcafbf 100644 --- a/libraries/scripting/dependencies-maven-all/dependencies-maven.pro +++ b/libraries/scripting/dependencies-maven-all/dependencies-maven.pro @@ -1,6 +1,8 @@ -target 1.6 -dontoptimize -dontobfuscate +-dontprocesskotlinmetadata +-keep class kotlin.Metadata # -dontshrink -keepdirectories META-INF/** diff --git a/libraries/tools/kotlin-main-kts/main-kts.pro b/libraries/tools/kotlin-main-kts/main-kts.pro index 91a3a3feeee..431c03e905f 100644 --- a/libraries/tools/kotlin-main-kts/main-kts.pro +++ b/libraries/tools/kotlin-main-kts/main-kts.pro @@ -1,6 +1,8 @@ -target 1.8 -dontoptimize -dontobfuscate +-dontprocesskotlinmetadata +-keep class kotlin.Metadata # -dontshrink -keepdirectories META-INF/** diff --git a/prepare/compiler/compiler.pro b/prepare/compiler/compiler.pro index 6dd62adae0a..df76f324762 100644 --- a/prepare/compiler/compiler.pro +++ b/prepare/compiler/compiler.pro @@ -79,6 +79,8 @@ #-libraryjars '' #-libraryjars '' +-dontprocesskotlinmetadata +-keep class kotlin.Metadata -dontoptimize -dontobfuscate diff --git a/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/backend-native-for-ide.pro b/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/backend-native-for-ide.pro index 02b99e50eea..9169995ed7b 100644 --- a/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/backend-native-for-ide.pro +++ b/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/backend-native-for-ide.pro @@ -1,6 +1,7 @@ -target 11 -dontoptimize -dontobfuscate +-dontprocesskotlinmetadata -keep class kotlin.Metadata diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/CacheableProguradTask.kt b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/CacheableProguradTask.kt index 0c92276689d..1ea8da54f8f 100644 --- a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/CacheableProguradTask.kt +++ b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/CacheableProguradTask.kt @@ -3,7 +3,6 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -import groovy.lang.Closure import org.gradle.api.JavaVersion import org.gradle.api.file.FileCollection import org.gradle.api.provider.Property @@ -11,7 +10,6 @@ import org.gradle.api.provider.Provider import org.gradle.api.tasks.* import org.gradle.jvm.toolchain.JavaLauncher import org.gradle.kotlin.dsl.property -import proguard.ClassSpecification import java.io.File @CacheableTask @@ -30,360 +28,9 @@ open class CacheableProguardTask : proguard.gradle.ProGuardTask() { } @CompileClasspath - override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection() - .filter { libraryFile -> + override fun getLibraryJarFileCollection(): FileCollection { + return super.getLibraryJarFileCollection().filter { libraryFile -> jdkHomePath.orNull?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true } - - @InputFiles - @PathSensitive(PathSensitivity.RELATIVE) - override fun getConfigurationFileCollection(): FileCollection = super.getConfigurationFileCollection() - - @InputFiles - @Classpath - override fun getInJarFileCollection(): FileCollection = super.getInJarFileCollection() - - @Optional - @OutputFiles - override fun getOutJarFileCollection(): FileCollection = super.getOutJarFileCollection() - - @get:Optional - @get:OutputFile - internal val printConfigurationFile: File? - get() = configuration.printConfiguration?.takeIf { it.path.isNotEmpty() } - - @Input - override fun getOutJarFilters(): MutableList = super.getOutJarFilters() - - @Input - override fun getInJarFilters(): MutableList = super.getInJarFilters() - - @Input - override fun getLibraryJarFilters(): MutableList = super.getLibraryJarFilters() - - @Internal - override fun getOutJarFiles(): MutableList = super.getOutJarFiles() - - @Internal - override fun getInJarFiles(): MutableList = super.getInJarFiles() - - @Internal - override fun getInJarCounts(): MutableList = super.getInJarCounts() - - @Internal - override fun getLibraryJarFiles(): MutableList = super.getLibraryJarFiles() - - /* - * Inputs properly declared these methods so we don't override them - * - * configuration(configurationFiles: Any?) - * libraryjars(libraryJarFiles: Any?) - * libraryjars(filterArgs: MutableMap?, libraryJarFiles: Any?) - * injars(inJarFiles: Any?) - * injars(filterArgs: MutableMap?, inJarFiles: Any?) - * outjars(outJarFiles: Any?) - * outjars(filterArgs: MutableMap?, outJarFiles: Any?) - * printconfiguration() - * printconfiguration(printConfiguration: Any?) - */ - - override fun renamesourcefileattribute() = throw NotImplementedError() - - override fun renamesourcefileattribute(newSourceFileAttribute: String?) = throw NotImplementedError() - - override fun dontshrink() = throw NotImplementedError() - - override fun assumenosideeffects(classSpecificationString: String?) = throw NotImplementedError() - - override fun assumenosideeffects(classSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun keepnames(classSpecificationString: String?) = throw NotImplementedError() - - override fun keepnames(keepArgs: MutableMap?, classSpecificationString: String?) = throw NotImplementedError() - - override fun keepnames(keepClassSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun keepnames(keepClassSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun printmapping() = throw NotImplementedError() - - override fun printmapping(printMapping: Any?) = throw NotImplementedError() - - override fun keep(classSpecificationString: String?) = throw NotImplementedError() - - override fun keep(keepArgs: MutableMap?, classSpecificationString: String?) = throw NotImplementedError() - - override fun keep(keepClassSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun keep(keepClassSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun keepdirectories() = throw NotImplementedError() - - override fun keepdirectories(filter: String?) = throw NotImplementedError() - - override fun dontpreverify() = throw NotImplementedError() - - override fun dontnote() = throw NotImplementedError() - - override fun dontnote(filter: String?) = throw NotImplementedError() - - @Internal - override fun getrenamesourcefileattribute(): Any? = throw NotImplementedError() - - override fun useuniqueclassmembernames() = throw NotImplementedError() - - override fun overloadaggressively() = throw NotImplementedError() - - @Internal - override fun getprintusage(): Any? = throw NotImplementedError() - - @Internal - override fun getforceprocessing(): Any? = throw NotImplementedError() - - override fun whyareyoukeeping(classSpecificationString: String?) = throw NotImplementedError() - - override fun whyareyoukeeping(classSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun whyareyoukeeping(classSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun obfuscationdictionary(obfuscationDictionary: Any?) = throw NotImplementedError() - - override fun adaptclassstrings() = throw NotImplementedError() - - override fun adaptclassstrings(filter: String?) = throw NotImplementedError() - - override fun applymapping(applyMapping: Any?) = throw NotImplementedError() - - override fun mergeinterfacesaggressively() = throw NotImplementedError() - - @Internal - override fun getdontwarn(): Any? = throw NotImplementedError() - - override fun ignorewarnings() = throw NotImplementedError() - - @Internal - override fun getaddconfigurationdebugging(): Any? = throw NotImplementedError() - - override fun field(memberSpecificationArgs: MutableMap?) = throw NotImplementedError() - - @Internal - override fun getallowaccessmodification(): Any? = throw NotImplementedError() - - override fun constructor(memberSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun dontusemixedcaseclassnames() = throw NotImplementedError() - - @Internal - override fun getignorewarnings(): Any? = throw NotImplementedError() - - @Internal - override fun getkeepdirectories(): Any? = throw NotImplementedError() - - override fun classobfuscationdictionary(classObfuscationDictionary: Any?) = throw NotImplementedError() - - override fun verbose() = throw NotImplementedError() - - override fun optimizations(filter: String?) = throw NotImplementedError() - - @Internal - override fun getuseuniqueclassmembernames(): Any? = throw NotImplementedError() - - @Internal - override fun getmicroedition(): Any? = throw NotImplementedError() - - override fun assumenoescapingparameters(classSpecificationString: String?) = throw NotImplementedError() - - override fun assumenoescapingparameters(classSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - @Internal - override fun getandroid(): Any? = throw NotImplementedError() - - override fun keeppackagenames() = throw NotImplementedError() - - override fun keeppackagenames(filter: String?) = throw NotImplementedError() - - @Internal - override fun getoverloadaggressively(): Any? = throw NotImplementedError() - - override fun skipnonpubliclibraryclasses() = throw NotImplementedError() - - @Internal - override fun getdontusemixedcaseclassnames(): Any? = throw NotImplementedError() - - @Internal - override fun getdontnote(): Any? = throw NotImplementedError() - - override fun assumenoexternalreturnvalues(classSpecificationString: String?) = throw NotImplementedError() - - override fun assumenoexternalreturnvalues(classSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun target(targetClassVersion: String?) = throw NotImplementedError() - - override fun keepattributes() = throw NotImplementedError() - - override fun keepattributes(filter: String?) = throw NotImplementedError() - - override fun keepclassmembernames(classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclassmembernames(keepArgs: MutableMap?, classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclassmembernames(keepClassSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun keepclassmembernames(keepClassSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - @Internal - override fun getdontpreverify(): Any? = throw NotImplementedError() - - @Internal - override fun getverbose(): Any? = throw NotImplementedError() - - @Internal - override fun getskipnonpubliclibraryclasses(): Any? = throw NotImplementedError() - - @Internal - override fun getdontoptimize(): Any? = throw NotImplementedError() - - override fun keepclasseswithmembernames(classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclasseswithmembernames(keepArgs: MutableMap?, classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclasseswithmembernames(keepClassSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun keepclasseswithmembernames(keepClassSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun keepclasseswithmembers(classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclasseswithmembers(keepArgs: MutableMap?, classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclasseswithmembers(keepClassSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun keepclasseswithmembers(keepClassSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - @Internal - override fun getdump(): Any? = throw NotImplementedError() - - override fun printseeds() = throw NotImplementedError() - - override fun printseeds(printSeeds: Any?) = throw NotImplementedError() - - override fun dontoptimize() = throw NotImplementedError() - - override fun dontobfuscate() = throw NotImplementedError() - - override fun extendClassSpecifications( - classSpecifications: MutableList?, - classSpecification: ClassSpecification? - ): MutableList = throw NotImplementedError() - - override fun allowaccessmodification() = throw NotImplementedError() - - @Internal - override fun getdontobfuscate(): Any? = throw NotImplementedError() - - @Internal - override fun getprintmapping(): Any? = throw NotImplementedError() - - override fun flattenpackagehierarchy() = throw NotImplementedError() - - override fun flattenpackagehierarchy(flattenPackageHierarchy: String?) = throw NotImplementedError() - - override fun android() = throw NotImplementedError() - - override fun dump() = throw NotImplementedError() - - override fun dump(dump: Any?) = throw NotImplementedError() - - @Internal - override fun getdontshrink(): Any? = throw NotImplementedError() - - @Internal - override fun getkeepattributes(): Any? = throw NotImplementedError() - - override fun microedition() = throw NotImplementedError() - - override fun keepparameternames() = throw NotImplementedError() - - override fun addconfigurationdebugging() = throw NotImplementedError() - - override fun packageobfuscationdictionary(packageObfuscationDictionary: Any?) = throw NotImplementedError() - - @Internal - override fun getdontskipnonpubliclibraryclassmembers(): Any? = throw NotImplementedError() - - override fun dontskipnonpubliclibraryclassmembers() = throw NotImplementedError() - - @Internal - override fun getprintconfiguration(): Any? = throw NotImplementedError() - - override fun forceprocessing() = throw NotImplementedError() - - override fun keepclassmembers(classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclassmembers(keepArgs: MutableMap?, classSpecificationString: String?) = throw NotImplementedError() - - override fun keepclassmembers(keepClassSpecificationArgs: MutableMap?) = throw NotImplementedError() - - override fun keepclassmembers(keepClassSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - @Internal - override fun getmergeinterfacesaggressively(): Any? = throw NotImplementedError() - - @Internal - override fun getConfigurationFiles(): MutableList = throw NotImplementedError() - - @Internal - override fun getkeeppackagenames(): Any? = throw NotImplementedError() - - override fun assumevalues(classSpecificationString: String?) = throw NotImplementedError() - - override fun assumevalues(classSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun printusage() = throw NotImplementedError() - - override fun printusage(printUsage: Any?) = throw NotImplementedError() - - @Internal - override fun getprintseeds(): Any? = throw NotImplementedError() - - @Internal - override fun getadaptresourcefilenames(): Any? = throw NotImplementedError() - - override fun assumenoexternalsideeffects(classSpecificationString: String?) = throw NotImplementedError() - - override fun assumenoexternalsideeffects(classSpecificationArgs: MutableMap?, classMembersClosure: Closure<*>?) = throw NotImplementedError() - - override fun dontwarn() = throw NotImplementedError() - - override fun dontwarn(filter: String?) = throw NotImplementedError() - - @Internal - override fun getrepackageclasses(): Any? = throw NotImplementedError() - - @Internal - override fun getadaptresourcefilecontents(): Any? = throw NotImplementedError() - - @Internal - override fun getflattenpackagehierarchy(): Any? = throw NotImplementedError() - - override fun optimizationpasses(optimizationPasses: Int) = throw NotImplementedError() - - override fun adaptresourcefilenames() = throw NotImplementedError() - - override fun adaptresourcefilenames(filter: String?) = throw NotImplementedError() - - override fun method(memberSpecificationArgs: MutableMap?) = throw NotImplementedError() - - @Internal - override fun getadaptclassstrings(): Any? = throw NotImplementedError() - - override fun repackageclasses() = throw NotImplementedError() - - override fun repackageclasses(repackageClasses: String?) = throw NotImplementedError() - - @Internal - override fun getkeepparameternames(): Any? = throw NotImplementedError() - - override fun adaptresourcefilecontents() = throw NotImplementedError() - - override fun adaptresourcefilecontents(filter: String?) = throw NotImplementedError() + } }