aboutsummaryrefslogtreecommitdiff
path: root/build/android/build.gradle
blob: 3a3754a76ac8913be95ffa639ad51de06797f916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
buildscript {
	repositories {
		google()
		jcenter()
	}
	dependencies {
		classpath 'com.android.tools.build:gradle:3.4.2'
	}
}

allprojects {
	repositories {
		google()
		jcenter()
	}
}

def curl_version = "7.60.0"
def irrlicht_revision = "5150"
def openal_version = "1.18.2"
def openssl_version = "1.0.2n"
def sqlite3_version = "3240000"

apply plugin: "com.android.application"

android {
	compileSdkVersion 28

	defaultConfig {
		versionCode 23
		versionName "${System.env.VERSION_STR}.${versionCode}"
		minSdkVersion 14
		targetSdkVersion 28
		applicationId "net.minetest.minetest"
		manifestPlaceholders = [package: "net.minetest.minetest", project: project.name]
		ndk {
			// Specifies the ABI configurations of your native
			// libraries Gradle should build and package with your APK.
			// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
			abiFilters 'armeabi-v7a', 'x86'
		}
	}

	lintOptions {
		disable "OldTargetApi", "GoogleAppIndexingWarning"
	}

	Properties props = new Properties()
	props.load(new FileInputStream(file("local.properties")))

	if (props.getProperty("keystore") != null) {
		signingConfigs {
			release {
				storeFile file(props["keystore"])
				storePassword props["keystore.password"]
				keyAlias props["key"]
				keyPassword props["key.password"]
			}
		}

		buildTypes {
			release {
				signingConfig signingConfigs.release
			}
		}
	}
}

task cleanAssets(type: Delete) {
	delete 'src/main/assets'
}

task copyAssets {
	dependsOn 'cleanAssets'
	mkdir "src/main/assets"

	def mtAssetsFolder = "src/main/assets/Minetest"
	def projRoot = "../.."
	def gameToCopy = "minetest_game"

	doLast {
		mkdir "${mtAssetsFolder}"
		mkdir "${mtAssetsFolder}/client"
		mkdir "${mtAssetsFolder}/fonts"
		mkdir "${mtAssetsFolder}/games"
		mkdir "${mtAssetsFolder}/media"

		copy {
			from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into mtAssetsFolder
		}
		copy {
			from "${projRoot}/doc/lgpl-2.1.txt" into "${mtAssetsFolder}/LICENSE.txt"
		}
		copy {
			from "${projRoot}/builtin" into "${mtAssetsFolder}/builtin"
		}
		copy {
			from "${projRoot}/client/shaders" into "${mtAssetsFolder}/client/shaders"
		}
		copy {
			from "${projRoot}/fonts" include "*.ttf" into "${mtAssetsFolder}/fonts"
		}
		copy {
			from "${projRoot}/games/${gameToCopy}" into "${mtAssetsFolder}/games/${gameToCopy}"
		}
		copy {
			from "${projRoot}/po" into "${mtAssetsFolder}/po"
		}
		copy {
			from "${projRoot}/textures" into "${mtAssetsFolder}/textures"
		}
	}
}

task cleanIconv(type: Delete) {
	delete 'deps/libiconv'
}

task cleanIrrlicht(type: Delete) {
	delete 'deps/irrlicht'
}

task cleanLevelDB(type: Delete) {
	delete 'deps/leveldb'
}

task cleanCURL(type: Delete) {
	delete 'deps/curl'
	delete 'deps/curl-' + curl_version
}

task cleanOpenSSL(type: Delete) {
	delete 'deps/openssl'
	delete 'deps/openssl-' + openssl_version
	delete 'deps/openssl-' + openssl_version + '.tar.gz'
}

task cleanOpenAL(type: Delete) {
	delete 'deps/openal-soft'
}

task cleanFreetype(type: Delete) {
	delete 'deps/freetype2-android'
}

task cleanOgg(type: Delete) {
	delete 'deps/libvorbis-libogg-android'
}

task cleanSQLite3(type: Delete) {
	delete 'deps/sqlite-amalgamation-' + sqlite3_version
	delete 'deps/sqlite-amalgamation-' + sqlite3_version + '.zip'
}

task cleanAll(type: Delete, dependsOn: [clean, cleanAssets, cleanIconv,
		cleanFreetype, cleanIrrlicht, cleanLevelDB, cleanSQLite3, cleanCURL,
		cleanOpenSSL, cleanOpenAL, cleanOgg]) {
	delete 'deps'
	delete 'gen'
	delete 'libs'
	delete 'obj'
	delete 'bin'
	delete 'Debug'
	delete 'and_env'
}

dependencies {
	implementation 'com.android.support:support-v4:28.0.0'
}