mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
Play Store: implement biweekly auto-deploys
This commit is contained in:
parent
ac5c45f333
commit
d3ac2658a8
@ -39,6 +39,8 @@ android {
|
||||
}
|
||||
}
|
||||
targetSdkVersion 29
|
||||
versionCode System.currentTimeSeconds().toInteger()
|
||||
versionName "${getManifestAttribute("versionName")}_GIT"
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
@ -70,6 +72,8 @@ android {
|
||||
}
|
||||
playStoreNormal {
|
||||
minSdkVersion 21
|
||||
versionCode getPlayStoreVersionCode()
|
||||
versionName getPlayStoreVersionName()
|
||||
|
||||
resValue "string", "app_name", "RetroArch"
|
||||
buildConfigField "boolean", "PLAY_STORE_BUILD", "true"
|
||||
@ -78,6 +82,8 @@ android {
|
||||
}
|
||||
playStorePlus {
|
||||
minSdkVersion 26
|
||||
versionCode getPlayStoreVersionCode()
|
||||
versionName getPlayStoreVersionName()
|
||||
|
||||
applicationIdSuffix '.aarch64'
|
||||
resValue "string", "app_name", "RetroArch Plus"
|
||||
@ -140,3 +146,24 @@ def dynamicFeatures = file("dynamic_features.gradle")
|
||||
if(dynamicFeatures.exists()) {
|
||||
apply from: "dynamic_features.gradle"
|
||||
}
|
||||
|
||||
static int getPlayStoreVersionCode() {
|
||||
def baseVersion = getManifestAttribute("versionCode").toInteger()
|
||||
def baseTime = 1609632000
|
||||
def halfWeek = 302400
|
||||
def increment = (System.currentTimeSeconds() - baseTime) / halfWeek
|
||||
|
||||
return baseVersion + increment
|
||||
}
|
||||
|
||||
static String getPlayStoreVersionName() {
|
||||
def versionName = getManifestAttribute("versionName")
|
||||
return "$versionName (${new Date().format("yyyy-MM-dd")})"
|
||||
}
|
||||
|
||||
static String getManifestAttribute(String attribute) {
|
||||
def manifest = new XmlParser().parse("AndroidManifest.xml")
|
||||
return manifest.attributes().find {
|
||||
((String) it.key).contains(attribute)
|
||||
}.value
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import time
|
||||
|
||||
|
||||
from xml.dom.minidom import parse
|
||||
dom1 = parse("AndroidManifest.xml")
|
||||
oldVersion = dom1.documentElement.getAttribute("android:versionCode")
|
||||
versionNumbers = oldVersion.split('.')
|
||||
|
||||
versionName = dom1.documentElement.getAttribute("android:versionName")
|
||||
versionName = versionName + "_GIT"
|
||||
|
||||
versionNumbers[-1] = unicode(int(time.time()))
|
||||
dom1.documentElement.setAttribute("android:versionCode", u'.'.join(versionNumbers))
|
||||
dom1.documentElement.setAttribute("android:versionName", versionName)
|
||||
|
||||
with open("AndroidManifest.xml", 'wb') as f:
|
||||
for line in dom1.toxml("utf-8"):
|
||||
f.write(line)
|
Loading…
Reference in New Issue
Block a user