Skip to content

Commit

Permalink
Apply spotless formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JorenHannes committed Jan 19, 2024
1 parent 559c7ac commit 54358bf
Show file tree
Hide file tree
Showing 156 changed files with 3,814 additions and 3,935 deletions.
159 changes: 81 additions & 78 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,97 +1,100 @@
plugins {
id 'distribution'
id 'java-library'
id 'java-test-fixtures'
id "org.jetbrains.kotlin.jvm"
id 'maven-publish'
id 'signing'
id 'com.adarshr.test-logger'
id 'jacoco'
id "org.sonarqube"
id 'distribution'
id 'java-library'
id 'java-test-fixtures'
id "org.jetbrains.kotlin.jvm"
id 'maven-publish'
id 'signing'
id 'com.adarshr.test-logger'
id 'jacoco'
id "org.sonarqube"
}

dependencies {
api project(":proguard-core")
implementation 'com.android.tools:r8:3.3.75'
api project(":proguard-core")
implementation 'com.android.tools:r8:3.3.75'

testImplementation(testFixtures(project(":proguard-core")))
testFixturesImplementation(testFixtures(project(":proguard-core")))
testImplementation(testFixtures(project(":proguard-core")))
testFixturesImplementation(testFixtures(project(":proguard-core")))

testImplementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.6.2' // for kotest framework
testImplementation 'io.kotest:kotest-assertions-core-jvm:5.6.2' // for kotest core jvm assertions
testImplementation 'io.kotest:kotest-property-jvm:5.6.2' // for kotest property test
testImplementation 'io.kotest:kotest-framework-datatest:5.6.2'
testImplementation 'io.mockk:mockk:1.13.5' // for mocking
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3' // for junit framework
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3' // for junit framework
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.6.2' // for kotest framework
testImplementation 'io.kotest:kotest-assertions-core-jvm:5.6.2' // for kotest core jvm assertions
testImplementation 'io.kotest:kotest-property-jvm:5.6.2' // for kotest property test
testImplementation 'io.kotest:kotest-framework-datatest:5.6.2'
testImplementation 'io.mockk:mockk:1.13.5' // for mocking
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3' // for junit framework
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3' // for junit framework

testFixturesImplementation 'org.smali:smali:2.5.2'
testFixturesImplementation 'org.smali:smali:2.5.2'
}

test {
useJUnitPlatform()
useJUnitPlatform()
}

publishing {
publications {
maven(MavenPublication) {
artifactId = 'proguard-core-android'
from components.java
pom {
name = 'ProGuardCORE'
description = 'ProGuardCORE is a free library to read, analyze, modify, and write Java class files.'
url = 'https://guardsquare.github.io/proguard-core'
developers {
developer {
id = 'lafortune'
name = 'Eric Lafortune'
organization = 'Guardsquare'
organizationUrl = 'https://www.guardsquare.com/'
roles = ['Project Administrator', 'Developer']
}
}
licenses {
license {
name = 'Apache License Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
issueManagement {
system = 'Github Tracker'
url = 'https://github.com/Guardsquare/proguard-core/issues'
}
scm {
url = 'https://github.com/Guardsquare/proguard-core.git'
connection = 'scm:git:https://github.com/Guardsquare/proguard-core.git'
}
properties = [
'project.build.sourceEncoding': 'UTF-8'
]
}
repositories {
maven {
name = 'Github'
url = uri('https://maven.pkg.github.com/guardsquare/proguard-core')
credentials {
username = project.findProperty('PROGUARD_GITHUB_USERNAME')
password = project.findProperty('PROGUARD_GITHUB_TOKEN')
}
}
}
}
}
publications {
maven(MavenPublication) {
artifactId = 'proguard-core-android'
from components.java
pom {
name = 'ProGuardCORE'
description = 'ProGuardCORE is a free library to read, analyze, modify, and write Java class files.'
url = 'https://guardsquare.github.io/proguard-core'
developers {
developer {
id = 'lafortune'
name = 'Eric Lafortune'
organization = 'Guardsquare'
organizationUrl = 'https://www.guardsquare.com/'
roles = [
'Project Administrator',
'Developer'
]
}
}
licenses {
license {
name = 'Apache License Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
issueManagement {
system = 'Github Tracker'
url = 'https://github.com/Guardsquare/proguard-core/issues'
}
scm {
url = 'https://github.com/Guardsquare/proguard-core.git'
connection = 'scm:git:https://github.com/Guardsquare/proguard-core.git'
}
properties = [
'project.build.sourceEncoding': 'UTF-8'
]
}
repositories {
maven {
name = 'Github'
url = uri('https://maven.pkg.github.com/guardsquare/proguard-core')
credentials {
username = project.findProperty('PROGUARD_GITHUB_USERNAME')
password = project.findProperty('PROGUARD_GITHUB_TOKEN')
}
}
}
}
}
}

// We use in-memory ascii-armored keys
// See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
if (hasProperty('PROGUARD_SIGNING_KEY')) {
signing {
String key = findProperty('PROGUARD_SIGNING_KEY')
String password = findProperty('PROGUARD_SIGNING_PASSWORD')
useInMemoryPgpKeys(key, password)
sign publishing.publications
}
signing {
String key = findProperty('PROGUARD_SIGNING_KEY')
String password = findProperty('PROGUARD_SIGNING_PASSWORD')
useInMemoryPgpKeys(key, password)
sign publishing.publications
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ArrayIndexOutOfBoundsOnTypeTest : FreeSpec({
"Array index out of bounds on type test" - {
val smali = getSmaliResource("bb-5-ArrayIndexOutOfBoundsOnType.smali")
val (programClassPool, _) = ClassPoolBuilder.fromSmali(
SmaliSource(smali.name, smali.readText())
SmaliSource(smali.name, smali.readText()),
)
val testClass = programClassPool.getClass("i")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class BasicTranslationTest : FreeSpec({

return-void
.end method
""".trimIndent()
)
""".trimIndent(),
),
)

val helloWorldClass = programClassPool.getClass("HelloWorld")
Expand Down
7 changes: 4 additions & 3 deletions android/src/test/kotlin/proguard/dexfile/CannotMergeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CannotMergeTest : FreeSpec({
"Can not merge z and i test" - {
val smali = getSmaliResource("MultiSelectListPreference.smali")
val (programClassPool, _) = ClassPoolBuilder.fromSmali(
SmaliSource(smali.name, smali.readText())
SmaliSource(smali.name, smali.readText()),
)
val testClass = programClassPool.getClass("android/preference/MultiSelectListPreference")
val testMethod = testClass.findMethod("test", "(Ljava/util/Set;Ljava/lang/Object;)V")
Expand All @@ -39,8 +39,9 @@ class CannotMergeTest : FreeSpec({
aload(2)
invokeinterface("java/util/Set", "add", "(Ljava/lang/Object;)Z")
invokestatic(
"android/preference/MultiSelectListPreference", "access$076",
"(Landroid/preference/MultiSelectListPreference;I)Z"
"android/preference/MultiSelectListPreference",
"access$076",
"(Landroid/preference/MultiSelectListPreference;I)Z",
)
pop()
return_()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class EmptyTryCatchWithGotoHeadTest : FreeSpec({
"Empty Try Catch With Goto Head test" - {
val smali = getSmaliResource("empty-try-catch-with-goto-head.smali")
val (programClassPool, libraryClassPool) = ClassPoolBuilder.fromSmali(
SmaliSource(smali.name, smali.readText())
SmaliSource(smali.name, smali.readText()),
)
val testClass = programClassPool.getClass("etcwgh")
val testMethod = testClass.findMethod("aaa", "(F)V")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class GoToFirstLabelTest : FreeSpec({
val (programClassPool, _) = ClassPoolBuilder.fromSmali(
SmaliSource(
smali.name,
smali.readText()
)
smali.readText(),
),
)
val testClass = programClassPool.getClass("xgoto/first/label")
val methodAssertSlept = testClass.findMethod("assertSlept", "()V")
Expand Down
6 changes: 3 additions & 3 deletions android/src/test/kotlin/proguard/dexfile/IntOrBooleanTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class IntOrBooleanTest : FreeSpec({
val (programClassPool, _) = ClassPoolBuilder.fromSmali(
SmaliSource(
smali.name,
smali.readText()
)
smali.readText(),
),
)

val testClass = programClassPool.getClass("i/or/Z")
val testMethod = testClass.findMethod(
"access\$376",
"(Lcom/google/android/finsky/widget/consumption/NowPlayingWidgetProvider\$ViewTreeWrapper;I)Z"
"(Lcom/google/android/finsky/widget/consumption/NowPlayingWidgetProvider\$ViewTreeWrapper;I)Z",
)

"Check if classPool is not null" {
Expand Down
4 changes: 2 additions & 2 deletions android/src/test/kotlin/proguard/dexfile/MLTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class MLTest : FreeSpec({
val (programClassPool, libraryClassPool) = ClassPoolBuilder.fromSmali(
SmaliSource(
smali.name,
smali.readText()
)
smali.readText(),
),
)

val testClass = programClassPool.getClass("ML")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class NegativeArraySizeTest : FreeSpec({
val (programClassPool, _) = ClassPoolBuilder.fromSmali(
SmaliSource(
smali.name,
smali.readText()
)
smali.readText(),
),
)
val testClass = programClassPool.getClass("i")
val testMethod = testClass.findMethod("getFileLength", "()I")
Expand Down
4 changes: 2 additions & 2 deletions android/src/test/kotlin/proguard/dexfile/OptLockTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class OptLockTest : FreeSpec({
val (programClassPool, _) = ClassPoolBuilder.fromSmali(
SmaliSource(
smali.name,
smali.readText()
)
smali.readText(),
),
)

val testClass = programClassPool.getClass("opt/lock")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class TestLambdaNameStartingWithHyphen : FreeSpec({
"""
.class public final L-${'$'}${'$'}Lambda${'$'}RetrofitProvider${'$'}7UGyImjn5OERU8TG-W_Zn0fdFtY;
.super Ljava/lang/Object;
""".trimIndent()
)
""".trimIndent(),
),
)

"Then the lambda class name should not be altered and still have the hyphens in the name" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class TestMonitorConstantInlining : FreeSpec({
val (pcp, _) = ClassPoolBuilder.fromSmali(
SmaliSource(
smali.name,
smali.readText()
)
smali.readText(),
),
)

"Then the resulting classpool should not be null" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class TestTranslationDeterminism : FreeSpec({

return-void
.end method
""".trimIndent()
)
""".trimIndent(),
),
)
val testClass = pcp.getClass("TestTypeTransformerMergeIZArray")
val methodFoo = testClass.findMethod("foo", "()Z")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class TestTypeTransformerMergeIZArray : FreeSpec({

return-void
.end method
""".trimIndent()
)
""".trimIndent(),
),
)
val testClass = pcp.getClass("TestTypeTransformerMergeIZArray")
val methodFoo = testClass.findMethod("foo", "()Z")
Expand Down
4 changes: 2 additions & 2 deletions android/src/test/kotlin/proguard/dexfile/WriteStringTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class WriteStringTest : FreeSpec({
val (programClassPool, _) = ClassPoolBuilder.fromSmali(
SmaliSource(
smali.name,
smali.readText()
)
smali.readText(),
),
)
val testClass = programClassPool.getClass("DD")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ fun ClassPoolBuilder.Companion.fromSmali(smali: SmaliSource): ClassPools {
"classes*.dex",
DexClassReader(
true,
classPoolFiller
classPoolFiller,
),
dataEntryReader
dataEntryReader,
)

NameFilteredDataEntryReader(
"**.smali",
Smali2DexReader(dexReader),
dexReader
dexReader,
)
}
file.deleteOnExit()
Expand Down
Loading

0 comments on commit 54358bf

Please sign in to comment.