Home Download Buy Blog Forum Support

Send arguments to build system

Send arguments to build system

Postby dutt on Sun Feb 03, 2013 9:07 am

I'm working on a little "run with arguments"-plugin but have run into a problem, I'm trying to figure out how to send named arguments to a build system. None of the ones I've looked at(C++, Makefile, Erlang, Haskell) have done anything like it. Is it possible or do I need to use the subprocess module?
dutt
 
Posts: 14
Joined: Sat Apr 28, 2012 10:09 am

Re: Send arguments to build system

Postby FichteFoll on Sun Feb 03, 2013 2:10 pm

http://docs.sublimetext.info/en/latest/ ... stems.html

Anything except "target", "selector" and "variants" in build systems is considered a named argument, afaik.

See https://github.com/FichteFoll/AAAPackag ... lime-build for example.
(And this is the build command.)
FichteFoll
 
Posts: 383
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Send arguments to build system

Postby dutt on Sun Feb 03, 2013 9:32 pm

That's the other way around, from build system to plugin.

An example, in my plugin I've got something like this:

Code: Select all
self.window.run_command("build", {"variant": "Run_args", "args" : text })


and I've edited the build system to add a new variant:

Code: Select all
{
   "name" : "Run_args",
   "cmd" : ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}' ${args}"]
}
dutt
 
Posts: 14
Joined: Sat Apr 28, 2012 10:09 am

Re: Send arguments to build system

Postby FichteFoll on Sun Feb 03, 2013 10:34 pm

So, you defined a build system. This build system has a variant. And now you want to run that variant from within a plugin?

By using "sublime.log_commands(True)" I found out that the command run is "build" with the parameter {"variant": "variant name"}.
FichteFoll
 
Posts: 383
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Send arguments to build system

Postby dutt on Thu Feb 07, 2013 10:54 am

Yes, but how do I specify what the variable args at the end of the command will contain? I tried that way and it was empty.
dutt
 
Posts: 14
Joined: Sat Apr 28, 2012 10:09 am

Re: Send arguments to build system

Postby FichteFoll on Thu Feb 07, 2013 10:16 pm

I feel like I know how to do what you want but I don't really understand it exactly.
FichteFoll
 
Posts: 383
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests