mirror of
https://github.com/Guardsquare/proguard.git
synced 2026-03-13 09:50:34 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
869ce156b1 | ||
|
|
124b33e473 | ||
|
|
b8a62c8ca8 | ||
|
|
886477806c | ||
|
|
7fc907d1fb | ||
|
|
b10346ba32 | ||
|
|
f2ced20be4 | ||
|
|
35ea6d587f | ||
|
|
eea0ccbe8f | ||
|
|
bee74a9963 | ||
|
|
4b4aa93335 | ||
|
|
4781f5898f | ||
|
|
1f9a4a1b94 | ||
|
|
40f9222bc3 |
22
.github/workflows/continuous_integration.yml
vendored
22
.github/workflows/continuous_integration.yml
vendored
@@ -15,19 +15,21 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: proguard-main
|
||||
- uses: actions/setup-java@v1
|
||||
fetch-depth: 0
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 8
|
||||
- uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
build-root-directory: proguard-main/
|
||||
wrapper-directory: proguard-main/
|
||||
arguments: test :base:testAllJavaVersions :base:jacocoTestReport jar --info
|
||||
- name: Setup gradle
|
||||
uses: gradle/actions/setup-gradle@017a9effdb900e5b5b2fddfb590a105619dca3c3 # version 4.4.2
|
||||
- name: Test
|
||||
run: ./gradlew test :base:testAllJavaVersions :base:jacocoTestReport jar --info
|
||||
- name: Publish Test Report
|
||||
uses: mikepenz/action-junit-report@v3
|
||||
if: always() # always run even if the previous step fails
|
||||
uses: mikepenz/action-junit-report@3585e9575db828022551b4231f165eb59a0e74e3 # version 5.6.2
|
||||
if: success() || failure() # always run even if the previous step fails
|
||||
with:
|
||||
report_paths: '**/build/test-results/test/TEST-*.xml'
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ local.properties
|
||||
/lib/
|
||||
docs/html
|
||||
.kotlin
|
||||
.DS_Store
|
||||
|
||||
@@ -108,7 +108,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.guardsquare:proguard-gradle:7.7.0'
|
||||
classpath 'com.guardsquare:proguard-gradle:7.8.0'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -78,7 +78,8 @@ implements MemberVisitor
|
||||
String descriptor = member.getDescriptor(clazz);
|
||||
|
||||
// Check whether we're allowed to do aggressive overloading
|
||||
if (!allowAggressiveOverloading)
|
||||
// Annotations are always excluded from aggressive overloading due to JVM limitations
|
||||
if (!allowAggressiveOverloading || clazz.extendsOrImplements(ClassConstants.NAME_JAVA_LANG_ANNOTATION_ANNOTATION))
|
||||
{
|
||||
// Trim the return argument from the descriptor if not.
|
||||
// Works for fields and methods alike.
|
||||
|
||||
@@ -109,7 +109,8 @@ public class MemberNameConflictFixer implements MemberVisitor
|
||||
String descriptor = member.getDescriptor(clazz);
|
||||
|
||||
// Check whether we're allowed to overload aggressively.
|
||||
if (!allowAggressiveOverloading)
|
||||
// Annotations are always excluded from aggressive overloading due to JVM limitations
|
||||
if (!allowAggressiveOverloading || clazz.extendsOrImplements(ClassConstants.NAME_JAVA_LANG_ANNOTATION_ANNOTATION))
|
||||
{
|
||||
// Trim the return argument from the descriptor if not.
|
||||
// Works for fields and methods alike.
|
||||
|
||||
@@ -81,7 +81,8 @@ implements MemberVisitor
|
||||
String descriptor = member.getDescriptor(clazz);
|
||||
|
||||
// Check whether we're allowed to overload aggressively.
|
||||
if (!allowAggressiveOverloading)
|
||||
// Annotations are always excluded from aggressive overloading due to JVM limitations
|
||||
if (!allowAggressiveOverloading || clazz.extendsOrImplements(ClassConstants.NAME_JAVA_LANG_ANNOTATION_ANNOTATION))
|
||||
{
|
||||
// Trim the return argument from the descriptor if not.
|
||||
// Works for fields and methods alike.
|
||||
|
||||
@@ -1886,6 +1886,7 @@ implements ClassVisitor,
|
||||
markAsUsed(kotlinPropertyMetadata.receiverType);
|
||||
markAsUsed(kotlinPropertyMetadata.typeParameters);
|
||||
markAsUsed(kotlinPropertyMetadata.setterParameters);
|
||||
markAsUsed(kotlinPropertyMetadata.setterParameter);
|
||||
markAsUsed(kotlinPropertyMetadata.type);
|
||||
|
||||
if (kotlinPropertyMetadata.flags.hasAnnotations &&
|
||||
@@ -2068,7 +2069,10 @@ implements ClassVisitor,
|
||||
else if (kotlinTypeMetadata.aliasName != null && !isUsed(kotlinTypeMetadata.referencedTypeAlias))
|
||||
{
|
||||
markAsUsed(kotlinTypeMetadata.referencedTypeAlias);
|
||||
kotlinTypeMetadata.referencedTypeAlias.accept(null, null, this);
|
||||
kotlinTypeMetadata.referencedTypeAlias.accept(
|
||||
kotlinTypeMetadata.referencedTypeAlias.referencedDeclarationContainer.ownerReferencedClass,
|
||||
kotlinTypeMetadata.referencedTypeAlias.referencedDeclarationContainer,
|
||||
this);
|
||||
}
|
||||
|
||||
markAsUsed(kotlinTypeMetadata.typeArguments);
|
||||
|
||||
@@ -192,6 +192,7 @@ implements KotlinMetadataVisitor,
|
||||
kotlinPropertyMetadata.setterSignature = null;
|
||||
kotlinPropertyMetadata.referencedSetterMethod = null;
|
||||
kotlinPropertyMetadata.flags.isVar = false;
|
||||
kotlinPropertyMetadata.setterParameter = null;
|
||||
kotlinPropertyMetadata.setterParameters.clear();
|
||||
}
|
||||
|
||||
|
||||
47
base/src/test/kotlin/proguard/obfuscate/AnnotationTest.kt
Normal file
47
base/src/test/kotlin/proguard/obfuscate/AnnotationTest.kt
Normal file
@@ -0,0 +1,47 @@
|
||||
package proguard.obfuscate
|
||||
|
||||
import io.kotest.core.spec.style.FreeSpec
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
import proguard.classfile.ProgramClass
|
||||
import proguard.testutils.ClassPoolBuilder
|
||||
import proguard.testutils.JavaSource
|
||||
import java.util.HashMap
|
||||
|
||||
class AnnotationTest : FreeSpec({
|
||||
val (programClassPool, _) =
|
||||
ClassPoolBuilder.fromSource(
|
||||
JavaSource(
|
||||
"Test.java",
|
||||
"""
|
||||
public @interface Test {
|
||||
boolean testBoolean1() default false;
|
||||
boolean testBoolean2() default true;
|
||||
String testString1() default "";
|
||||
}
|
||||
""".trimIndent(),
|
||||
),
|
||||
)
|
||||
val testClass = programClassPool.getClass("Test") as ProgramClass
|
||||
|
||||
"Annotation members should be excluded from aggressive overloading" {
|
||||
val descriptorMap = HashMap<String, Map<String, String>>()
|
||||
|
||||
testClass.methodsAccept(
|
||||
MemberObfuscator(
|
||||
true,
|
||||
SimpleNameFactory(),
|
||||
descriptorMap,
|
||||
),
|
||||
)
|
||||
|
||||
descriptorMap shouldBeEqual
|
||||
mapOf(
|
||||
"()" to
|
||||
mapOf(
|
||||
"a" to "testBoolean1",
|
||||
"b" to "testBoolean2",
|
||||
"c" to "testString1",
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
@@ -14,6 +14,8 @@ import proguard.classfile.Clazz
|
||||
import proguard.classfile.Member
|
||||
import proguard.classfile.attribute.annotation.visitor.AllElementValueVisitor
|
||||
import proguard.classfile.attribute.visitor.AllAttributeVisitor
|
||||
import proguard.classfile.kotlin.KotlinTypeAliasMetadata
|
||||
import proguard.classfile.kotlin.visitor.AllTypeAliasVisitor
|
||||
import proguard.classfile.kotlin.visitor.ReferencedKotlinMetadataVisitor
|
||||
import proguard.classfile.util.EnumFieldReferenceInitializer
|
||||
import proguard.classfile.visitor.AllMethodVisitor
|
||||
@@ -266,4 +268,39 @@ class ClassUsageMarkerTest : StringSpec({
|
||||
val fooInterface = programClassPool.getClass("test/Interface").findMethod("foo", null)
|
||||
fooInterface should beMarkedWith(usageMarker)
|
||||
}
|
||||
|
||||
"Given Kotlin `typealias` declarations where one aliases another" {
|
||||
val (programClassPool, _) =
|
||||
ClassPoolBuilder.fromSource(
|
||||
KotlinSource(
|
||||
"KotlinTypeAlias.kt",
|
||||
"""
|
||||
typealias P = () -> Unit
|
||||
typealias A = P
|
||||
""".trimIndent(),
|
||||
),
|
||||
kotlincArguments = listOf("-language-version=1.9"),
|
||||
)
|
||||
|
||||
// Obtain the `typealias` declarations A and P
|
||||
val typeAliasList = mutableListOf<KotlinTypeAliasMetadata>()
|
||||
programClassPool.classesAccept(
|
||||
ReferencedKotlinMetadataVisitor(
|
||||
AllTypeAliasVisitor { _, _, kotlinTypeAliasMetadata ->
|
||||
typeAliasList.add(kotlinTypeAliasMetadata)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
// Ensure only `typealias` A and `typealias` P are present
|
||||
typeAliasList.map { it.name }.toSet() shouldBe setOf("A", "P")
|
||||
|
||||
// Both `typealias` A and `typealias` P should be marked as used by usageMarker.
|
||||
val usageMarker = SimpleUsageMarker()
|
||||
val classUsageMarker = ClassUsageMarker(usageMarker)
|
||||
programClassPool.classesAccept(classUsageMarker)
|
||||
typeAliasList.forEach {
|
||||
it should beMarkedWith(usageMarker)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -24,6 +24,7 @@ task buildDocumentation(type: Exec) {
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/")
|
||||
username = findProperty('PROGUARD_STAGING_USERNAME')
|
||||
password = findProperty('PROGUARD_STAGING_PASSWORD')
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Welcome to the manual for **ProGuard** version 7.7 ([what's new?](releasenotes.md)).
|
||||
Welcome to the manual for **ProGuard** version 7.8.0 ([what's new?](releasenotes.md)).
|
||||
|
||||
ProGuard is an open-sourced Java class file shrinker, optimizer, obfuscator, and
|
||||
preverifier. As a result, ProGuard processed applications and libraries are smaller and faster.
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
## Version 7.8
|
||||
|
||||
### Kotlin support
|
||||
|
||||
- Add support for Kotlin 2.2.
|
||||
|
||||
### Java support
|
||||
|
||||
- Add support for Java 25. (#481)
|
||||
|
||||
## Version 7.7
|
||||
|
||||
### Java support
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# AppSweep
|
||||
|
||||
[AppSweep](https://appsweep.guardsquare.com/) is a free online app security testing tool that allows you to find and fix security
|
||||
issues in your Android app's code and dependencies.
|
||||
|
||||
<center>
|
||||

|
||||
</center>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB |
@@ -51,7 +51,7 @@ The following options are supported:
|
||||
de-obfuscate more general types of input than just stack traces. A relatively
|
||||
simple expression like this works for basic stack trace formats:
|
||||
|
||||
(?:.*? at %c\.%m\(%s(?::%l)?\))|(?:(?:.*?[:"] +)?%c(?::.*)?)
|
||||
(?:.*? at %c\.%m\(%s(?::%l)?\))|(?:(?:.*?[:\"] +)?%c(?::.*)?)
|
||||
|
||||
It for instance matches the following lines:
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ nav:
|
||||
- Tools:
|
||||
- ReTrace: manual/tools/retrace.md
|
||||
- Playground: manual/tools/playground.md
|
||||
- AppSweep: manual/tools/appsweep.md
|
||||
- Troubleshooting:
|
||||
- Overview: manual/troubleshooting/troubleshooting.md
|
||||
- Limitations: manual/troubleshooting/limitations.md
|
||||
|
||||
@@ -7,7 +7,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.guardsquare:proguard-gradle:7.7.0'
|
||||
classpath 'com.guardsquare:proguard-gradle:7.8.0'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,16 +31,12 @@ test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = '1.8'
|
||||
kotlin {
|
||||
jvmToolchain(8)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass = 'AppKt'
|
||||
mainClass.set('com.example.AppKt')
|
||||
}
|
||||
|
||||
ext.baseCoordinates = "${project.name}-${project.version}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -7,7 +7,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.guardsquare:proguard-gradle:7.7.0'
|
||||
classpath 'com.guardsquare:proguard-gradle:7.8.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.guardsquare:proguard-gradle:7.7.0")
|
||||
classpath("com.guardsquare:proguard-gradle:7.8.0")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -7,7 +7,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.guardsquare:proguard-gradle:7.7.0'
|
||||
classpath 'com.guardsquare:proguard-gradle:7.8.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
proguardVersion = 7.7.0
|
||||
proguardVersion = 7.8.0
|
||||
|
||||
# The version of ProGuardCORE that sub-projects are built with
|
||||
proguardCoreVersion = 9.1.10
|
||||
proguardCoreVersion = 9.2.0
|
||||
gsonVersion = 2.11.0
|
||||
kotlinVersion = 2.1.0
|
||||
kotlinVersion = 2.2.0
|
||||
target = 1.8
|
||||
|
||||
# Optionally compile the WTK plugin.
|
||||
|
||||
@@ -5,7 +5,7 @@ pluginManagement {
|
||||
useVersion '8.1.1'
|
||||
}
|
||||
if (requested.id.id == 'io.github.gradle-nexus.publish-plugin') {
|
||||
useVersion '1.1.0'
|
||||
useVersion '2.0.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user