build.gradle 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // Gradle build config for Godot Engine's Android port.
  2. //
  3. // Do not remove/modify comments ending with BEGIN/END, they are used to inject
  4. // addon-specific configuration.
  5. apply from: 'config.gradle'
  6. buildscript {
  7. apply from: 'config.gradle'
  8. repositories {
  9. google()
  10. jcenter()
  11. //CHUNK_BUILDSCRIPT_REPOSITORIES_BEGIN
  12. //CHUNK_BUILDSCRIPT_REPOSITORIES_END
  13. }
  14. dependencies {
  15. classpath libraries.androidGradlePlugin
  16. classpath libraries.kotlinGradlePlugin
  17. //CHUNK_BUILDSCRIPT_DEPENDENCIES_BEGIN
  18. //CHUNK_BUILDSCRIPT_DEPENDENCIES_END
  19. }
  20. }
  21. apply plugin: 'com.android.application'
  22. allprojects {
  23. repositories {
  24. mavenCentral()
  25. google()
  26. jcenter()
  27. //CHUNK_ALLPROJECTS_REPOSITORIES_BEGIN
  28. //CHUNK_ALLPROJECTS_REPOSITORIES_END
  29. }
  30. }
  31. dependencies {
  32. implementation libraries.supportCoreUtils
  33. implementation libraries.kotlinStdLib
  34. implementation libraries.v4Support
  35. if (rootProject.findProject(":lib")) {
  36. implementation project(":lib")
  37. } else if (rootProject.findProject(":godot:lib")) {
  38. implementation project(":godot:lib")
  39. } else {
  40. // Custom build mode. In this scenario this project is the only one around and the Godot
  41. // library is available through the pre-generated godot-lib.*.aar android archive files.
  42. debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
  43. releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
  44. }
  45. // Godot prebuilt plugins
  46. implementation fileTree(dir: 'libs/plugins', include: ["GodotPayment*.aar"])
  47. // Godot user plugins dependencies
  48. String pluginsDir = getGodotPluginsDirectory()
  49. String[] pluginsBinaries = getGodotPluginsBinaries()
  50. if (pluginsDir != null && !pluginsDir.isEmpty() &&
  51. pluginsBinaries != null && pluginsBinaries.size() > 0) {
  52. implementation fileTree(dir: pluginsDir, include: pluginsBinaries)
  53. }
  54. //CHUNK_DEPENDENCIES_BEGIN
  55. //CHUNK_DEPENDENCIES_END
  56. }
  57. android {
  58. compileSdkVersion versions.compileSdk
  59. buildToolsVersion versions.buildTools
  60. defaultConfig {
  61. // Feel free to modify the application id to your own.
  62. applicationId getExportPackageName()
  63. minSdkVersion versions.minSdk
  64. targetSdkVersion versions.targetSdk
  65. //CHUNK_ANDROID_DEFAULTCONFIG_BEGIN
  66. //CHUNK_ANDROID_DEFAULTCONFIG_END
  67. }
  68. lintOptions {
  69. abortOnError false
  70. disable 'MissingTranslation', 'UnusedResources'
  71. }
  72. packagingOptions {
  73. exclude 'META-INF/LICENSE'
  74. exclude 'META-INF/NOTICE'
  75. doNotStrip '**/*.so'
  76. }
  77. // Both signing and zip-aligning will be done at export time
  78. buildTypes.all { buildType ->
  79. buildType.zipAlignEnabled false
  80. buildType.signingConfig null
  81. }
  82. sourceSets {
  83. main {
  84. manifest.srcFile 'AndroidManifest.xml'
  85. java.srcDirs = [
  86. 'src'
  87. //DIR_SRC_BEGIN
  88. //DIR_SRC_END
  89. ]
  90. res.srcDirs = [
  91. 'res'
  92. //DIR_RES_BEGIN
  93. //DIR_RES_END
  94. ]
  95. aidl.srcDirs = [
  96. 'aidl'
  97. //DIR_AIDL_BEGIN
  98. //DIR_AIDL_END
  99. ]
  100. assets.srcDirs = [
  101. 'assets'
  102. //DIR_ASSETS_BEGIN
  103. //DIR_ASSETS_END
  104. ]
  105. }
  106. debug.jniLibs.srcDirs = [
  107. 'libs/debug'
  108. //DIR_JNI_DEBUG_BEGIN
  109. //DIR_JNI_DEBUG_END
  110. ]
  111. release.jniLibs.srcDirs = [
  112. 'libs/release'
  113. //DIR_JNI_RELEASE_BEGIN
  114. //DIR_JNI_RELEASE_END
  115. ]
  116. }
  117. applicationVariants.all { variant ->
  118. variant.outputs.all { output ->
  119. output.outputFileName = "android_${variant.name}.apk"
  120. }
  121. }
  122. }
  123. //CHUNK_GLOBAL_BEGIN
  124. //CHUNK_GLOBAL_END