Android: get deps as a zip archive and sqlite3 from official source

This commit is contained in:
Maksim 2020-05-24 12:55:48 +02:00 committed by rubenwardy
parent 2341a4aff1
commit 05436fb551
4 changed files with 57 additions and 17 deletions

@ -2,7 +2,7 @@ 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 'net.minetest.minetest' applicationId 'net.minetest.minetest'
minSdkVersion 16 minSdkVersion 16

@ -15,8 +15,8 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.android.tools.build:gradle:4.0.0'
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
} }
@ -31,4 +31,5 @@ allprojects {
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
delete 'native/deps'
} }

@ -1,2 +1,2 @@
#Mon Apr 06 00:06:16 CEST 2020 #Fri Jun 05 19:18:07 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

@ -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(),
"versionMajor=${versionMajor}", "versionMajor=${versionMajor}",
"versionMinor=${versionMinor}", "versionMinor=${versionMinor}",
"versionPatch=${versionPatch}", "versionPatch=${versionPatch}",
@ -45,15 +45,54 @@ android {
} }
} }
task cloneGitRepo() { // get precompiled deps
def destination = file('deps') def folder = 'minetest_android_deps_binaries'
if(!destination.exists()) {
def grgit = Grgit.clone( task downloadDeps(type: Download) {
dir: destination, src 'https://github.com/minetest/' + folder + '/archive/master.zip'
uri: 'https://github.com/minetest/minetest_android_deps_binaries' dest new File(buildDir, 'deps.zip')
) overwrite false
grgit.close() }
task getDeps(dependsOn: downloadDeps, type: Copy) {
def deps = file('deps')
def f = file("$buildDir/" + folder + "-master")
if (!deps.exists() && !f.exists()) {
from zipTree(downloadDeps.dest)
into buildDir
}
doLast {
if (!deps.exists()) {
file(f).renameTo(file(deps))
}
} }
} }
preBuild.dependsOn cloneGitRepo // get sqlite
def sqlite_ver = '3320200'
task downloadSqlite(dependsOn: getDeps, type: Download) {
src 'https://www.sqlite.org/2020/sqlite-amalgamation-' + sqlite_ver + '.zip'
dest new File(buildDir, 'sqlite.zip')
overwrite false
}
task getSqlite(dependsOn: downloadSqlite, type: Copy) {
def sqlite = file('deps/Android/sqlite')
def f = file("$buildDir/sqlite-amalgamation-" + sqlite_ver)
if (!sqlite.exists() && !f.exists()) {
from zipTree(downloadSqlite.dest)
into buildDir
}
doLast {
if (!sqlite.exists()) {
file(f).renameTo(file(sqlite))
}
}
}
preBuild.dependsOn getDeps
preBuild.dependsOn getSqlite