Commit c29346bb authored by Geoffrey Métais's avatar Geoffrey Métais

Upgrade to AGP 3.4 and Gradle 5.1.1

parent 6f2e56b5
// 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 {
......
......@@ -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
......
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()
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment