mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-05 17:46:24 +00:00
Add snippet to ensure baseline.profm file is sorted
Thanks to obfusk, see https://issuetracker.google.com/issues/231837768 and #6486
This commit is contained in:
parent
f2af168986
commit
a69f74f51b
@ -1,3 +1,7 @@
|
|||||||
|
import com.android.tools.profgen.ArtProfileKt
|
||||||
|
import com.android.tools.profgen.ArtProfileSerializer
|
||||||
|
import com.android.tools.profgen.DexFile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "com.android.application"
|
id "com.android.application"
|
||||||
id "kotlin-android"
|
id "kotlin-android"
|
||||||
@ -308,3 +312,24 @@ static String getGitWorkingBranch() {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project.afterEvaluate {
|
||||||
|
tasks.compileReleaseArtProfile.doLast {
|
||||||
|
outputs.files.each { file ->
|
||||||
|
if (file.toString().endsWith(".profm")) {
|
||||||
|
println("Sorting ${file} ...")
|
||||||
|
def version = ArtProfileSerializer.valueOf("METADATA_0_0_2")
|
||||||
|
def profile = ArtProfileKt.ArtProfile(file)
|
||||||
|
def keys = new ArrayList(profile.profileData.keySet())
|
||||||
|
def sortedData = new LinkedHashMap()
|
||||||
|
Collections.sort keys, new DexFile.Companion()
|
||||||
|
keys.each { key -> sortedData[key] = profile.profileData[key] }
|
||||||
|
new FileOutputStream(file).with {
|
||||||
|
write(version.magicBytes$profgen)
|
||||||
|
write(version.versionBytes$profgen)
|
||||||
|
version.write$profgen(it, sortedData, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user