Skip to content

Commit 05436fb

Browse files
Maksimrubenwardy
Maksim
authored andcommittedOct 13, 2020
Android: get deps as a zip archive and sqlite3 from official source
1 parent 2341a4a commit 05436fb

File tree

4 files changed

+57
-17
lines changed

4 files changed

+57
-17
lines changed
 

Diff for: ‎build/android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22
android {
33
compileSdkVersion 29
44
buildToolsVersion '29.0.3'
5-
ndkVersion '21.1.6352462'
5+
ndkVersion '21.2.6472646'
66
defaultConfig {
77
applicationId 'net.minetest.minetest'
88
minSdkVersion 16

Diff for: ‎build/android/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ buildscript {
1515
jcenter()
1616
}
1717
dependencies {
18-
classpath 'com.android.tools.build:gradle:3.6.3'
19-
classpath 'org.ajoberstar.grgit:grgit-gradle:4.0.2'
18+
classpath 'com.android.tools.build:gradle:4.0.0'
19+
classpath 'de.undercouch:gradle-download-task:4.0.4'
2020
// NOTE: Do not place your application dependencies here; they belong
2121
// in the individual module build.gradle files
2222
}
@@ -31,4 +31,5 @@ allprojects {
3131

3232
task clean(type: Delete) {
3333
delete rootProject.buildDir
34+
delete 'native/deps'
3435
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Mon Apr 06 00:06:16 CEST 2020
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
1+
#Fri Jun 05 19:18:07 CEST 2020
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

Diff for: ‎build/android/native/build.gradle

+51-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
apply plugin: 'com.android.library'
2-
import org.ajoberstar.grgit.Grgit
2+
apply plugin: 'de.undercouch.download'
33

44
android {
55
compileSdkVersion 29
66
buildToolsVersion '29.0.3'
7-
ndkVersion '21.1.6352462'
7+
ndkVersion '21.2.6472646'
88
defaultConfig {
99
minSdkVersion 16
1010
targetSdkVersion 29
1111
externalNativeBuild {
1212
ndkBuild {
13-
arguments '-j8',
13+
arguments '-j' + Runtime.getRuntime().availableProcessors(),
1414
"versionMajor=${versionMajor}",
1515
"versionMinor=${versionMinor}",
1616
"versionPatch=${versionPatch}",
@@ -45,15 +45,54 @@ android {
4545
}
4646
}
4747

48-
task cloneGitRepo() {
49-
def destination = file('deps')
50-
if(!destination.exists()) {
51-
def grgit = Grgit.clone(
52-
dir: destination,
53-
uri: 'https://github.com/minetest/minetest_android_deps_binaries'
54-
)
55-
grgit.close()
48+
// get precompiled deps
49+
def folder = 'minetest_android_deps_binaries'
50+
51+
task downloadDeps(type: Download) {
52+
src 'https://github.com/minetest/' + folder + '/archive/master.zip'
53+
dest new File(buildDir, 'deps.zip')
54+
overwrite false
55+
}
56+
57+
task getDeps(dependsOn: downloadDeps, type: Copy) {
58+
def deps = file('deps')
59+
def f = file("$buildDir/" + folder + "-master")
60+
61+
if (!deps.exists() && !f.exists()) {
62+
from zipTree(downloadDeps.dest)
63+
into buildDir
64+
}
65+
66+
doLast {
67+
if (!deps.exists()) {
68+
file(f).renameTo(file(deps))
69+
}
70+
}
71+
}
72+
73+
// get sqlite
74+
def sqlite_ver = '3320200'
75+
task downloadSqlite(dependsOn: getDeps, type: Download) {
76+
src 'https://www.sqlite.org/2020/sqlite-amalgamation-' + sqlite_ver + '.zip'
77+
dest new File(buildDir, 'sqlite.zip')
78+
overwrite false
79+
}
80+
81+
task getSqlite(dependsOn: downloadSqlite, type: Copy) {
82+
def sqlite = file('deps/Android/sqlite')
83+
def f = file("$buildDir/sqlite-amalgamation-" + sqlite_ver)
84+
85+
if (!sqlite.exists() && !f.exists()) {
86+
from zipTree(downloadSqlite.dest)
87+
into buildDir
88+
}
89+
90+
doLast {
91+
if (!sqlite.exists()) {
92+
file(f).renameTo(file(sqlite))
93+
}
5694
}
5795
}
5896

59-
preBuild.dependsOn cloneGitRepo
97+
preBuild.dependsOn getDeps
98+
preBuild.dependsOn getSqlite

0 commit comments

Comments
 (0)
Please sign in to comment.