| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*  gradle_export_util.h                                                 */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*                       This file is part of:                           */ | 
					
						
							|  |  |  | /*                           GODOT ENGINE                                */ | 
					
						
							|  |  |  | /*                      https://godotengine.org                          */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							| 
									
										
										
										
											2021-01-01 20:13:46 +01:00
										 |  |  | /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */ | 
					
						
							|  |  |  | /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */ | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the       */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including   */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,   */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to    */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to */ | 
					
						
							|  |  |  | /* the following conditions:                                             */ | 
					
						
							|  |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be        */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.       */ | 
					
						
							|  |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef GODOT_GRADLE_EXPORT_UTIL_H
 | 
					
						
							|  |  |  | #define GODOT_GRADLE_EXPORT_UTIL_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-11 14:51:48 +02:00
										 |  |  | #include "core/io/dir_access.h"
 | 
					
						
							|  |  |  | #include "core/io/file_access.h"
 | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | #include "core/io/zip_io.h"
 | 
					
						
							|  |  |  | #include "core/os/os.h"
 | 
					
						
							|  |  |  | #include "editor/editor_export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 13:02:59 -04:00
										 |  |  | const String godot_project_name_xml_string = R"(<?xml version="1.0" encoding="utf-8"?> | 
					
						
							|  |  |  | <!--WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> | 
					
						
							|  |  |  | <resources> | 
					
						
							|  |  |  | 	<string name="godot_project_name_string">%s</string> | 
					
						
							|  |  |  | </resources> | 
					
						
							|  |  |  | )"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | int _get_android_orientation_value(DisplayServer::ScreenOrientation screen_orientation); | 
					
						
							| 
									
										
										
										
											2020-11-13 11:48:21 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | String _get_android_orientation_label(DisplayServer::ScreenOrientation screen_orientation); | 
					
						
							| 
									
										
										
										
											2020-11-13 11:48:21 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | // Utility method used to create a directory.
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | Error create_directory(const String &p_dir); | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Writes p_data into a file at p_path, creating directories if necessary.
 | 
					
						
							|  |  |  | // Note: this will overwrite the file at p_path if it already exists.
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | Error store_file_at_path(const String &p_path, const Vector<uint8_t> &p_data); | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Writes string p_data into a file at p_path, creating directories if necessary.
 | 
					
						
							|  |  |  | // Note: this will overwrite the file at p_path if it already exists.
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | Error store_string_at_path(const String &p_path, const String &p_data); | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Implementation of EditorExportSaveFunction.
 | 
					
						
							|  |  |  | // This method will only be called as an input to export_project_files.
 | 
					
						
							|  |  |  | // It is used by the export_project_files method to save all the asset files into the gradle project.
 | 
					
						
							|  |  |  | // It's functionality mirrors that of the method save_apk_file.
 | 
					
						
							|  |  |  | // This method will be called ONLY when custom build is enabled.
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | 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); | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 13:02:59 -04:00
										 |  |  | // Creates strings.xml files inside the gradle project for different locales.
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | Error _create_project_name_strings_files(const Ref<EditorExportPreset> &p_preset, const String &project_name); | 
					
						
							| 
									
										
										
										
											2020-07-15 13:02:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | String bool_to_string(bool v); | 
					
						
							| 
									
										
										
										
											2020-07-15 13:02:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | String _get_gles_tag(); | 
					
						
							| 
									
										
										
										
											2020-07-23 12:16:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | String _get_screen_sizes_tag(const Ref<EditorExportPreset> &p_preset); | 
					
						
							| 
									
										
										
										
											2020-07-23 12:16:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset); | 
					
						
							| 
									
										
										
										
											2020-07-23 12:16:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | String _get_instrumentation_tag(const Ref<EditorExportPreset> &p_preset); | 
					
						
							| 
									
										
										
										
											2020-07-23 12:16:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 23:30:53 +03:00
										 |  |  | String _get_activity_tag(const Ref<EditorExportPreset> &p_preset); | 
					
						
							| 
									
										
										
										
											2020-07-23 12:16:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-10 18:39:31 -07:00
										 |  |  | String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_storage_permission); | 
					
						
							| 
									
										
										
										
											2020-07-23 12:16:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-08 10:36:00 -04:00
										 |  |  | #endif //GODOT_GRADLE_EXPORT_UTIL_H
 |