Sublime Forum

Build system question

#1

Hello!

I have a question regarding build system (.build-system) json format. Currently, cmd specifies an array of values, first value is command to execute, and rest are parameters passed to the first value.

How do I specify multiple commands? Basically what I want to achieve is to run a build system and then run a post-build script.

Thank you very much.
tt

0 Likes

#2

I believe the only way to do this is to set the main command as a .bat file or whatever the equivalent is for your OS, then make that run your post-build script :smile:

0 Likes

#3

Any idea what PATH Sublime Text uses?

Iā€™ve added locations to my system PATH but it still doesnā€™t find the cmd.

0 Likes

#4

Has your new PATH properly propagated to the system? You might need to log off and log back on from your account. If it works in a command processor window (DOS box), it should work in Sublime too.

0 Likes

#5

I have restarted since, and it works from the command line.

Can I print any details of the command environment from Sublime?

I am on Mac OS X btw.

0 Likes

#6

Python console (ctrl+`) > os.environā€™PATHā€™] if you want to doublecheck the env vars.

0 Likes

#7

Thanks, that python call did not work but I will do some readingā€¦

[quote]>>> os.environā€™PATHā€™]
Traceback (most recent call last):
File ā€œā€, line 1, in
NameError: name ā€˜osā€™ is not defined[/quote]

Also, in answer to the original poster, you can pass multiple parameters as follows:

{ "cmd": "app", "-param1", "-param2", "\"$file\""], "working_dir": "${project_path:${folder:${file_path}}}", "selector": "source.language" }
HTH,
matt

0 Likes

#8

[quote=ā€œjbrooksukā€]

I believe the only way to do this is to set the main command as a .bat file or whatever the equivalent is for your OS, then make that run your post-build script :smile:[/quote]

Ha, great suggestion, I should have thought of that, thanks.

0 Likes

#9

See my example above for a built-in way of sending multiple parameters: just list them individually between the command and the file.

0 Likes

#10

I am trying out Sublime and so far it is impressive. I did notice pretty quickly I wanted a way to pass dynamic arguments to the build command. For build systems like Ant, Gradle, and Maven that have a lot of tasks and switches having to enter a new build command into the build-systems configuration file wouldnā€™t be practical long term. What I am looking for is a way to execute a build through the command palette and enter what ever parameters I want there. It appears this isnā€™t supported at least through the documentation or what I have found so far on the Internet. Are there plans to support this? Is there a way to override the current implementation easily (less than a couple days) and implement it through a plugin?

Thanks,
Jas

I have put a request out on the UserEcho site. I missed the sticky topic before submitting :smile:.

0 Likes