diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-12-10 18:59:09 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-07-12 16:25:04 +0300 |
commit | 7b7f6d45d6ea3528a9d094ff0ac41d14cc324cd3 (patch) | |
tree | f08ab32835536bea6b9c3279e341795dc2a789f5 /platform/ios/export/export_plugin.h | |
parent | d676246647b848dbe341f83676eab087864a6c74 (diff) | |
download | redot-engine-7b7f6d45d6ea3528a9d094ff0ac41d14cc324cd3.tar.gz |
Implement iOS one-click deploy.
Diffstat (limited to 'platform/ios/export/export_plugin.h')
-rw-r--r-- | platform/ios/export/export_plugin.h | 97 |
1 files changed, 37 insertions, 60 deletions
diff --git a/platform/ios/export/export_plugin.h b/platform/ios/export/export_plugin.h index 6616bbd714..a780669f18 100644 --- a/platform/ios/export/export_plugin.h +++ b/platform/ios/export/export_plugin.h @@ -58,15 +58,30 @@ class EditorExportPlatformIOS : public EditorExportPlatform { GDCLASS(EditorExportPlatformIOS, EditorExportPlatform); Ref<ImageTexture> logo; + Ref<ImageTexture> run_icon; // Plugins mutable SafeFlag plugins_changed; -#ifndef ANDROID_ENABLED + SafeFlag devices_changed; + + struct Device { + String id; + String name; + bool simulator = false; + bool wifi = false; + }; + + Vector<Device> devices; + Mutex device_lock; + + Mutex plugins_lock; + mutable Vector<PluginConfigIOS> plugins; +#ifdef MACOS_ENABLED Thread check_for_changes_thread; SafeFlag quit_request; + + static void _check_for_changes_poll_thread(void *ud); #endif - Mutex plugins_lock; - mutable Vector<PluginConfigIOS> plugins; typedef Error (*FileHandler)(String p_file, void *p_userdata); static Error _walk_dir_recursive(Ref<DirAccess> &p_da, FileHandler p_handler, void *p_userdata); @@ -122,64 +137,9 @@ class EditorExportPlatformIOS : public EditorExportPlatform { Error _export_additional_assets(const String &p_out_dir, const Vector<SharedObject> &p_libraries, Vector<IOSExportAsset> &r_exported_assets); Error _export_ios_plugins(const Ref<EditorExportPreset> &p_preset, IOSConfigData &p_config_data, const String &dest_dir, Vector<IOSExportAsset> &r_exported_assets, bool p_debug); - bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const { - String pname = p_package; - - if (pname.length() == 0) { - if (r_error) { - *r_error = TTR("Identifier is missing."); - } - return false; - } - - for (int i = 0; i < pname.length(); i++) { - char32_t c = pname[i]; - if (!(is_ascii_alphanumeric_char(c) || c == '-' || c == '.')) { - if (r_error) { - *r_error = vformat(TTR("The character '%s' is not allowed in Identifier."), String::chr(c)); - } - return false; - } - } - - return true; - } + Error _export_project_helper(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags, bool p_simulator, bool p_skip_ipa); -#ifndef ANDROID_ENABLED - static void _check_for_changes_poll_thread(void *ud) { - EditorExportPlatformIOS *ea = static_cast<EditorExportPlatformIOS *>(ud); - - while (!ea->quit_request.is_set()) { - // Nothing to do if we already know the plugins have changed. - if (!ea->plugins_changed.is_set()) { - MutexLock lock(ea->plugins_lock); - - Vector<PluginConfigIOS> loaded_plugins = get_plugins(); - - if (ea->plugins.size() != loaded_plugins.size()) { - ea->plugins_changed.set(); - } else { - for (int i = 0; i < ea->plugins.size(); i++) { - if (ea->plugins[i].name != loaded_plugins[i].name || ea->plugins[i].last_updated != loaded_plugins[i].last_updated) { - ea->plugins_changed.set(); - break; - } - } - } - } - - uint64_t wait = 3000000; - uint64_t time = OS::get_singleton()->get_ticks_usec(); - while (OS::get_singleton()->get_ticks_usec() - time < wait) { - OS::get_singleton()->delay_usec(300000); - - if (ea->quit_request.is_set()) { - break; - } - } - } - } -#endif + bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const; protected: virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override; @@ -191,6 +151,23 @@ public: virtual String get_name() const override { return "iOS"; } virtual String get_os_name() const override { return "iOS"; } virtual Ref<Texture2D> get_logo() const override { return logo; } + virtual Ref<Texture2D> get_run_icon() const override { return run_icon; } + + virtual int get_options_count() const override; + virtual String get_options_tooltip() const override; + virtual Ref<ImageTexture> get_option_icon(int p_index) const override; + virtual String get_option_label(int p_index) const override; + virtual String get_option_tooltip(int p_index) const override; + virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) override; + + virtual bool poll_export() override { + bool dc = devices_changed.is_set(); + if (dc) { + // don't clear unless we're reporting true, to avoid race + devices_changed.clear(); + } + return dc; + } virtual bool should_update_export_options() override { bool export_options_changed = plugins_changed.is_set(); |