[Android] Upgrade to AGP 3.4 and Gradle 5.1.1

Geoffrey Métais git at videolan.org
Thu Apr 25 12:00:17 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 25 11:54:25 2019 +0200| [c29346bb1538b0d7bfb91fbe68607fd42f79347b] | committer: Geoffrey Métais

Upgrade to AGP 3.4 and Gradle 5.1.1

> https://code.videolan.org/videolan/vlc-android/commit/c29346bb1538b0d7bfb91fbe68607fd42f79347b
---

 build.gradle             |  2 +-
 compile.sh               | 10 ++--------
 tools/build.gradle       |  7 +------
 vlc-android/build.gradle | 33 +++++++++++++++++----------------
 4 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/build.gradle b/build.gradle
index fdbb86700..775b4ef93 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,6 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 buildscript {
-    ext.android_plugin_version = '3.3.2'
+    ext.android_plugin_version = '3.4.0'
     ext.kotlin_version = '1.3.30'
     ext.kotlinx_version = '1.1.1'
     repositories {
diff --git a/compile.sh b/compile.sh
index a7cfc5127..5d62541cf 100755
--- a/compile.sh
+++ b/compile.sh
@@ -120,7 +120,7 @@ fi
 
 if [ ! -d "gradle/wrapper" ]; then
     diagnostic "Downloading gradle"
-    GRADLE_VERSION=4.10.1
+    GRADLE_VERSION=5.1.1
     GRADLE_URL=https://download.videolan.org/pub/contrib/gradle/gradle-${GRADLE_VERSION}-bin.zip
     wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL}
     checkfail "gradle: download failed"
@@ -128,17 +128,11 @@ if [ ! -d "gradle/wrapper" ]; then
     unzip -o gradle-${GRADLE_VERSION}-bin.zip
     checkfail "gradle: unzip failed"
 
-    cd gradle-${GRADLE_VERSION}
-
-    ./bin/gradle --offline wrapper
+    ./gradle-${GRADLE_VERSION}/bin/gradle --offline wrapper
     checkfail "gradle: wrapper failed"
 
     ./gradlew -version
     checkfail "gradle: wrapper failed"
-    cd ..
-    mkdir -p gradle
-    mv gradle-${GRADLE_VERSION}/gradle/wrapper/ gradle
-    mv gradle-${GRADLE_VERSION}/gradlew .
     chmod a+x gradlew
     rm -rf gradle-${GRADLE_VERSION}-bin.zip
 fi
diff --git a/tools/build.gradle b/tools/build.gradle
index d3e6e016b..b214e959c 100644
--- a/tools/build.gradle
+++ b/tools/build.gradle
@@ -1,11 +1,9 @@
-apply plugin: 'com.android.feature'
+apply plugin: 'com.android.library'
 apply plugin: 'kotlin-android'
 
 android {
     compileSdkVersion rootProject.ext.compileSdkVersion
 
-    baseFeature true
-
     defaultConfig {
         minSdkVersion rootProject.ext.minSdkVersion
         targetSdkVersion rootProject.ext.targetSdkVersion
@@ -37,6 +35,3 @@ dependencies {
     androidTestImplementation "androidx.test:runner:$rootProject.ext.supportTest"
     androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
 }
-repositories {
-    mavenCentral()
-}
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 8a5512155..d4ee7dde1 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -199,24 +199,25 @@ task generateSources (type: Jar) {
     from android.sourceSets.main.java.srcDirs
 }
 
-task buildTranslationArray << {
-    def foundLocales = new StringBuilder()
-    foundLocales.append("new String[]{")
-
-    fileTree("res").visit { FileVisitDetails details ->
-        println 'details: '+details
-        if(details.file.path.endsWith("strings.xml")){
-            def languageCode = details.file.parent.tokenize('/').last().replaceAll('values-','').replaceAll('-r','-')
-            languageCode = (languageCode == "values") ? "en" : languageCode;
-            foundLocales.append("\"").append(languageCode).append("\"").append(",")
+task buildTranslationArray {
+    doLast {
+        def foundLocales = new StringBuilder()
+        foundLocales.append("new String[]{")
+
+        fileTree("res").visit { FileVisitDetails details ->
+            println 'details: '+details
+            if(details.file.path.endsWith("strings.xml")){
+                def languageCode = details.file.parent.tokenize('/').last().replaceAll('values-','').replaceAll('-r','-')
+                languageCode = (languageCode == "values") ? "en" : languageCode;
+                foundLocales.append("\"").append(languageCode).append("\"").append(",")
+            }
         }
-    }
-
-    foundLocales.append("}")
-    //Don't forget to remove the trailing comma
-    def foundLocalesString = foundLocales.toString().replaceAll(',}','}')
-    android.defaultConfig.buildConfigField "String[]", "TRANSLATION_ARRAY", foundLocalesString
 
+        foundLocales.append("}")
+        //Don't forget to remove the trailing comma
+        def foundLocalesString = foundLocales.toString().replaceAll(',}','}')
+        android.defaultConfig.buildConfigField "String[]", "TRANSLATION_ARRAY", foundLocalesString
+    }
 }
 preBuild.dependsOn buildTranslationArray
 



More information about the Android mailing list