build abi-split apk; use stable libwebrtc

Daniel Gultsch created

Change summary

build.gradle | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)

Detailed changes

build.gradle 🔗

@@ -1,3 +1,5 @@
+import com.android.build.OutputFile
+
 // Top-level build file where you can add configuration options common to all
 // sub-projects/modules.
 buildscript {
@@ -6,7 +8,7 @@ buildscript {
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.6.1'
+        classpath 'com.android.tools.build:gradle:3.6.2'
     }
 }
 
@@ -78,12 +80,13 @@ dependencies {
     implementation 'com.squareup.okhttp3:okhttp:3.12.10'
     implementation 'com.google.guava:guava:27.1-android'
     quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.11.1'
-    implementation 'org.webrtc:google-webrtc:1.0.+'
+    implementation fileTree(include: ['libwebrtc-m79.aar'], dir: 'libs')
 }
 
 ext {
     travisBuild = System.getenv("TRAVIS") == "true"
     preDexEnabled = System.getProperty("pre-dex", "true")
+    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
 }
 
 android {
@@ -92,8 +95,8 @@ android {
     defaultConfig {
         minSdkVersion 16
         targetSdkVersion 28
-        versionCode 372
-        versionName "2.8.0-beta.2"
+        versionCode 374
+        versionName "2.8.0-beta.3"
         archivesBaseName += "-$versionName"
         applicationId "eu.siacs.conversations"
         resValue "string", "applicationId", applicationId
@@ -101,6 +104,12 @@ android {
         buildConfigField "String", "LOGTAG", "\"conversations\""
     }
 
+    splits {
+        abi {
+            enable true
+        }
+    }
+
     dataBinding {
         enabled true
     }
@@ -254,4 +263,14 @@ android {
         exclude 'META-INF/BCKEY.DSA'
         exclude 'META-INF/BCKEY.SF'
     }
-}
+
+    android.applicationVariants.all { variant ->
+        variant.outputs.each { output ->
+            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
+            if (baseAbiVersionCode != null) {
+                output.versionCodeOverride = (100 * variant.versionCode) + baseAbiVersionCode
+            }
+        }
+
+    }
+}