Sublime Forum

Need to know current active build system


I have 2 sublime-build files : DVL.sublime-build and PRD.sublime-build, neatly shown on the ST4 menu. I use the DVL build constantly and PRD only when I move stuf to production. I build directly into the production environment (that is the way we work here, nothing I can do about that).

I have to switch between DVL and PRD options using the menus (this is a simplified example, I have too many build configurations to use hotkeys to switch). Sometimes I think I am building for DVL but in fact I am building and deploying straight into PRD.

It would be really great if there is a way to query the current active build system in ST4. I could then bring up a yes_no_cancel dialog for the PRD build with “Are you sure?” warning.

Another solution is to have the current build system displayed on the ST4 status bar, so I can see at a glance which build system is currently active.



you could write a plugin with an event listener for the build/set_build_system command, and track which build system/variant was last used (by reading which arguments it ran with - try sublime.log_commands(True) Enter in the ST console (View menu -> Show Console) and then select a Build system from the Tools menu), and based on that, update the status bar etc. You may also want to persist it to disk to track across ST restarts or read the ST session when the plugin loads to determine the current build system in use, as unfortunately I believe there is no API for retrieving it.

Or you could use zenity etc. as part of your PRD build system to show a dialog with a warning.
Or you could update your build system to call another ST command which could do the prompting.