mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -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)
|
FileContent("application/octet-stream", file)
|
||||||
).execute().prettyPrint()
|
).execute().prettyPrint()
|
||||||
|
|
||||||
fun attachExpansionTo(expansionCode: Int, versionCode: Int): ExpansionFile =
|
fun attachExpansionTo(versionCode: Int): ExpansionFile =
|
||||||
publisher.edits().expansionfiles().update(
|
publisher.edits().expansionfiles().update(
|
||||||
packageName,
|
packageName,
|
||||||
editId,
|
editId,
|
||||||
versionCode,
|
versionCode,
|
||||||
"main",
|
"main",
|
||||||
ExpansionFile().apply { referencesVersion = expansionCode }
|
ExpansionFile().apply { referencesVersion = versionCode }
|
||||||
).execute().prettyPrint()
|
).execute().prettyPrint()
|
||||||
|
|
||||||
fun uploadBundle(outputFile: File) {
|
fun uploadBundle(outputFile: File) {
|
||||||
@ -99,12 +99,12 @@ class Transaction(
|
|||||||
).execute().prettyPrint()
|
).execute().prettyPrint()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addToTrackInDraft(apkVariants: List<VariantOutput>): Track =
|
fun addToTrackInDraft(versionCode: Int, versionName: String?): Track =
|
||||||
publisher.edits().tracks().update(packageName, editId, "alpha", Track().apply {
|
publisher.edits().tracks().update(packageName, editId, "alpha", Track().apply {
|
||||||
releases = listOf(TrackRelease().apply {
|
releases = listOf(TrackRelease().apply {
|
||||||
status = "draft"
|
status = "draft"
|
||||||
name = apkVariants[0].versionName.toString()
|
name = versionName
|
||||||
versionCodes = apkVariants.map { it.versionCode.orNull?.toLong() ?: 0 }
|
versionCodes = listOf(versionCode.toLong())
|
||||||
})
|
})
|
||||||
track = "alpha"
|
track = "alpha"
|
||||||
}).execute().prettyPrint()
|
}).execute().prettyPrint()
|
||||||
|
@ -75,19 +75,20 @@ fun ProductFlavor.createPublishBundleWithExpansionTask(
|
|||||||
println("packageName $packageName")
|
println("packageName $packageName")
|
||||||
createPublisher(File(rootDir, "playstore.json"))
|
createPublisher(File(rootDir, "playstore.json"))
|
||||||
.transactionWithCommit(packageName) {
|
.transactionWithCommit(packageName) {
|
||||||
val versionCode = (7 * 1_000_000) + versionCode!!
|
val variants =
|
||||||
|
applicationVariants.releaseVariantsFor(this@createPublishBundleWithExpansionTask)
|
||||||
val generatedBundleFile =
|
val generatedBundleFile =
|
||||||
File(
|
File(
|
||||||
"$buildDir/outputs/bundle/${capitalizedName.toLowerCase()}Release" +
|
"$buildDir/outputs/bundle/${capitalizedName.toLowerCase()}" +
|
||||||
"/custom-/${capitalizedName.toLowerCase()}-/release.aab"
|
"Release/custom-${capitalizedName.toLowerCase()}-release.aab"
|
||||||
)
|
)
|
||||||
if (generatedBundleFile.exists()) {
|
if (generatedBundleFile.exists()) {
|
||||||
uploadBundle(generatedBundleFile)
|
uploadBundle(generatedBundleFile)
|
||||||
uploadExpansionTo(file, versionCode)
|
uploadExpansionTo(file, variants[0].versionCode)
|
||||||
attachExpansionTo(versionCode, versionCode)
|
attachExpansionTo(variants[0].versionCode)
|
||||||
// addToTrackInDraft(versionCode)
|
addToTrackInDraft(variants[0].versionCode, versionName)
|
||||||
} else {
|
} 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) =
|
fun DomainObjectSet<ApplicationVariant>.releaseVariantsFor(productFlavor: ProductFlavor) =
|
||||||
find { it.name.equals("${productFlavor.name}Release", true) }!!
|
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 {
|
afterEvaluate {
|
||||||
tasks.filter { it.name.contains("ReleaseBundleWithExpansionFile") }.forEach {
|
tasks.filter { it.name.contains("ReleaseBundleWithExpansionFile") }.forEach {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user