config.gradle 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ext.versions = [
  2. androidGradlePlugin: '4.0.1',
  3. compileSdk : 29,
  4. minSdk : 18,
  5. targetSdk : 29,
  6. buildTools : '30.0.1',
  7. supportCoreUtils : '1.0.0',
  8. kotlinVersion : '1.4.10',
  9. v4Support : '1.0.0',
  10. javaVersion : 1.8,
  11. ndkVersion : '21.4.7075529' // Also update 'platform/android/detect.py#get_project_ndk_version()' when this is updated.
  12. ]
  13. ext.libraries = [
  14. androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin",
  15. supportCoreUtils : "androidx.legacy:legacy-support-core-utils:$versions.supportCoreUtils",
  16. kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion",
  17. kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlinVersion",
  18. v4Support : "androidx.legacy:legacy-support-v4:$versions.v4Support"
  19. ]
  20. ext.getExportPackageName = { ->
  21. // Retrieve the app id from the project property set by the Godot build command.
  22. String appId = project.hasProperty("export_package_name") ? project.property("export_package_name") : ""
  23. // Check if the app id is valid, otherwise use the default.
  24. if (appId == null || appId.isEmpty()) {
  25. appId = "com.godot.game"
  26. }
  27. return appId
  28. }
  29. ext.getExportVersionCode = { ->
  30. String versionCode = project.hasProperty("export_version_code") ? project.property("export_version_code") : ""
  31. if (versionCode == null || versionCode.isEmpty()) {
  32. versionCode = "1"
  33. }
  34. try {
  35. return Integer.parseInt(versionCode)
  36. } catch (NumberFormatException ignored) {
  37. return 1
  38. }
  39. }
  40. ext.getExportVersionName = { ->
  41. String versionName = project.hasProperty("export_version_name") ? project.property("export_version_name") : ""
  42. if (versionName == null || versionName.isEmpty()) {
  43. versionName = "1.0"
  44. }
  45. return versionName
  46. }
  47. final String PLUGIN_VALUE_SEPARATOR_REGEX = "\\|"
  48. // get the list of ABIs the project should be exported to
  49. ext.getExportEnabledABIs = { ->
  50. String enabledABIs = project.hasProperty("export_enabled_abis") ? project.property("export_enabled_abis") : "";
  51. if (enabledABIs == null || enabledABIs.isEmpty()) {
  52. enabledABIs = "armeabi-v7a|arm64-v8a|x86|x86_64|"
  53. }
  54. Set<String> exportAbiFilter = [];
  55. for (String abi_name : enabledABIs.split(PLUGIN_VALUE_SEPARATOR_REGEX)) {
  56. if (!abi_name.trim().isEmpty()){
  57. exportAbiFilter.add(abi_name);
  58. }
  59. }
  60. return exportAbiFilter;
  61. }
  62. ext.getExportPath = {
  63. String exportPath = project.hasProperty("export_path") ? project.property("export_path") : ""
  64. if (exportPath == null || exportPath.isEmpty()) {
  65. exportPath = "."
  66. }
  67. return exportPath
  68. }
  69. ext.getExportFilename = {
  70. String exportFilename = project.hasProperty("export_filename") ? project.property("export_filename") : ""
  71. if (exportFilename == null || exportFilename.isEmpty()) {
  72. exportFilename = "godot_android"
  73. }
  74. return exportFilename
  75. }
  76. /**
  77. * Parse the project properties for the 'plugins_maven_repos' property and return the list
  78. * of maven repos.
  79. */
  80. ext.getGodotPluginsMavenRepos = { ->
  81. Set<String> mavenRepos = []
  82. // Retrieve the list of maven repos.
  83. if (project.hasProperty("plugins_maven_repos")) {
  84. String mavenReposProperty = project.property("plugins_maven_repos")
  85. if (mavenReposProperty != null && !mavenReposProperty.trim().isEmpty()) {
  86. for (String mavenRepoUrl : mavenReposProperty.split(PLUGIN_VALUE_SEPARATOR_REGEX)) {
  87. mavenRepos += mavenRepoUrl.trim()
  88. }
  89. }
  90. }
  91. return mavenRepos
  92. }
  93. /**
  94. * Parse the project properties for the 'plugins_remote_binaries' property and return
  95. * it for inclusion in the build dependencies.
  96. */
  97. ext.getGodotPluginsRemoteBinaries = { ->
  98. Set<String> remoteDeps = []
  99. // Retrieve the list of remote plugins binaries.
  100. if (project.hasProperty("plugins_remote_binaries")) {
  101. String remoteDepsList = project.property("plugins_remote_binaries")
  102. if (remoteDepsList != null && !remoteDepsList.trim().isEmpty()) {
  103. for (String dep: remoteDepsList.split(PLUGIN_VALUE_SEPARATOR_REGEX)) {
  104. remoteDeps += dep.trim()
  105. }
  106. }
  107. }
  108. return remoteDeps
  109. }
  110. /**
  111. * Parse the project properties for the 'plugins_local_binaries' property and return
  112. * their binaries for inclusion in the build dependencies.
  113. */
  114. ext.getGodotPluginsLocalBinaries = { ->
  115. Set<String> binDeps = []
  116. // Retrieve the list of local plugins binaries.
  117. if (project.hasProperty("plugins_local_binaries")) {
  118. String pluginsList = project.property("plugins_local_binaries")
  119. if (pluginsList != null && !pluginsList.trim().isEmpty()) {
  120. for (String plugin : pluginsList.split(PLUGIN_VALUE_SEPARATOR_REGEX)) {
  121. binDeps += plugin.trim()
  122. }
  123. }
  124. }
  125. return binDeps
  126. }
  127. ext.getReleaseKeystoreFile = { ->
  128. String keystoreFile = project.hasProperty("release_keystore_file") ? project.property("release_keystore_file") : ""
  129. if (keystoreFile == null || keystoreFile.isEmpty()) {
  130. keystoreFile = "."
  131. }
  132. return keystoreFile
  133. }
  134. ext.getReleaseKeystorePassword = { ->
  135. String keystorePassword = project.hasProperty("release_keystore_password") ? project.property("release_keystore_password") : ""
  136. return keystorePassword
  137. }
  138. ext.getReleaseKeyAlias = { ->
  139. String keyAlias = project.hasProperty("release_keystore_alias") ? project.property("release_keystore_alias") : ""
  140. return keyAlias
  141. }
  142. ext.shouldZipAlign = { ->
  143. String zipAlignFlag = project.hasProperty("perform_zipalign") ? project.property("perform_zipalign") : ""
  144. if (zipAlignFlag == null || zipAlignFlag.isEmpty()) {
  145. zipAlignFlag = "false"
  146. }
  147. return Boolean.parseBoolean(zipAlignFlag)
  148. }
  149. ext.shouldSign = { ->
  150. String signFlag = project.hasProperty("perform_signing") ? project.property("perform_signing") : ""
  151. if (signFlag == null || signFlag.isEmpty()) {
  152. signFlag = "false"
  153. }
  154. return Boolean.parseBoolean(signFlag)
  155. }