Home Download Buy Blog Forum Support

Switching builds - dialog

Switching builds - dialog

Postby vojtajina on Thu Aug 09, 2012 12:43 am

Very often, I have multiple build systems per project and "auto" does not work for me. I would rather have a command, that brings list of available build systems and I choose. (The last one would be selected as a default one).

First, is there a plugin for that ? I can't find one, so I decided to write one.

1/ How can I get list of available build systems ?
By view.settings() I only have access to "settings" part of the preferences.
So I currently have to have another list of build systems in "settings"...

2/ Is there an argument for "build" command to run specific system/cmd ?
I tried many, like "name", "id", "file", etc... none of them work, so I currently have to do:
Code: Select all
    win.run_command('set_build_system', {"file": selected_cmd})
    win.run_command('build')

Which is kinda lame and has side effect of changing selected build as well...

Thanks a lot for any help,

V.
vojtajina
 
Posts: 6
Joined: Tue Mar 13, 2012 8:27 am

Re: Switching builds - dialog

Postby bizoo on Thu Aug 09, 2012 9:13 am

vojtajina wrote:1/ How can I get list of available build systems ?

Don't think list of Build System is available.
You can parse Packages directory and search for .sublime-build files, but really not convenient solution.
vojtajina wrote:2/ Is there an argument for "build" command to run specific system/cmd ?

If you want to run a specific Build System (xxx.sublime-build), it must work with something like:
Code: Select all
    win.run_command('set_build_system', {"file": "Packages/Python/Python.sublime-build"})
    win.run_command('build')

If you want to run a system cmd, use directly exec command with parameters as the ones specified in a .sublime-build
bizoo
 
Posts: 870
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Switching builds - dialog

Postby vojtajina on Fri Aug 31, 2012 6:19 am

bizoo wrote:
vojtajina wrote:1/ How can I get list of available build systems ?

Don't think list of Build System is available.
You can parse Packages directory and search for .sublime-build files, but really not convenient solution.

Parsing `Packages/*` is not sufficient, as one can have build system defined in a project settings as well.

bizoo wrote:
vojtajina wrote:2/ Is there an argument for "build" command to run specific system/cmd ?

If you want to run a specific Build System (xxx.sublime-build), it must work with something like:
Code: Select all
    win.run_command('set_build_system', {"file": "Packages/Python/Python.sublime-build"})
    win.run_command('build')

If you want to run a system cmd, use directly exec command with parameters as the ones specified in a .sublime-build

Yep, that's exactly what I posted, but it has the side effect of changing selected build...

Anyway, here is what I did, it kinda does what I need:
https://github.com/vojtajina/sublime-BuildSwitcher
vojtajina
 
Posts: 6
Joined: Tue Mar 13, 2012 8:27 am

Re: Switching builds - dialog

Postby bizoo on Fri Aug 31, 2012 6:58 am

vojtajina wrote:Parsing `Packages/*` is not sufficient, as one can have build system defined in a project settings as well.

Yes, you're right.

vojtajina wrote:Yep, that's exactly what I posted, but it has the side effect of changing selected build...

Sorry, I though it wasn't working at all, didn't read your question carefully enough.

vojtajina wrote:Anyway, here is what I did, it kinda does what I need:
https://github.com/vojtajina/sublime-BuildSwitcher

Actually, I don't see the need for your plugin, but it's probably useful for some particular case that I never encountered.
Using the "selector" of Build System automatically trigger the right Build System and you can use the "variants" if you need more than one Build System for the same "selector".
If you really need something special for a project, you can add this Build System directly in the project.

To show the Command Palette with the available Build System (including the variants), I use this keybinding:
Code: Select all
{ "keys": ["ctrl+alt+shift+b"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Build: "} }
bizoo
 
Posts: 870
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 8 guests