--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -1,49 +1,62 @@
buildDir "${topobjdir}/gradle/build/mobile/android/geckoview"
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
+// Non-official versions are like "61.0a1", where "a1" is the milestone.
+// This simply strips that off, leaving "61.0" in this example.
+def getAppVersionWithoutMilestone() {
+ return mozconfig.substs.MOZ_APP_VERSION.replaceFirst(/a[0-9]/, "")
+}
+
// This converts MOZ_APP_VERSION into an integer
// version code.
//
// We take something like 58.1.2a1 and come out with 5800102
// This gives us 3 digits for the major number, and 2 digits
// each for the minor and build number. Beta and Release
def computeVersionCode() {
- String appVersion = mozconfig.substs.MOZ_APP_VERSION
+ String appVersion = getAppVersionWithoutMilestone()
// Split on the dot delimiter, e.g. 58.1.1a1 -> ["58, "1", "1a1"]
String[] parts = appVersion.split('\\.')
assert parts.size() == 2 || parts.size() == 3
- // Strip out any milestone string ('a1' in the above example)
- // Present in Nightly (or local) builds only.
- parts.eachWithIndex { ver, index ->
- parts[index] = ver.replaceFirst(/[a-zA-Z].*/, "")
- }
-
// Major
int code = Integer.parseInt(parts[0]) * 100000
// Minor
code += Integer.parseInt(parts[1]) * 100
// Build
if (parts.size() == 3) {
code += Integer.parseInt(parts[2])
}
return code;
}
+def isReleaseOrBeta() {
+ return mozconfig.substs.RELEASE_OR_BETA == 'true'
+}
+
+// For the benefit of future archaeologists:
+// GRE_BUILDID is exactly the same as MOZ_APP_BUILDID unless you're running
+// on XULRunner, which is never the case on Android.
+//
+// Mimic Python: open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
+def getBuildId() {
+ return file("${topobjdir}/buildid.h").getText('utf-8').split()[2]
+}
+
android {
compileSdkVersion project.ext.compileSdkVersion
defaultConfig {
targetSdkVersion project.ext.targetSdkVersion
minSdkVersion project.ext.minSdkVersion
manifestPlaceholders = project.ext.manifestPlaceholders
@@ -53,22 +66,17 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField 'String', "GRE_MILESTONE", "\"${mozconfig.substs.GRE_MILESTONE}\""
// This should really come from the included binaries, but that's not easy.
buildConfigField 'String', "MOZ_APP_ABI", mozconfig.substs['COMPILE_ENVIRONMENT'] ? "\"${ mozconfig.substs.TARGET_XPCOM_ABI}\"" : '"arm-eabi-gcc3"';
buildConfigField 'String', "MOZ_APP_BASENAME", "\"${mozconfig.substs.MOZ_APP_BASENAME}\"";
- // For the benefit of future archaeologists:
- // GRE_BUILDID is exactly the same as MOZ_APP_BUILDID unless you're running
- // on XULRunner, which is never the case on Android.
- //
- // Mimic Python: open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
- buildConfigField 'String', "MOZ_APP_BUILDID", "\"${file("${topobjdir}/buildid.h").getText('utf-8').split()[2]}\"";
+ buildConfigField 'String', "MOZ_APP_BUILDID", "\"${getBuildId()}\"";
buildConfigField 'String', "MOZ_APP_ID", "\"${mozconfig.substs.MOZ_APP_ID}\"";
buildConfigField 'String', "MOZ_APP_NAME", "\"${mozconfig.substs.MOZ_APP_NAME}\"";
buildConfigField 'String', "MOZ_APP_VENDOR", "\"${mozconfig.substs.MOZ_APP_VENDOR}\"";
buildConfigField 'String', "MOZ_APP_VERSION", "\"${mozconfig.substs.MOZ_APP_VERSION}\"";
buildConfigField 'String', "MOZ_APP_DISPLAYNAME", "\"${mozconfig.substs.MOZ_APP_DISPLAYNAME}\"";
buildConfigField 'String', "MOZ_APP_UA_NAME", "\"${mozconfig.substs.MOZ_APP_UA_NAME}\"";
buildConfigField 'String', "MOZ_UPDATE_CHANNEL", "\"${mozconfig.substs.MOZ_UPDATE_CHANNEL}\"";
@@ -222,17 +230,23 @@ android.libraryVariants.all { variant ->
}
apply plugin: 'maven'
uploadArchives {
repositories.mavenDeployer {
pom.groupId = 'org.mozilla'
pom.artifactId = "geckoview-${mozconfig.substs.MOZ_UPDATE_CHANNEL}-${mozconfig.substs.ANDROID_CPU_ARCH}"
- pom.version = mozconfig.substs.MOZ_APP_VERSION
+
+ if (isReleaseOrBeta()) {
+ pom.version = mozconfig.substs.MOZ_APP_VERSION
+ } else {
+ pom.version = getAppVersionWithoutMilestone() + "." + getBuildId()
+ }
+
pom.project {
licenses {
license {
name 'The Mozilla Public License, v. 2.0'
url 'http://mozilla.org/MPL/2.0/'
distribution 'repo'
}
}