Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin is included in exported projects #77

Open
noidexe opened this issue Sep 9, 2021 · 7 comments
Open

Plugin is included in exported projects #77

noidexe opened this issue Sep 9, 2021 · 7 comments

Comments

@noidexe
Copy link

noidexe commented Sep 9, 2021

After adding the plugin on windows, linux export start failing saying the templates where corrupted. Checking the error log it seems the editor was looking for the .so libraries for this plugin.

I guess I can workaround that by also adding those files to my project even if I'm not working on linux but I wouldn't want an increased pck size due to some plugin that's only used by the editor.

@twaritwaikar
Copy link
Contributor

twaritwaikar commented Sep 9, 2021

This is currently a known issue with Godot's GDNative export process. Some GDNative plugins (mostly it seems to be just this plugin) seem to be exported even though they are explicitly added as tool GDNative scripts i.e. marked as editor-only.

You can track this issue and find some workarounds here: godotengine/godot#44213

@twaritwaikar
Copy link
Contributor

twaritwaikar commented Sep 9, 2021

Also, I will keep this issue open till this gets fixed so that this problem is still visible to newer people who encounter this issue

@grantsadie
Copy link

Has this issue been fixed yet? Still having issues 2 years later

@Calinou Calinou changed the title Does the plugin get included in exported builds? Plugin is included in exported projects Dec 15, 2023
@monxa
Copy link

monxa commented Jul 7, 2024

As a workaround, I simply created a godot-git-plugin.gd (which is already defined in plugin.cfg) where I load this custom EditorExportPlugin:

editor-export-plugin.gd:

@tool
extends EditorExportPlugin

const PATH_EXTENSION_DEF = "res://.godot/extension_list.cfg"

var extension_definition_buffer : String

func _export_begin(features: PackedStringArray, is_debug: bool, path: String, flags: int) -> void:
	var file_extension_list := FileAccess.open(PATH_EXTENSION_DEF, FileAccess.READ)
	var extensions : String = file_extension_list.get_as_text()
	file_extension_list.close()

	extension_definition_buffer = extensions
	var lines : PackedStringArray = extensions.split("\n")
	var extensions_without_git : String = ""
	for line in lines:
		if "git_plugin.gdextension" in line:
			continue
		extensions_without_git += line + "\n"
	extensions_without_git = extensions_without_git.trim_suffix("\n")

	file_extension_list = FileAccess.open(PATH_EXTENSION_DEF, FileAccess.WRITE)
	file_extension_list.store_string(extensions_without_git)
	file_extension_list.close()

func _export_file(path: String, type: String, features: PackedStringArray) -> void:
	if "godot-git-plugin" in path:
		skip()

func _export_end() -> void:
	var file_extension_list := FileAccess.open(PATH_EXTENSION_DEF, FileAccess.WRITE)
	file_extension_list.store_string(extension_definition_buffer)
	file_extension_list.close()

func _get_name() -> String:
	return "ZZ-git-export-plugin"

godot-git-plugin.gd:

@tool
extends EditorPlugin

var export_plugin = preload("editor-export-plugin.gd").new()

func _enter_tree() -> void:
	add_export_plugin(export_plugin)

func _exit_tree() -> void:
	remove_export_plugin(export_plugin)

Then I simply enabled the gdscript plugin -> ProjectSettings/Plugins/Godot\ Git\ Plugin.
Enjoy!

Edit: Both files are placed in addons/godot-git-plugin. This solution both excludes all git-plugin files from being exported and prunes godot-git entries from res://.godot/extension_list.cfg for the duration the export takes place. The solution below did not capture this, so it is unfortunately not that simple.

Edit2: This might be solved now! @vedit s naive solution might now work, since @markeel s pr essentially generalized this at godot/master for all exports. It has just been merged!

@vedit
Copy link

vedit commented Jul 26, 2024

All you need to do is to exclude it from the path

image

@noidexe
Copy link
Author

noidexe commented Aug 1, 2024

All you need to do is to exclude it from the path

I guess this just makes the export fail to find the plugin definition file and disable it on export. It's nice to have it as a workaround but probably not the best UX. Editor-only plugins are a clear use case so it's not really a per-export setting decided by the end user, nor is excluding the contents of a folder a good approach in terms of discoverability.

@markeel
Copy link
Contributor

markeel commented Sep 24, 2024

The consequence of excluding the plugin is an error during startup of the exported project.
See Godot engine issue godotengine/godot#97207.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants