Skip to content

Commit

Permalink
Merge pull request #63 from usefulness/fix_signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski authored Apr 17, 2022
2 parents f2eebe6 + d7d74b9 commit c1e3e53
Show file tree
Hide file tree
Showing 5 changed files with 302,613 additions and 14 deletions.
2 changes: 1 addition & 1 deletion diffuse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def fatJarProvider = tasks.register('fatJar', Jar) { task ->
}

def r8File = new File("$buildDir/libs/$archivesBaseName-$version-r8.jar")
def rulesFile = project.file("src/main/rules.txt")
def rulesFile = project.file("src/main/rules.pro")
def r8JarProvider = tasks.register('r8Jar', JavaExec) { task ->
task.javaLauncher.set(javaToolchains.launcherFor { spec ->
spec.languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_11.majorVersion))
Expand Down
13 changes: 2 additions & 11 deletions diffuse/src/main/rules.txt → diffuse/src/main/rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,5 @@
-keepattributes Signature, InnerClasses, EnclosingMethod

# Annotations for reflection.
-keepattributes RuntimeVisible*Annotations

# Fields accessed reflectively which correspond to a binary format.
-keepclassmembers class com.android.apksig.internal.** {
@com.android.apksig.internal.asn1.Asn1Field <fields>;
}

# Default constructors invoked reflectively.
-keepclassmembers class com.android.apksig.internal.** {
<init>();
}
-keepattributes RuntimeVisible*Annotations,AnnotationDefault
-keep class com.android.apksig.internal.** { *; }
18 changes: 16 additions & 2 deletions diffuse/src/test/kotlin/com/jakewharton/diffuse/FunctionalTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,30 @@ class FunctionalTest {
internal fun `diffuse diff on aar`() {
val output = anotherTempDir.resolve("diffuse-out")
val aarA = loadResource("lazythreeten/lazythreetenbp-release.aar")
val aarB = loadResource("lazythreeten/lazythreetenbp-release.aar")

main(
"diff",
"--aar", aarA, aarB,
"--aar", aarA, aarA,
"--text", output.path,
)

assertThat(output.readLines()).contains(" total │ 160.7 KiB │ 160.7 KiB │ 0 B ")
}

@Test
internal fun `diffuse diff on signed artifact`() {
val output = anotherTempDir.resolve("diffuse-out")
val apkA = loadResource("otwarty-wykop-mobilny/app-release.apk")
val mappingA = loadResource("otwarty-wykop-mobilny/mapping.txt")

main(
"diff",
"--apk", apkA, apkA,
"--old-mapping", mappingA,
"--new-mapping", mappingA,
"--text", output.path,
)
}
}

private object Loader
Expand Down
Binary file not shown.
Loading

0 comments on commit c1e3e53

Please sign in to comment.