aboutsummaryrefslogtreecommitdiff
path: root/build/android/native/build.gradle
blob: 8ea6347b35a9c84df66c7a85a78e73c79acf3c3b (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
apply plugin: 'com.android.library'
apply plugin: 'de.undercouch.download'

android {
	compileSdkVersion 29
	buildToolsVersion '30.0.3'
	ndkVersion '22.0.7026061'
	defaultConfig {
		minSdkVersion 16
		targetSdkVersion 29
		externalNativeBuild {
			ndkBuild {
				arguments '-j' + Runtime.getRuntime().availableProcessors(),
						"versionMajor=${versionMajor}",
						"versionMinor=${versionMinor}",
						"versionPatch=${versionPatch}",
						"versionExtra=${versionExtra}"
			}
		}
	}

	externalNativeBuild {
		ndkBuild {
			path file('jni/Android.mk')
		}
	}

	// supported architectures
	splits {
		abi {
			enable true
			reset()
			include 'armeabi-v7a', 'arm64-v8a'//, 'x86'
		}
	}

	buildTypes {
		release {
			externalNativeBuild {
				ndkBuild {
					arguments 'NDEBUG=1'
				}
			}
		}
	}
}

// get precompiled deps
def folder = 'minetest_android_deps_binaries'

task downloadDeps(type: Download) {
	src 'https://github.com/minetest/' + folder + '/archive/master.zip'
	dest new File(buildDir, 'deps.zip')
	overwrite false
}

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))
		}
	}
}

// get sqlite
def sqlite_ver = '3340000'
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
pright_sprite", textures = { "testentities_upright_sprite1.png", "testentities_upright_sprite2.png", }, }, }) minetest.register_entity("testentities:cube", { initial_properties = { visual = "cube", textures = { "testentities_cube1.png", "testentities_cube2.png", "testentities_cube3.png", "testentities_cube4.png", "testentities_cube5.png", "testentities_cube6.png", }, }, }) minetest.register_entity("testentities:item", { initial_properties = { visual = "item", wield_item = "testnodes:normal", }, }) minetest.register_entity("testentities:wielditem", { initial_properties = { visual = "wielditem", wield_item = "testnodes:normal", }, }) minetest.register_entity("testentities:mesh", { initial_properties = { visual = "mesh", mesh = "testnodes_pyramid.obj", textures = { "testnodes_mesh_stripes2.png" }, }, }) minetest.register_entity("testentities:mesh_unshaded", { initial_properties = { visual = "mesh", mesh = "testnodes_pyramid.obj", textures = { "testnodes_mesh_stripes2.png" }, shaded = false, }, }) -- Advanced visual tests -- An entity for testing animated and yaw-modulated sprites minetest.register_entity("testentities:yawsprite", { initial_properties = { selectionbox = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}, visual = "sprite", visual_size = {x=0.6666, y=1}, textures = {"testentities_dungeon_master.png^[makealpha:128,0,0^[makealpha:128,128,0"}, spritediv = {x=6, y=5}, initial_sprite_basepos = {x=0, y=0}, }, on_activate = function(self, staticdata) self.object:set_sprite({x=0, y=0}, 3, 0.5, true) end, }) -- An entity for testing animated upright sprites minetest.register_entity("testentities:upright_animated", { initial_properties = { visual = "upright_sprite", textures = {"testnodes_anim.png"}, spritediv = {x = 1, y = 4}, }, on_activate = function(self) self.object:set_sprite({x=0, y=0}, 4, 1.0, false) end, }) minetest.register_entity("testentities:nametag", { initial_properties = { visual = "sprite", textures = { "testentities_sprite.png" }, }, on_activate = function(self, staticdata) if staticdata ~= "" then local data = minetest.deserialize(staticdata) self.color = data.color self.bgcolor = data.bgcolor else self.color = { r = math.random(0, 255), g = math.random(0, 255), b = math.random(0, 255), } if math.random(0, 10) > 5 then self.bgcolor = { r = math.random(0, 255), g = math.random(0, 255), b = math.random(0, 255), a = math.random(0, 255), } end end assert(self.color) self.object:set_properties({ nametag = tostring(math.random(1000, 10000)), nametag_color = self.color, nametag_bgcolor = self.bgcolor, }) end, get_staticdata = function(self) return minetest.serialize({ color = self.color, bgcolor = self.bgcolor }) end, })