From 2c6ba0068eaa5fa8840a5be81b99f509b899eb7f Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 31 Jul 2021 19:45:27 +0200 Subject: [PATCH] [android] Update gradle build system --- android-project/app/build.gradle | 129 +++++++++--------- android-project/build.gradle | 50 +++---- android-project/gradle.properties | 0 .../gradle/wrapper/gradle-wrapper.properties | 6 +- 4 files changed, 92 insertions(+), 93 deletions(-) create mode 100644 android-project/gradle.properties diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle index 5f3230077..84eb5f702 100644 --- a/android-project/app/build.gradle +++ b/android-project/app/build.gradle @@ -1,65 +1,64 @@ -def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY'); -def buildAsApplication = !buildAsLibrary -if (buildAsApplication) { - apply plugin: 'com.android.application' -} -else { - apply plugin: 'com.android.library' -} - -android { - compileSdkVersion 29 // Upgrade to 30 after november 2021 - aaptOptions { - noCompress 'mpq' - } - defaultConfig { - if (buildAsApplication) { - applicationId "org.diasurgical.devilutionx" - } - minSdkVersion 18 - targetSdkVersion 29 // Upgrade to 30 after november 2021 - versionCode 18 - versionName "1.2.1" - externalNativeBuild { - cmake { - arguments "-DANDROID_STL=c++_static" - abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' - } - } - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { - sourceSets.main { - jniLibs.srcDir 'libs' - } - externalNativeBuild { - cmake { - path '../../CMakeLists.txt' - version "3.13.0+" - } - } - - } - - if (buildAsLibrary) { - libraryVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith(".aar")) { - def fileName = "org.diasurgical.devilutionx.aar"; - output.outputFile = new File(outputFile.parent, fileName); - } - } - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support.constraint:constraint-layout:2.0.4' -} +def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY'); +def buildAsApplication = !buildAsLibrary +if (buildAsApplication) { + apply plugin: 'com.android.application' +} else { + apply plugin: 'com.android.library' +} + +android { + compileSdkVersion 29 // Upgrade to 30 after november 2021 + aaptOptions { + noCompress 'mpq' + } + defaultConfig { + if (buildAsApplication) { + applicationId "org.diasurgical.devilutionx" + } + minSdkVersion 18 + targetSdkVersion 29 // Upgrade to 30 after november 2021 + versionCode 18 + versionName "1.2.1" + externalNativeBuild { + cmake { + arguments "-DANDROID_STL=c++_static" + abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + } + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { + sourceSets.main { + jniLibs.srcDir 'libs' + } + externalNativeBuild { + cmake { + path '../../CMakeLists.txt' + version "3.13.0+" + } + } + + } + + if (buildAsLibrary) { + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith(".aar")) { + def fileName = "org.diasurgical.devilutionx.aar"; + output.outputFile = new File(outputFile.parent, fileName); + } + } + } + } +} + +dependencies { + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'com.android.support.constraint:constraint-layout:2.0.4' +} diff --git a/android-project/build.gradle b/android-project/build.gradle index da2588828..bcb07a1ff 100644 --- a/android-project/build.gradle +++ b/android-project/build.gradle @@ -1,25 +1,25 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - mavenCentral() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - mavenCentral() - google() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + mavenCentral() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + mavenCentral() + google() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/android-project/gradle.properties b/android-project/gradle.properties new file mode 100644 index 000000000..e69de29bb diff --git a/android-project/gradle/wrapper/gradle-wrapper.properties b/android-project/gradle/wrapper/gradle-wrapper.properties index 825a67a44..0df8f9a32 100644 --- a/android-project/gradle/wrapper/gradle-wrapper.properties +++ b/android-project/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jun 07 15:45:49 CEST 2021 +#Sat Jul 31 19:39:28 CEST 2021 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +zipStoreBase=GRADLE_USER_HOME