1
0

build.gradle 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. apply plugin: 'com.android.application'
  2. android {
  3. ndkVersion "$ndk_version"
  4. defaultConfig {
  5. applicationId 'net.minetest.minetest'
  6. minSdkVersion 21
  7. compileSdk 34
  8. targetSdkVersion 34
  9. versionName "${versionMajor}.${versionMinor}.${versionPatch}"
  10. versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
  11. }
  12. buildFeatures {
  13. buildConfig true
  14. }
  15. // load properties
  16. Properties props = new Properties()
  17. def propfile = file('../local.properties')
  18. if (propfile.exists())
  19. props.load(new FileInputStream(propfile))
  20. if (props.getProperty('keystore') != null) {
  21. signingConfigs {
  22. release {
  23. storeFile file(props['keystore'])
  24. storePassword props['keystore.password']
  25. keyAlias props['key']
  26. keyPassword props['key.password']
  27. }
  28. }
  29. buildTypes {
  30. release {
  31. minifyEnabled true
  32. signingConfig signingConfigs.release
  33. }
  34. }
  35. }
  36. // for multiple APKs
  37. splits {
  38. abi {
  39. enable true
  40. reset()
  41. include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  42. }
  43. }
  44. compileOptions {
  45. sourceCompatibility JavaVersion.VERSION_1_8
  46. targetCompatibility JavaVersion.VERSION_1_8
  47. }
  48. namespace 'net.minetest.minetest'
  49. }
  50. task prepareAssets() {
  51. def assetsFolder = "build/assets"
  52. def projRoot = rootDir.parent
  53. // See issue #4638
  54. def unsupportedLanguages = new File("${projRoot}/src/unsupported_language_list.txt").text.readLines()
  55. doFirst {
  56. logger.lifecycle('Preparing assets at {}', assetsFolder)
  57. }
  58. doLast {
  59. copy {
  60. from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into assetsFolder
  61. }
  62. copy {
  63. from "${projRoot}/doc/lgpl-2.1.txt" into assetsFolder
  64. }
  65. copy {
  66. from "${projRoot}/builtin" into "${assetsFolder}/builtin"
  67. }
  68. copy {
  69. from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
  70. }
  71. copy {
  72. from "${projRoot}/irr/media/Shaders" into "${assetsFolder}/client/shaders/Irrlicht"
  73. }
  74. copy {
  75. from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
  76. }
  77. copy {
  78. from "${projRoot}/textures/base/pack" into "${assetsFolder}/textures/base/pack"
  79. }
  80. // compile translations
  81. fileTree("${projRoot}/po").include("**/*.po").grep {
  82. it.parentFile.name !in unsupportedLanguages
  83. }.forEach { poFile ->
  84. def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
  85. file(moPath).mkdirs()
  86. exec {
  87. commandLine 'msgfmt', '-o', "${moPath}/luanti.mo", poFile
  88. }
  89. }
  90. file("${assetsFolder}/.nomedia").text = ""
  91. }
  92. task zipAssets(dependsOn: prepareAssets, type: Zip) {
  93. archiveFileName = "assets.zip"
  94. from assetsFolder
  95. destinationDirectory = file("src/main/assets")
  96. }
  97. }
  98. preBuild.dependsOn zipAssets
  99. prepareAssets.dependsOn ':native:getDeps'
  100. clean {
  101. delete new File("src/main/assets", "assets.zip")
  102. }
  103. dependencies {
  104. implementation project(':native')
  105. implementation 'androidx.appcompat:appcompat:1.6.1'
  106. }