2019-09-03 00:31:51 +00:00
|
|
|
ext.versions = [
|
2021-02-17 22:46:45 +00:00
|
|
|
androidGradlePlugin: '4.0.1',
|
2020-03-25 16:00:37 +00:00
|
|
|
compileSdk : 29,
|
2019-10-18 16:59:04 +00:00
|
|
|
minSdk : 18,
|
2020-03-25 16:00:37 +00:00
|
|
|
targetSdk : 29,
|
2020-10-28 19:43:35 +00:00
|
|
|
buildTools : '30.0.1',
|
2020-04-16 08:25:53 +00:00
|
|
|
supportCoreUtils : '1.0.0',
|
2020-10-28 19:43:35 +00:00
|
|
|
kotlinVersion : '1.4.10',
|
2020-10-28 23:32:45 +00:00
|
|
|
v4Support : '1.0.0',
|
2021-01-05 21:40:42 +00:00
|
|
|
javaVersion : 1.8,
|
2021-02-17 23:28:27 +00:00
|
|
|
ndkVersion : '21.4.7075529' // Also update 'platform/android/detect.py#get_project_ndk_version()' when this is updated.
|
2019-09-03 00:31:51 +00:00
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
ext.libraries = [
|
2019-10-18 16:59:04 +00:00
|
|
|
androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin",
|
2020-04-16 08:25:53 +00:00
|
|
|
supportCoreUtils : "androidx.legacy:legacy-support-core-utils:$versions.supportCoreUtils",
|
2020-03-27 05:42:18 +00:00
|
|
|
kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion",
|
|
|
|
kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlinVersion",
|
2020-04-16 08:25:53 +00:00
|
|
|
v4Support : "androidx.legacy:legacy-support-v4:$versions.v4Support"
|
2019-09-03 00:31:51 +00:00
|
|
|
]
|
2019-12-13 00:52:57 +00:00
|
|
|
|
|
|
|
ext.getExportPackageName = { ->
|
2019-10-18 16:59:04 +00:00
|
|
|
// Retrieve the app id from the project property set by the Godot build command.
|
|
|
|
String appId = project.hasProperty("export_package_name") ? project.property("export_package_name") : ""
|
|
|
|
// Check if the app id is valid, otherwise use the default.
|
|
|
|
if (appId == null || appId.isEmpty()) {
|
|
|
|
appId = "com.godot.game"
|
|
|
|
}
|
|
|
|
return appId
|
|
|
|
}
|
|
|
|
|
2020-07-23 16:17:02 +00:00
|
|
|
ext.getExportVersionCode = { ->
|
|
|
|
String versionCode = project.hasProperty("export_version_code") ? project.property("export_version_code") : ""
|
|
|
|
if (versionCode == null || versionCode.isEmpty()) {
|
|
|
|
versionCode = "1"
|
|
|
|
}
|
2020-11-21 22:09:33 +00:00
|
|
|
try {
|
|
|
|
return Integer.parseInt(versionCode)
|
|
|
|
} catch (NumberFormatException ignored) {
|
|
|
|
return 1
|
|
|
|
}
|
2020-07-23 16:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ext.getExportVersionName = { ->
|
|
|
|
String versionName = project.hasProperty("export_version_name") ? project.property("export_version_name") : ""
|
|
|
|
if (versionName == null || versionName.isEmpty()) {
|
|
|
|
versionName = "1.0"
|
|
|
|
}
|
|
|
|
return versionName
|
|
|
|
}
|
|
|
|
|
2021-02-24 11:49:00 +00:00
|
|
|
ext.getGodotEditorVersion = { ->
|
|
|
|
String editorVersion = project.hasProperty("godot_editor_version") ? project.property("godot_editor_version") : ""
|
|
|
|
if (editorVersion == null || editorVersion.isEmpty()) {
|
|
|
|
// Try the library version first
|
|
|
|
editorVersion = getGodotLibraryVersion()
|
|
|
|
|
|
|
|
if (editorVersion.isEmpty()) {
|
|
|
|
// Fallback value.
|
|
|
|
editorVersion = "custom_build"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return editorVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.getGodotLibraryVersion = { ->
|
|
|
|
// Attempt to read the version from the `version.py` file.
|
|
|
|
String libraryVersion = ""
|
|
|
|
|
|
|
|
File versionFile = new File("../../../version.py")
|
|
|
|
if (versionFile.isFile()) {
|
|
|
|
List<String> requiredKeys = ["major", "minor", "patch", "status", "module_config"]
|
|
|
|
def map = [:]
|
|
|
|
|
|
|
|
List<String> lines = versionFile.readLines()
|
|
|
|
for (String line in lines) {
|
|
|
|
String[] keyValue = line.split("=")
|
|
|
|
String key = keyValue[0].trim()
|
|
|
|
String value = keyValue[1].trim().replaceAll("\"", "")
|
|
|
|
|
|
|
|
if (requiredKeys.contains(key)) {
|
|
|
|
if (!value.isEmpty()) {
|
|
|
|
map[key] = value
|
|
|
|
}
|
|
|
|
requiredKeys.remove(key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (requiredKeys.empty) {
|
|
|
|
libraryVersion = map.values().join(".")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (libraryVersion.isEmpty()) {
|
|
|
|
// Fallback value in case we're unable to read the file.
|
|
|
|
libraryVersion = "custom_build"
|
|
|
|
}
|
|
|
|
return libraryVersion
|
|
|
|
}
|
|
|
|
|
2021-02-26 16:38:39 +00:00
|
|
|
final String VALUE_SEPARATOR_REGEX = "\\|"
|
2020-04-24 07:45:14 +00:00
|
|
|
|
2020-07-23 16:17:02 +00:00
|
|
|
// get the list of ABIs the project should be exported to
|
|
|
|
ext.getExportEnabledABIs = { ->
|
|
|
|
String enabledABIs = project.hasProperty("export_enabled_abis") ? project.property("export_enabled_abis") : "";
|
|
|
|
if (enabledABIs == null || enabledABIs.isEmpty()) {
|
|
|
|
enabledABIs = "armeabi-v7a|arm64-v8a|x86|x86_64|"
|
|
|
|
}
|
|
|
|
Set<String> exportAbiFilter = [];
|
2021-02-26 16:38:39 +00:00
|
|
|
for (String abi_name : enabledABIs.split(VALUE_SEPARATOR_REGEX)) {
|
2020-07-23 16:17:02 +00:00
|
|
|
if (!abi_name.trim().isEmpty()){
|
|
|
|
exportAbiFilter.add(abi_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return exportAbiFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.getExportPath = {
|
|
|
|
String exportPath = project.hasProperty("export_path") ? project.property("export_path") : ""
|
|
|
|
if (exportPath == null || exportPath.isEmpty()) {
|
|
|
|
exportPath = "."
|
|
|
|
}
|
|
|
|
return exportPath
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.getExportFilename = {
|
|
|
|
String exportFilename = project.hasProperty("export_filename") ? project.property("export_filename") : ""
|
|
|
|
if (exportFilename == null || exportFilename.isEmpty()) {
|
|
|
|
exportFilename = "godot_android"
|
|
|
|
}
|
|
|
|
return exportFilename
|
|
|
|
}
|
|
|
|
|
2019-10-18 16:59:04 +00:00
|
|
|
/**
|
2020-04-24 07:45:14 +00:00
|
|
|
* Parse the project properties for the 'plugins_maven_repos' property and return the list
|
|
|
|
* of maven repos.
|
2019-10-18 16:59:04 +00:00
|
|
|
*/
|
2020-04-24 07:45:14 +00:00
|
|
|
ext.getGodotPluginsMavenRepos = { ->
|
|
|
|
Set<String> mavenRepos = []
|
2019-10-18 16:59:04 +00:00
|
|
|
|
2020-04-24 07:45:14 +00:00
|
|
|
// Retrieve the list of maven repos.
|
|
|
|
if (project.hasProperty("plugins_maven_repos")) {
|
|
|
|
String mavenReposProperty = project.property("plugins_maven_repos")
|
|
|
|
if (mavenReposProperty != null && !mavenReposProperty.trim().isEmpty()) {
|
2021-02-26 16:38:39 +00:00
|
|
|
for (String mavenRepoUrl : mavenReposProperty.split(VALUE_SEPARATOR_REGEX)) {
|
2020-04-24 07:45:14 +00:00
|
|
|
mavenRepos += mavenRepoUrl.trim()
|
2019-10-18 16:59:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-24 07:45:14 +00:00
|
|
|
return mavenRepos
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse the project properties for the 'plugins_remote_binaries' property and return
|
|
|
|
* it for inclusion in the build dependencies.
|
|
|
|
*/
|
|
|
|
ext.getGodotPluginsRemoteBinaries = { ->
|
|
|
|
Set<String> remoteDeps = []
|
|
|
|
|
|
|
|
// Retrieve the list of remote plugins binaries.
|
|
|
|
if (project.hasProperty("plugins_remote_binaries")) {
|
|
|
|
String remoteDepsList = project.property("plugins_remote_binaries")
|
|
|
|
if (remoteDepsList != null && !remoteDepsList.trim().isEmpty()) {
|
2021-02-26 16:38:39 +00:00
|
|
|
for (String dep: remoteDepsList.split(VALUE_SEPARATOR_REGEX)) {
|
2020-04-24 07:45:14 +00:00
|
|
|
remoteDeps += dep.trim()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return remoteDeps
|
2019-10-18 16:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-04-24 07:45:14 +00:00
|
|
|
* Parse the project properties for the 'plugins_local_binaries' property and return
|
|
|
|
* their binaries for inclusion in the build dependencies.
|
2019-10-18 16:59:04 +00:00
|
|
|
*/
|
2020-04-24 07:45:14 +00:00
|
|
|
ext.getGodotPluginsLocalBinaries = { ->
|
2020-05-27 19:04:31 +00:00
|
|
|
Set<String> binDeps = []
|
2020-04-24 07:45:14 +00:00
|
|
|
|
|
|
|
// Retrieve the list of local plugins binaries.
|
|
|
|
if (project.hasProperty("plugins_local_binaries")) {
|
|
|
|
String pluginsList = project.property("plugins_local_binaries")
|
|
|
|
if (pluginsList != null && !pluginsList.trim().isEmpty()) {
|
2021-02-26 16:38:39 +00:00
|
|
|
for (String plugin : pluginsList.split(VALUE_SEPARATOR_REGEX)) {
|
2020-04-24 07:45:14 +00:00
|
|
|
binDeps += plugin.trim()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-18 16:59:04 +00:00
|
|
|
|
2020-04-24 07:45:14 +00:00
|
|
|
return binDeps
|
2019-12-13 00:52:57 +00:00
|
|
|
}
|
2020-11-21 22:09:33 +00:00
|
|
|
|
|
|
|
ext.getReleaseKeystoreFile = { ->
|
|
|
|
String keystoreFile = project.hasProperty("release_keystore_file") ? project.property("release_keystore_file") : ""
|
|
|
|
if (keystoreFile == null || keystoreFile.isEmpty()) {
|
|
|
|
keystoreFile = "."
|
|
|
|
}
|
|
|
|
return keystoreFile
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.getReleaseKeystorePassword = { ->
|
|
|
|
String keystorePassword = project.hasProperty("release_keystore_password") ? project.property("release_keystore_password") : ""
|
|
|
|
return keystorePassword
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.getReleaseKeyAlias = { ->
|
|
|
|
String keyAlias = project.hasProperty("release_keystore_alias") ? project.property("release_keystore_alias") : ""
|
|
|
|
return keyAlias
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.shouldZipAlign = { ->
|
|
|
|
String zipAlignFlag = project.hasProperty("perform_zipalign") ? project.property("perform_zipalign") : ""
|
|
|
|
if (zipAlignFlag == null || zipAlignFlag.isEmpty()) {
|
|
|
|
zipAlignFlag = "false"
|
|
|
|
}
|
|
|
|
return Boolean.parseBoolean(zipAlignFlag)
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.shouldSign = { ->
|
|
|
|
String signFlag = project.hasProperty("perform_signing") ? project.property("perform_signing") : ""
|
|
|
|
if (signFlag == null || signFlag.isEmpty()) {
|
|
|
|
signFlag = "false"
|
|
|
|
}
|
|
|
|
return Boolean.parseBoolean(signFlag)
|
|
|
|
}
|