mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Removed deprecated versionCodeOverride and versionNameOverride uses from custom application
This commit is contained in:
parent
fd26fd370b
commit
defedb495a
@ -82,13 +82,13 @@ class Transaction(
|
||||
FileContent("application/octet-stream", file)
|
||||
).execute().prettyPrint()
|
||||
|
||||
fun attachExpansionTo(expansionCode: Int, versionCode: Int): ExpansionFile =
|
||||
fun attachExpansionTo(versionCode: Int): ExpansionFile =
|
||||
publisher.edits().expansionfiles().update(
|
||||
packageName,
|
||||
editId,
|
||||
versionCode,
|
||||
"main",
|
||||
ExpansionFile().apply { referencesVersion = expansionCode }
|
||||
ExpansionFile().apply { referencesVersion = versionCode }
|
||||
).execute().prettyPrint()
|
||||
|
||||
fun uploadBundle(outputFile: File) {
|
||||
@ -99,12 +99,12 @@ class Transaction(
|
||||
).execute().prettyPrint()
|
||||
}
|
||||
|
||||
fun addToTrackInDraft(apkVariants: List<VariantOutput>): Track =
|
||||
fun addToTrackInDraft(versionCode: Int, versionName: String?): Track =
|
||||
publisher.edits().tracks().update(packageName, editId, "alpha", Track().apply {
|
||||
releases = listOf(TrackRelease().apply {
|
||||
status = "draft"
|
||||
name = apkVariants[0].versionName.toString()
|
||||
versionCodes = apkVariants.map { it.versionCode.orNull?.toLong() ?: 0 }
|
||||
name = versionName
|
||||
versionCodes = listOf(versionCode.toLong())
|
||||
})
|
||||
track = "alpha"
|
||||
}).execute().prettyPrint()
|
||||
|
@ -75,19 +75,20 @@ fun ProductFlavor.createPublishBundleWithExpansionTask(
|
||||
println("packageName $packageName")
|
||||
createPublisher(File(rootDir, "playstore.json"))
|
||||
.transactionWithCommit(packageName) {
|
||||
val versionCode = (7 * 1_000_000) + versionCode!!
|
||||
val variants =
|
||||
applicationVariants.releaseVariantsFor(this@createPublishBundleWithExpansionTask)
|
||||
val generatedBundleFile =
|
||||
File(
|
||||
"$buildDir/outputs/bundle/${capitalizedName.toLowerCase()}Release" +
|
||||
"/custom-/${capitalizedName.toLowerCase()}-/release.aab"
|
||||
"$buildDir/outputs/bundle/${capitalizedName.toLowerCase()}" +
|
||||
"Release/custom-${capitalizedName.toLowerCase()}-release.aab"
|
||||
)
|
||||
if (generatedBundleFile.exists()) {
|
||||
uploadBundle(generatedBundleFile)
|
||||
uploadExpansionTo(file, versionCode)
|
||||
attachExpansionTo(versionCode, versionCode)
|
||||
// addToTrackInDraft(versionCode)
|
||||
uploadExpansionTo(file, variants[0].versionCode)
|
||||
attachExpansionTo(variants[0].versionCode)
|
||||
addToTrackInDraft(variants[0].versionCode, versionName)
|
||||
} else {
|
||||
throw FileNotFoundException("Unable to generate aab file")
|
||||
throw FileNotFoundException("Unable to find generated aab file")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,7 +97,8 @@ fun ProductFlavor.createPublishBundleWithExpansionTask(
|
||||
|
||||
fun DomainObjectSet<ApplicationVariant>.releaseVariantsFor(productFlavor: ProductFlavor) =
|
||||
find { it.name.equals("${productFlavor.name}Release", true) }!!
|
||||
.outputs.filterIsInstance<ApkVariantOutput>().sortedBy { it.versionCodeOverride }
|
||||
.outputs.filterIsInstance<ApkVariantOutput>()
|
||||
.filter { it.baseName.contains("universal") }.sortedBy { it.versionCode }
|
||||
|
||||
afterEvaluate {
|
||||
tasks.filter { it.name.contains("ReleaseBundleWithExpansionFile") }.forEach {
|
||||
|
Loading…
x
Reference in New Issue
Block a user