forked from Mirrorlandia_minetest/minetest
Fix task ordering and more in Gradle Android build
This commit is contained in:
parent
a93f3542d9
commit
fee2e3ee27
@ -53,14 +53,18 @@ android {
|
||||
|
||||
task prepareAssets() {
|
||||
def assetsFolder = "build/assets"
|
||||
def projRoot = "../.."
|
||||
def projRoot = rootDir.parent
|
||||
def gameToCopy = "minetest_game"
|
||||
|
||||
doFirst {
|
||||
logger.lifecycle('Preparing assets at {}', assetsFolder)
|
||||
}
|
||||
doLast {
|
||||
copy {
|
||||
from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into assetsFolder
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/doc/lgpl-2.1.txt" into "${assetsFolder}"
|
||||
from "${projRoot}/doc/lgpl-2.1.txt" into assetsFolder
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/builtin" into "${assetsFolder}/builtin"
|
||||
@ -77,6 +81,11 @@ task prepareAssets() {
|
||||
copy {
|
||||
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/textures" into "${assetsFolder}/textures"
|
||||
}
|
||||
|
||||
// compile translations
|
||||
fileTree("${projRoot}/po").include("**/*.po").forEach { poFile ->
|
||||
def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
|
||||
file(moPath).mkdirs()
|
||||
@ -84,20 +93,19 @@ task prepareAssets() {
|
||||
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
|
||||
}
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/textures" into "${assetsFolder}/textures"
|
||||
}
|
||||
|
||||
file("${assetsFolder}/.nomedia").text = ""
|
||||
}
|
||||
|
||||
task zipAssets(type: Zip) {
|
||||
task zipAssets(dependsOn: prepareAssets, type: Zip) {
|
||||
archiveFileName = "Minetest.zip"
|
||||
from "${assetsFolder}"
|
||||
from assetsFolder
|
||||
destinationDirectory = file("src/main/assets")
|
||||
}
|
||||
}
|
||||
|
||||
preBuild.dependsOn zipAssets
|
||||
prepareAssets.dependsOn ':native:getDeps'
|
||||
|
||||
// Map for the version code that gives each ABI a value.
|
||||
import com.android.build.OutputFile
|
||||
|
@ -33,5 +33,4 @@ allprojects {
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
delete 'native/deps'
|
||||
}
|
||||
|
@ -52,18 +52,23 @@ android {
|
||||
|
||||
// get precompiled deps
|
||||
task downloadDeps(type: Download) {
|
||||
def depsDir = new File(buildDir.parent, 'deps')
|
||||
def depsZip = new File(buildDir, 'deps.zip')
|
||||
|
||||
src 'https://github.com/minetest/minetest_android_deps/releases/download/latest/deps.zip'
|
||||
dest new File(buildDir, 'deps.zip')
|
||||
dest depsZip
|
||||
overwrite false
|
||||
}
|
||||
|
||||
task getDeps(dependsOn: downloadDeps, type: Copy) {
|
||||
def deps = new File(buildDir.parent, 'deps')
|
||||
if (!deps.exists()) {
|
||||
deps.mkdir()
|
||||
from zipTree(downloadDeps.dest)
|
||||
into deps
|
||||
depsDir.mkdir()
|
||||
from zipTree(depsZip)
|
||||
into depsDir
|
||||
doFirst { logger.lifecycle('Extracting to {}', depsDir) }
|
||||
}
|
||||
}
|
||||
|
||||
preBuild.dependsOn getDeps
|
||||
|
||||
clean {
|
||||
delete new File(buildDir.parent, 'deps')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user