1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Re-architecture of the Godot Android plugin.

This commit is contained in:
fhuya
2019-10-18 12:59:04 -04:00
parent ea2e976cdd
commit c3660bb4dc
30 changed files with 2082 additions and 1077 deletions

View File

@@ -37,6 +37,11 @@
android:name="xr_mode_metadata_name"
android:value="xr_mode_metadata_value" />
<!-- Metadata populated at export time and used by Godot to figure out which plugins must be enabled. -->
<meta-data
android:name="custom_template_plugins"
android:value="custom_template_plugins_value"/>
<activity
android:name=".GodotApp"
android:label="@string/godot_project_name_string"

View File

@@ -34,15 +34,30 @@ allprojects {
dependencies {
implementation libraries.supportCoreUtils
implementation libraries.v4Support
if (rootProject.findProject(":lib")) {
implementation project(":lib")
} else if (rootProject.findProject(":godot:lib")) {
implementation project(":godot:lib")
} else {
// Custom build mode. In this scenario this project is the only one around and the Godot
// library is available through the pre-generated godot-lib.*.aar android archive files.
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
}
// Godot prebuilt plugins
implementation fileTree(dir: 'libs/plugins', include: ["GodotPayment*.aar"])
// Godot user plugins dependencies
String pluginsDir = getGodotPluginsDirectory()
String[] pluginsBinaries = getGodotPluginsBinaries()
if (pluginsDir != null && !pluginsDir.isEmpty() &&
pluginsBinaries != null && pluginsBinaries.size() > 0) {
implementation fileTree(dir: pluginsDir, include: pluginsBinaries)
}
//CHUNK_DEPENDENCIES_BEGIN
//CHUNK_DEPENDENCIES_END
}

View File

@@ -1,24 +1,63 @@
ext.versions = [
androidGradlePlugin : '3.4.2',
compileSdk : 28,
minSdk : 18,
targetSdk : 28,
buildTools : '28.0.3',
supportCoreUtils : '28.0.0'
androidGradlePlugin: '3.4.2',
compileSdk : 28,
minSdk : 18,
targetSdk : 28,
buildTools : '28.0.3',
supportCoreUtils : '28.0.0',
v4Support : '28.0.0'
]
ext.libraries = [
androidGradlePlugin : "com.android.tools.build:gradle:$versions.androidGradlePlugin",
supportCoreUtils : "com.android.support:support-core-utils:$versions.supportCoreUtils"
androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin",
supportCoreUtils : "com.android.support:support-core-utils:$versions.supportCoreUtils",
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
// 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.trim() + "*.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
}