gradle_export_util.h 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*************************************************************************/
  2. /* gradle_export_util.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef GODOT_GRADLE_EXPORT_UTIL_H
  31. #define GODOT_GRADLE_EXPORT_UTIL_H
  32. #include "core/io/dir_access.h"
  33. #include "core/io/file_access.h"
  34. #include "core/io/zip_io.h"
  35. #include "core/os/os.h"
  36. #include "editor/editor_export.h"
  37. const String godot_project_name_xml_string = R"(<?xml version="1.0" encoding="utf-8"?>
  38. <!--WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME-->
  39. <resources>
  40. <string name="godot_project_name_string">%s</string>
  41. </resources>
  42. )";
  43. struct CustomExportData {
  44. String assets_directory;
  45. bool debug;
  46. Vector<String> libs;
  47. };
  48. int _get_android_orientation_value(DisplayServer::ScreenOrientation screen_orientation);
  49. String _get_android_orientation_label(DisplayServer::ScreenOrientation screen_orientation);
  50. // Utility method used to create a directory.
  51. Error create_directory(const String &p_dir);
  52. // Writes p_data into a file at p_path, creating directories if necessary.
  53. // Note: this will overwrite the file at p_path if it already exists.
  54. Error store_file_at_path(const String &p_path, const Vector<uint8_t> &p_data);
  55. // Writes string p_data into a file at p_path, creating directories if necessary.
  56. // Note: this will overwrite the file at p_path if it already exists.
  57. Error store_string_at_path(const String &p_path, const String &p_data);
  58. // Implementation of EditorExportSaveFunction.
  59. // This method will only be called as an input to export_project_files.
  60. // It is used by the export_project_files method to save all the asset files into the gradle project.
  61. // It's functionality mirrors that of the method save_apk_file.
  62. // This method will be called ONLY when custom build is enabled.
  63. Error rename_and_store_file_in_gradle_project(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
  64. // Creates strings.xml files inside the gradle project for different locales.
  65. Error _create_project_name_strings_files(const Ref<EditorExportPreset> &p_preset, const String &project_name);
  66. String bool_to_string(bool v);
  67. String _get_gles_tag();
  68. String _get_screen_sizes_tag(const Ref<EditorExportPreset> &p_preset);
  69. String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset);
  70. String _get_instrumentation_tag(const Ref<EditorExportPreset> &p_preset);
  71. String _get_activity_tag(const Ref<EditorExportPreset> &p_preset);
  72. String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_storage_permission);
  73. #endif //GODOT_GRADLE_EXPORT_UTIL_H