Path: blob/master/platform/android/export/godot_plugin_config.h
10278 views
/**************************************************************************/1/* godot_plugin_config.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#ifndef DISABLE_DEPRECATED3334#include "core/config/project_settings.h"35#include "core/io/config_file.h"36#include "core/string/ustring.h"3738/*39The `config` section and fields are required and defined as follow:40- **name**: name of the plugin.41- **binary_type**: can be either `local` or `remote`. The type affects the **binary** field.42- **binary**:43- if **binary_type** is `local`, then this should be the filename of the plugin `aar` file in the `res://android/plugins` directory (e.g: `MyPlugin.aar`).44- if **binary_type** is `remote`, then this should be a declaration for a remote gradle binary (e.g: "org.godot.example:my-plugin:0.0.0").4546The `dependencies` section and fields are optional and defined as follow:47- **local**: contains a list of local `.aar` binary files the plugin depends on. The local binary dependencies must also be located in the `res://android/plugins` directory.48- **remote**: contains a list of remote binary gradle dependencies for the plugin.49- **custom_maven_repos**: contains a list of urls specifying custom maven repos required for the plugin's dependencies.5051See https://github.com/godotengine/godot/issues/38157#issuecomment-61877387152*/53struct PluginConfigAndroid {54inline static const char *PLUGIN_CONFIG_EXT = ".gdap";5556inline static const char *CONFIG_SECTION = "config";57inline static const char *CONFIG_NAME_KEY = "name";58inline static const char *CONFIG_BINARY_TYPE_KEY = "binary_type";59inline static const char *CONFIG_BINARY_KEY = "binary";6061inline static const char *DEPENDENCIES_SECTION = "dependencies";62inline static const char *DEPENDENCIES_LOCAL_KEY = "local";63inline static const char *DEPENDENCIES_REMOTE_KEY = "remote";64inline static const char *DEPENDENCIES_CUSTOM_MAVEN_REPOS_KEY = "custom_maven_repos";6566inline static const char *BINARY_TYPE_LOCAL = "local";67inline static const char *BINARY_TYPE_REMOTE = "remote";6869// Set to true when the config file is properly loaded.70bool valid_config = false;71// Unix timestamp of last change to this plugin.72uint64_t last_updated = 0;7374// Required config section75String name;76String binary_type;77String binary;7879// Optional dependencies section80Vector<String> local_dependencies;81Vector<String> remote_dependencies;82Vector<String> custom_maven_repos;8384static String resolve_local_dependency_path(String plugin_config_dir, String dependency_path);8586static PluginConfigAndroid resolve_prebuilt_plugin(PluginConfigAndroid prebuilt_plugin, String plugin_config_dir);8788static Vector<PluginConfigAndroid> get_prebuilt_plugins(String plugins_base_dir);8990static bool is_plugin_config_valid(PluginConfigAndroid plugin_config);9192static uint64_t get_plugin_modification_time(const PluginConfigAndroid &plugin_config, const String &config_path);9394static PluginConfigAndroid load_plugin_config(Ref<ConfigFile> config_file, const String &path);9596static void get_plugins_binaries(String binary_type, Vector<PluginConfigAndroid> plugins_configs, Vector<String> &r_result);9798static void get_plugins_custom_maven_repos(Vector<PluginConfigAndroid> plugins_configs, Vector<String> &r_result);99100static void get_plugins_names(Vector<PluginConfigAndroid> plugins_configs, Vector<String> &r_result);101};102103#endif // DISABLE_DEPRECATED104105106