summaryrefslogtreecommitdiff
path: root/platform/android/java/app/config.gradle
blob: 3fb26326c0aebd01b63dd328fcfd8d1f90278940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
ext.versions = [
    androidGradlePlugin: '3.6.0',
    compileSdk         : 29,
    minSdk             : 18,
    targetSdk          : 29,
    buildTools         : '29.0.1',
    supportCoreUtils   : '28.0.0',
    kotlinVersion      : '1.3.61',
    v4Support          : '28.0.0'

]

ext.libraries = [
    androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin",
    supportCoreUtils   : "com.android.support:support-core-utils:$versions.supportCoreUtils",
    kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion",
    kotlinStdLib       : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlinVersion",
    v4Support          : "com.android.support:support-v4:$versions.v4Support"
]

ext.getExportPackageName = { ->
    // 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
}

/**
 * Parse the project properties for the 'custom_template_plugins' property and return
 * their binaries for inclusion in the build dependencies.
 *
 * The listed plugins must have their binaries in the project plugins directory.
 */
ext.getGodotPluginsBinaries = { ->
    String[] binDeps = []

    // Retrieve the list of enabled plugins.
    if (project.hasProperty("custom_template_plugins")) {
        String pluginsList = project.property("custom_template_plugins")
        if (pluginsList != null && !pluginsList.trim().isEmpty()) {
            for (String plugin : pluginsList.split(",")) {
                binDeps += plugin + "*.aar"
            }
        }
    }

    return binDeps
}

/**
 * Parse the project properties for the 'custom_template_plugins_dir' property and return
 * its value.
 *
 * The returned value is the directory containing user plugins.
 */
ext.getGodotPluginsDirectory = { ->
    // The plugins directory is provided by the 'custom_template_plugins_dir' property.
    String pluginsDir = project.hasProperty("custom_template_plugins_dir")
        ? project.property("custom_template_plugins_dir")
        : ""

    return pluginsDir
}