build.gradle 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'de.undercouch.download'
  3. android {
  4. compileSdkVersion 30
  5. buildToolsVersion '30.0.3'
  6. ndkVersion "$ndk_version"
  7. defaultConfig {
  8. minSdkVersion 16
  9. targetSdkVersion 30
  10. externalNativeBuild {
  11. ndkBuild {
  12. arguments '-j' + Runtime.getRuntime().availableProcessors(),
  13. "versionMajor=${versionMajor}",
  14. "versionMinor=${versionMinor}",
  15. "versionPatch=${versionPatch}",
  16. "versionExtra=${versionExtra}"
  17. }
  18. }
  19. }
  20. externalNativeBuild {
  21. ndkBuild {
  22. path file('jni/Android.mk')
  23. }
  24. }
  25. // supported architectures
  26. splits {
  27. abi {
  28. enable true
  29. reset()
  30. include 'armeabi-v7a', 'arm64-v8a'//, 'x86'
  31. }
  32. }
  33. buildTypes {
  34. release {
  35. externalNativeBuild {
  36. ndkBuild {
  37. arguments 'NDEBUG=1'
  38. }
  39. }
  40. ndk {
  41. debugSymbolLevel 'SYMBOL_TABLE'
  42. }
  43. }
  44. }
  45. }
  46. // get precompiled deps
  47. task downloadDeps(type: Download) {
  48. src 'https://github.com/minetest/minetest_android_deps/releases/download/latest/deps.zip'
  49. dest new File(buildDir, 'deps.zip')
  50. overwrite false
  51. }
  52. task getDeps(dependsOn: downloadDeps, type: Copy) {
  53. def deps = new File(buildDir.parent, 'deps')
  54. if (!deps.exists()) {
  55. deps.mkdir()
  56. from zipTree(downloadDeps.dest)
  57. into deps
  58. }
  59. }
  60. preBuild.dependsOn getDeps