Execute bash script before compiling and one-click deploy

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vetu11

I’m trying to streamline the process of compiling my game and I have a bash script that I want to run just before I compile the game.

It’s this possible with Godot as-is? If not, would create an EditorPlugin be the best way to achieve this?

As a workaround I may create a script that uses Godot Headless to compile, but this is only useful for production unless there is a way to deploy to Android with the debugger connected through the command line.

I am using a custom Android Build with plugins, if it’s useful.

:bust_in_silhouette: Reply From: vetu11

Editor plugins is the answer here. I finally solved it by creating an EditorPlugin with a EditorExportPlugin.

First, the method EditorPlugin.build() when running the game from the editor and when using one-click deploy for Android.

Second, EditorExportPlugin._export_begin() is called when exporting.

So using both methods to call the script is pretty simple and covers all the cases.