Sublime Forum

ST3 build systems with variants in project

#1

I have been following the docs here docs.sublimetext.info/en/latest/ … stems.html

and managed to produce a build system that works well, from within my project. I tried to add a variant as described. I am finding that neither command-shift-B nor ctrl-shift-B execute the variant, as I expected.

I am on a Mac and the build system (with variant) is in my project file. Are variants not supported there? Should this work? Is it a bug?

The variant works fine when I make it a completely separate build system (in the project). I wanted to use a variant so I could easily switch between the two. (One compiles an app, the variant runs the app.)

0 Likes

#2

Variants must be displayed in the Command Palette, open it and type:

Build:

If the keybinding doesn’t work, it could be because another package steal it.
Open the console and type:

sublime.log_commands(True)

Execute the keybinding and look at the console if it’s the correct command that is executed.

0 Likes

#3

I’m having a somewhat similar issue. I am on Windows. Using latest ST3 build 3064. I’ve defined a build variant but Ctrl + Shift + B runs the main build exe, not the variant.

{ "selector": "source.js", "cmd": "D:\\Bundler1.bat"], "working_dir": "D:\\", "variants": { "name": "Bundler2", "cmd": "D:\\Bundler2.bat"], "working_dir": "D:\" }] }

Note the variant does show up in the command palette, but I’m trying to use the shortcut keys.

Ctrl + B => runs Bundler1.bat as expected
Ctrl + Shift + B => runs Bundler1.bat (not expected)

I’ve run

sublime.log_commands(True)
and it shows that it should be triggering the variant:

command: build {"variant": "Run"} Running D:\\Bundler1.bat

0 Likes

#4

I am getting the same issue on Win7x64 ST3 build 3065. The variant is not running. This used to work for me but I can’t recall what build. Obviously pre-3064.

{
	"cmd": "EncryptionTool.exe", "-e", "$file", "%USERPROFILE%/Desktop/Filter.xmle"],
	"path": "C:\PathToTool",
	"shell": true,

	"variants": 
		{
			"name": "To Thumb Drive",
			"cmd": "EncryptionTool.exe", "-e", "$file", "G:/Filter.xmle"],
			"path": "C:\PathToTool"
		}
	]
}

The console reports:

Running EncryptionTool.exe -e C:\SomePath\InputFile.xml %USERPROFILE%/Desktop/Filter.xmle
command: build {“variant”: “Run”}

[EDIT]: I also recall there being an additional menu item in the Tools menu to invoke the variant (if I’m not mistaken) but now it’s gone.

0 Likes