Android: update gradle, get precompiled deps as zip

This commit is contained in:
Maksim 2020-05-29 14:57:01 +02:00
parent a3ac5079fa
commit fe4fe77ac2
4 changed files with 67 additions and 41 deletions

View File

@ -2,19 +2,21 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.3' buildToolsVersion '29.0.3'
ndkVersion '21.1.6352462' ndkVersion '21.2.6472646'
defaultConfig { defaultConfig {
applicationId 'com.multicraft.game' applicationId 'com.multicraft.game'
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
versionCode 43 versionCode 61
versionName "1.9.3" versionName "1.9.4"
/*multiDexEnabled true /*multiDexEnabled true*/
useLibrary 'org.apache.http.legacy'*/
} }
// load properties
Properties props = new Properties() Properties props = new Properties()
props.load(new FileInputStream(file('../local.properties'))) def propfile = file('../local.properties')
if (propfile.exists())
props.load(new FileInputStream(propfile))
if (props.getProperty('keystore') != null) { if (props.getProperty('keystore') != null) {
signingConfigs { signingConfigs {
@ -51,17 +53,20 @@ android {
} }
dependencies { dependencies {
/* MultiCraft Native */
implementation project(':native')
/* Third-party libraries */
/*implementation 'androidx.multidex:multidex:2.0.1'*/ /*implementation 'androidx.multidex:multidex:2.0.1'*/
implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.preference:preference:1.1.1'
// MultiCraft Native
implementation project(':native')
// Analytics libraries
//noinspection GradleDynamicVersion
/*implementation('com.bugsnag:bugsnag-android:4.+') {
exclude group: 'com.bugsnag', module: 'bugsnag-plugin-android-ndk'
}*/
// Third-party libraries
/*implementation 'gun0912.ted:tedpermission:2.2.3'*/
//noinspection GradleDependency //noinspection GradleDependency
implementation 'commons-io:commons-io:2.5' implementation 'commons-io:commons-io:2.5'
/*implementation 'gun0912.ted:tedpermission:2.2.3'*/
/* Analytics libraries */
//noinspection GradleDynamicVersion
/*implementation('com.bugsnag:bugsnag-android:5.+') {
exclude group: 'com.bugsnag', module: 'bugsnag-plugin-android-anr'
exclude group: 'com.bugsnag', module: 'bugsnag-plugin-android-ndk'
}*/
} }

View File

@ -6,10 +6,10 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.android.tools.build:gradle:4.0.0'
//noinspection GradleDynamicVersion //noinspection GradleDynamicVersion
/*classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'*/ /*classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'*/
classpath 'org.ajoberstar.grgit:grgit-gradle:4.0.2' classpath 'de.undercouch:gradle-download-task:4.0.4'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }

View File

@ -1,6 +1,6 @@
#Wed Mar 25 23:38:28 CET 2020 #Tue May 19 19:48:00 CEST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip

View File

@ -1,16 +1,16 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
import org.ajoberstar.grgit.Grgit apply plugin: 'de.undercouch.download'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.3' buildToolsVersion '29.0.3'
ndkVersion '21.1.6352462' ndkVersion '21.2.6472646'
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
externalNativeBuild { externalNativeBuild {
ndkBuild { ndkBuild {
arguments '-j8' arguments '-j' + Runtime.getRuntime().availableProcessors()
} }
} }
} }
@ -41,28 +41,49 @@ android {
} }
} }
task cloneGitRepo() { // get precompiled deps
def destination = file('deps') task downloadDeps(type: Download) {
if(!destination.exists()) { src 'https://github.com/MultiCraft/deps/archive/master.zip'
def grgit = Grgit.clone( dest new File(buildDir, 'deps.zip')
dir: destination, overwrite false
uri: 'https://github.com/MultiCraft/deps' }
)
grgit.close() task getDeps(dependsOn: downloadDeps, type: Copy) {
def deps = file('deps')
def f = file("$buildDir/deps-master")
if (!f.exists()) {
from zipTree(downloadDeps.dest)
into buildDir
}
doLast {
file(f).renameTo(file(deps))
} }
} }
task clonelibiconv() { // get libiconv
def destination = file('deps/Android/ndk_iconv') task downloadIconv(type: Download) {
if(!destination.exists()) { src 'https://github.com/MoNTE48/ndk_iconv/archive/mc.zip'
def grgit = Grgit.clone( dest new File(buildDir, 'sqlite.zip')
dir: destination, overwrite false
uri: 'https://github.com/MoNTE48/ndk_iconv', }
refToCheckout: 'mc'
) task getIconv(dependsOn: downloadIconv, type: Copy) {
grgit.close() def iconv = file('deps/Android/ndk_iconv')
def f = file("$buildDir/ndk_iconv-mc")
if (!iconv.exists() && !f.exists()) {
from zipTree(downloadIconv.dest)
into buildDir
}
doLast {
if (!iconv.exists()) {
file(f).renameTo(file(iconv))
}
} }
} }
preBuild.dependsOn cloneGitRepo preBuild.dependsOn getDeps
preBuild.dependsOn clonelibiconv preBuild.dependsOn getIconv