1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Fix task ordering and more in Gradle Android build

This commit is contained in:
sfan5 2023-02-23 11:32:42 +01:00 committed by SmallJoker
parent a93f3542d9
commit fee2e3ee27
3 changed files with 56 additions and 44 deletions

View file

@ -53,51 +53,59 @@ android {
task prepareAssets() {
def assetsFolder = "build/assets"
def projRoot = "../.."
def projRoot = rootDir.parent
def gameToCopy = "minetest_game"
copy {
from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into assetsFolder
doFirst {
logger.lifecycle('Preparing assets at {}', assetsFolder)
}
copy {
from "${projRoot}/doc/lgpl-2.1.txt" into "${assetsFolder}"
}
copy {
from "${projRoot}/builtin" into "${assetsFolder}/builtin"
}
copy {
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
}
copy {
from "../native/deps/armeabi-v7a/Irrlicht/Shaders" into "${assetsFolder}/client/shaders/Irrlicht"
}
copy {
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
}
copy {
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
}
fileTree("${projRoot}/po").include("**/*.po").forEach { poFile ->
def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
file(moPath).mkdirs()
exec {
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
doLast {
copy {
from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into assetsFolder
}
}
copy {
from "${projRoot}/textures" into "${assetsFolder}/textures"
copy {
from "${projRoot}/doc/lgpl-2.1.txt" into assetsFolder
}
copy {
from "${projRoot}/builtin" into "${assetsFolder}/builtin"
}
copy {
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
}
copy {
from "../native/deps/armeabi-v7a/Irrlicht/Shaders" into "${assetsFolder}/client/shaders/Irrlicht"
}
copy {
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
}
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()
exec {
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
}
}
file("${assetsFolder}/.nomedia").text = ""
}
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