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 {
|
extra["buildSrcKotlinRepo"]?.let {
|
||||||
maven(url = it)
|
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
|
maven(url = "https://repo.gradle.org/gradle/libs-releases-local") // for native-platform
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
@@ -64,7 +63,7 @@ dependencies {
|
|||||||
compile("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
|
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-amd64:${property("versions.native-platform")}")
|
||||||
compile("net.rubygrapefruit:native-platform-windows-i386:${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
|
// 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"]}")
|
// 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
|
// 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() {
|
open class DexMethodCount : DefaultTask() {
|
||||||
|
|
||||||
data class Counts(
|
data class Counts(
|
||||||
val total: Int,
|
val total: Int,
|
||||||
val totalOwnPackages: Int?,
|
val totalOwnPackages: Int?,
|
||||||
val totalOtherPackages: Int?,
|
val totalOtherPackages: Int?,
|
||||||
val byPackage: Map<String, Int>,
|
val byPackage: Map<String, Int>,
|
||||||
val byClass: Map<String, Int>
|
val byClass: Map<String, Int>
|
||||||
)
|
)
|
||||||
|
|
||||||
@InputFile
|
@InputFile
|
||||||
@@ -58,7 +58,7 @@ open class DexMethodCount : DefaultTask() {
|
|||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
fun invoke() {
|
fun invoke() {
|
||||||
val methods = DexMethods.list(jarFile)
|
val methods = dexMethods(jarFile)
|
||||||
|
|
||||||
val counts = methods.getCounts().also { this.counts = it }
|
val counts = methods.getCounts().also { this.counts = it }
|
||||||
|
|
||||||
@@ -73,16 +73,18 @@ open class DexMethodCount : DefaultTask() {
|
|||||||
|
|
||||||
val ownPackages = ownPackages?.map { it + '.' }
|
val ownPackages = ownPackages?.map { it + '.' }
|
||||||
val byOwnPackages = if (ownPackages != null) {
|
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
|
it.first.size to it.second.size
|
||||||
}
|
}
|
||||||
} else (null to null)
|
} else (null to null)
|
||||||
|
|
||||||
return Counts(total = this.size,
|
return Counts(
|
||||||
totalOwnPackages = byOwnPackages.first,
|
total = this.size,
|
||||||
totalOtherPackages = byOwnPackages.second,
|
totalOwnPackages = byOwnPackages.first,
|
||||||
byPackage = byPackage,
|
totalOtherPackages = byOwnPackages.second,
|
||||||
byClass = byClass)
|
byPackage = byPackage,
|
||||||
|
byClass = byClass
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun printTotals(counts: Counts) {
|
private fun printTotals(counts: Counts) {
|
||||||
|
|||||||
Reference in New Issue
Block a user