Skip to content

Commit

Permalink
Allow adding custom export platforms using scripts / GDExtension.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruvzg committed Apr 17, 2024
1 parent 4b7776e commit 03efc5e
Show file tree
Hide file tree
Showing 15 changed files with 1,206 additions and 1 deletion.
96 changes: 96 additions & 0 deletions doc/classes/EditorExportPlatform.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,107 @@
<link title="Console support in Godot">$DOCS_URL/tutorials/platform/consoles.html</link>
</tutorials>
<methods>
<method name="add_message">
<return type="void" />
<param index="0" name="type" type="int" enum="EditorExportPlatform.ExportMessageType" />
<param index="1" name="category" type="String" />
<param index="2" name="message" type="String" />
<description>
Adds a message to the export log that will be displayed when exporting ends.
</description>
</method>
<method name="clear_messages">
<return type="void" />
<description>
Clears the export log.
</description>
</method>
<method name="create_preset">
<return type="EditorExportPreset" />
<description>
Create new preset for this platform.
</description>
</method>
<method name="export_project_files">
<return type="int" enum="Error" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="debug" type="bool" />
<param index="2" name="save_cb" type="Callable" />
<param index="3" name="shared_cb" type="Callable" />
<description>
Exports project files for the specified preset. One of the callbacks is called for each exported file.
[param save_cb] is called for all exported files and have the following arguments: [code]file_path: String[/code], [code]file_data: PackedByteArray[/code], [code]file_index: int[/code], [code]file_count: int[/code], [code]encryption_include_filters: PackedStringArray[/code], [code]encryption_exclude_filters: PackedStringArray[/code], [code]encryption_key: PackedByteArray[/code].
[param shared_cb] is called for exported native shared/static libraries and have the following arguments: [code]file_path: String[/code], [code]tags: PackedStringArray[/code], [code]target_folder: String[/code].
</description>
</method>
<method name="get_forced_export_files" qualifiers="static">
<return type="PackedStringArray" />
<description>
Returned array of core file names that always should be exported regardless of preset config.
</description>
</method>
<method name="get_message_category" qualifiers="const">
<return type="String" />
<param index="0" name="index" type="int" />
<description>
Returns message category, for the message with [param index].
</description>
</method>
<method name="get_message_count" qualifiers="const">
<return type="int" />
<description>
Returns number of messages in the export log.
</description>
</method>
<method name="get_message_text" qualifiers="const">
<return type="String" />
<param index="0" name="index" type="int" />
<description>
Returns message text, for the message with [param index].
</description>
</method>
<method name="get_message_type" qualifiers="const">
<return type="int" enum="EditorExportPlatform.ExportMessageType" />
<param index="0" name="index" type="int" />
<description>
Returns message type, for the message with [param index].
</description>
</method>
<method name="get_os_name" qualifiers="const">
<return type="String" />
<description>
Returns the name of the export operating system handled by this [EditorExportPlatform] class, as a friendly string. Possible return values are [code]Windows[/code], [code]Linux[/code], [code]macOS[/code], [code]Android[/code], [code]iOS[/code], and [code]Web[/code].
</description>
</method>
<method name="get_worst_message_type" qualifiers="const">
<return type="int" enum="EditorExportPlatform.ExportMessageType" />
<description>
Returns most severe message type currently present in the export log.
</description>
</method>
</methods>
<constants>
<constant name="EXPORT_MESSAGE_NONE" value="0" enum="ExportMessageType">
Invalid message type used as the default value when no type is specified.
</constant>
<constant name="EXPORT_MESSAGE_INFO" value="1" enum="ExportMessageType">
Message type for informational messages that have no effect on the export.
</constant>
<constant name="EXPORT_MESSAGE_WARNING" value="2" enum="ExportMessageType">
Message type for warning messages that should be addressed but still allow to complete the export.
</constant>
<constant name="EXPORT_MESSAGE_ERROR" value="3" enum="ExportMessageType">
Message type for error messages that must be addressed and fail the export.
</constant>
<constant name="DEBUG_FLAG_DUMB_CLIENT" value="1" enum="DebugFlags">
</constant>
<constant name="DEBUG_FLAG_REMOTE_DEBUG" value="2" enum="DebugFlags">
</constant>
<constant name="DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST" value="4" enum="DebugFlags">
</constant>
<constant name="DEBUG_FLAG_VIEW_COLLISIONS" value="8" enum="DebugFlags">
</constant>
<constant name="DEBUG_FLAG_VIEW_NAVIGATION" value="16" enum="DebugFlags">
</constant>
</constants>
</class>
234 changes: 234 additions & 0 deletions doc/classes/EditorExportPlatformExtension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorExportPlatformExtension" inherits="EditorExportPlatform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="_can_export" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="debug" type="bool" />
<description>
[b]Optional.[/b]
Returns [code]true[/code], if specified [param preset] is valid and can be exported. Use [method set_config_error] and [method set_config_missing_templates] to set error details.
</description>
</method>
<method name="_cleanup" qualifiers="virtual">
<return type="void" />
<description>
[b]Optional.[/b]
Called by the editor before platform is unregistered.
</description>
</method>
<method name="_export_pack" qualifiers="virtual">
<return type="int" enum="Error" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="debug" type="bool" />
<param index="2" name="path" type="String" />
<param index="3" name="flags" type="int" />
<description>
[b]Required.[/b]
Creates a PCK archive at [param path] for the specified [param preset].
</description>
</method>
<method name="_export_project" qualifiers="virtual">
<return type="int" enum="Error" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="debug" type="bool" />
<param index="2" name="path" type="String" />
<param index="3" name="flags" type="int" />
<description>
[b]Required.[/b]
Creates a full project export at [param path] for the specified [param preset].
</description>
</method>
<method name="_export_zip" qualifiers="virtual">
<return type="int" enum="Error" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="debug" type="bool" />
<param index="2" name="path" type="String" />
<param index="3" name="flags" type="int" />
<description>
[b]Required.[/b]
Create a ZIP archive at [param path] for the specified [param preset].
</description>
</method>
<method name="_get_binary_extensions" qualifiers="virtual const">
<return type="PackedStringArray" />
<param index="0" name="preset" type="EditorExportPreset" />
<description>
[b]Required.[/b]
Returns array of supported binary extensions for the full project export.
</description>
</method>
<method name="_get_debug_protocol" qualifiers="virtual const">
<return type="String" />
<description>
[b]Optional.[/b]
Returns protocol used for remote debugging. Default implementation return [code]tcp://[/code].
</description>
</method>
<method name="_get_device_architecture" qualifiers="virtual const">
<return type="String" />
<param index="0" name="device" type="int" />
<description>
[b]Optional.[/b]
Returns device architecture for one-click deploy.
</description>
</method>
<method name="_get_export_option_visibility" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="option" type="String" />
<description>
[b]Optional.[/b]
Validates [param option] and returns visiblility for the specified [param preset]. Default implementation return [code]true[/code] for all options.

Check failure on line 88 in doc/classes/EditorExportPlatformExtension.xml

View workflow job for this annotation

GitHub Actions / 📊 Static checks / Code style, file formatting, and docs

visiblility ==> visibility
</description>
</method>
<method name="_get_export_option_warning" qualifiers="virtual const">
<return type="String" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="option" type="StringName" />
<description>
[b]Optional.[/b]
Validates [param option] and returns warning message for the specified [param preset]. Default implementation return empty string for all options.
</description>
</method>
<method name="_get_export_options" qualifiers="virtual const">
<return type="Dictionary[]" />
<description>
[b]Optional.[/b]
Returns a property list, as an [Array] of dictionaries. Each [Dictionary] must at least contain the [code]name[/code] and [code]type[/code] entries.
TODO full key-vallue list
</description>
</method>
<method name="_get_logo" qualifiers="virtual const">
<return type="Texture2D" />
<description>
</description>
</method>
<method name="_get_name" qualifiers="virtual const">
<return type="String" />
<description>
</description>
</method>
<method name="_get_option_icon" qualifiers="virtual const">
<return type="ImageTexture" />
<param index="0" name="device" type="int" />
<description>
</description>
</method>
<method name="_get_option_label" qualifiers="virtual const">
<return type="String" />
<param index="0" name="device" type="int" />
<description>
</description>
</method>
<method name="_get_option_tooltip" qualifiers="virtual const">
<return type="String" />
<param index="0" name="device" type="int" />
<description>
</description>
</method>
<method name="_get_options_count" qualifiers="virtual const">
<return type="int" />
<description>
</description>
</method>
<method name="_get_options_tooltip" qualifiers="virtual const">
<return type="String" />
<description>
</description>
</method>
<method name="_get_os_name" qualifiers="virtual const">
<return type="String" />
<description>
</description>
</method>
<method name="_get_platform_features" qualifiers="virtual const">
<return type="PackedStringArray" />
<description>
</description>
</method>
<method name="_get_preset_features" qualifiers="virtual const">
<return type="PackedStringArray" />
<param index="0" name="preset" type="EditorExportPreset" />
<description>
</description>
</method>
<method name="_get_run_icon" qualifiers="virtual const">
<return type="Texture2D" />
<description>
</description>
</method>
<method name="_has_valid_export_configuration" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="debug" type="bool" />
<description>
</description>
</method>
<method name="_has_valid_project_configuration" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="preset" type="EditorExportPreset" />
<description>
</description>
</method>
<method name="_is_executable" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="path" type="String" />
<description>
</description>
</method>
<method name="_poll_export" qualifiers="virtual">
<return type="bool" />
<description>
</description>
</method>
<method name="_resolve_platform_feature_priorities" qualifiers="virtual">
<return type="void" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="features" type="PackedStringArray" />
<description>
</description>
</method>
<method name="_run" qualifiers="virtual">
<return type="int" enum="Error" />
<param index="0" name="preset" type="EditorExportPreset" />
<param index="1" name="device" type="int" />
<param index="2" name="debug_flags" type="int" />
<description>
</description>
</method>
<method name="_should_update_export_options" qualifiers="virtual">
<return type="bool" />
<description>
</description>
</method>
<method name="get_config_error" qualifiers="const">
<return type="String" />
<description>
</description>
</method>
<method name="get_config_missing_templates" qualifiers="const">
<return type="bool" />
<description>
</description>
</method>
<method name="set_config_error">
<return type="void" />
<param index="0" name="error_text" type="String" />
<description>
</description>
</method>
<method name="set_config_missing_templates">
<return type="void" />
<param index="0" name="missing_templates" type="bool" />
<description>
</description>
</method>
</methods>
</class>

0 comments on commit 03efc5e

Please sign in to comment.