Use dex-method-list:3.0 from maven central
Update changed API usages and reformat code according to code style.
This commit is contained in:
@@ -55,7 +55,6 @@ repositories {
|
||||
extra["buildSrcKotlinRepo"]?.let {
|
||||
maven(url = it)
|
||||
}
|
||||
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev") // for dex-method-list
|
||||
maven(url = "https://repo.gradle.org/gradle/libs-releases-local") // for native-platform
|
||||
jcenter()
|
||||
}
|
||||
@@ -64,7 +63,7 @@ dependencies {
|
||||
compile("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
|
||||
compile("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
|
||||
compile("net.rubygrapefruit:native-platform-windows-i386:${property("versions.native-platform")}")
|
||||
compile("com.jakewharton.dex:dex-method-list:2.0.0-alpha")
|
||||
compile("com.jakewharton.dex:dex-method-list:3.0.0")
|
||||
// TODO: adding the dep to the plugin breaks the build unexpectedly, resolve and uncomment
|
||||
// compile("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["bootstrap_kotlin_version"]}")
|
||||
// Shadow plugin is used in many projects of the main build. Once it's no longer used in buildSrc, please move this dependency to the root project
|
||||
|
||||
@@ -23,11 +23,11 @@ import java.io.File
|
||||
open class DexMethodCount : DefaultTask() {
|
||||
|
||||
data class Counts(
|
||||
val total: Int,
|
||||
val totalOwnPackages: Int?,
|
||||
val totalOtherPackages: Int?,
|
||||
val byPackage: Map<String, Int>,
|
||||
val byClass: Map<String, Int>
|
||||
val total: Int,
|
||||
val totalOwnPackages: Int?,
|
||||
val totalOtherPackages: Int?,
|
||||
val byPackage: Map<String, Int>,
|
||||
val byClass: Map<String, Int>
|
||||
)
|
||||
|
||||
@InputFile
|
||||
@@ -58,7 +58,7 @@ open class DexMethodCount : DefaultTask() {
|
||||
|
||||
@TaskAction
|
||||
fun invoke() {
|
||||
val methods = DexMethods.list(jarFile)
|
||||
val methods = dexMethods(jarFile)
|
||||
|
||||
val counts = methods.getCounts().also { this.counts = it }
|
||||
|
||||
@@ -73,16 +73,18 @@ open class DexMethodCount : DefaultTask() {
|
||||
|
||||
val ownPackages = ownPackages?.map { it + '.' }
|
||||
val byOwnPackages = if (ownPackages != null) {
|
||||
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) }}.let {
|
||||
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
|
||||
it.first.size to it.second.size
|
||||
}
|
||||
} else (null to null)
|
||||
|
||||
return Counts(total = this.size,
|
||||
totalOwnPackages = byOwnPackages.first,
|
||||
totalOtherPackages = byOwnPackages.second,
|
||||
byPackage = byPackage,
|
||||
byClass = byClass)
|
||||
return Counts(
|
||||
total = this.size,
|
||||
totalOwnPackages = byOwnPackages.first,
|
||||
totalOtherPackages = byOwnPackages.second,
|
||||
byPackage = byPackage,
|
||||
byClass = byClass
|
||||
)
|
||||
}
|
||||
|
||||
private fun printTotals(counts: Counts) {
|
||||
|
||||
Reference in New Issue
Block a user