mirror of
https://github.com/jellyfin/jellyfin-android.git
synced 2024-12-02 19:06:42 +00:00
e2f358faf1
Add workaround for non reproducible baseline profiles in AGP
40 lines
1.3 KiB
Groovy
40 lines
1.3 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
google()
|
|
}
|
|
|
|
dependencies {
|
|
classpath libs.android.gradle
|
|
}
|
|
}
|
|
|
|
import com.android.tools.profgen.ArtProfileKt
|
|
import com.android.tools.profgen.ArtProfileSerializer
|
|
import com.android.tools.profgen.DexFile
|
|
|
|
/**
|
|
* This is a temporary workaround for https://issuetracker.google.com/issues/231837768
|
|
* which will be fixed in AGP 8.1.0, at which point the workaround may be deleted.
|
|
*/
|
|
project.afterEvaluate {
|
|
tasks.compileLibreReleaseArtProfile.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, "")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|