Possible improvement: run code after building

There are some tasks I like to do automatically after building, but currently this is only available on Windows, through FlashDevelop.

There’s no reason Lime can’t run a command of your choice after building, we just need to figure out how it should work.

My suggestion is to use Sys.command(). So if you typed <postBuild command="echo Hello world" />, then Lime would call Sys.command("echo", ["Hello", "world"]);.

For more examples, see the issue I opened:

Thoughts?

What if I want to pass '‘Hello World’ as single argument instead of [“Hello”, “world”] ? And what about prebuild?

Added <preBuild /> to the issue description.

As for single arguments, what should the syntax be?

<!-- escaped spaces -->
<postBuild command="echo Hello\ world" />

<!-- quotes -->
<postBuild command="echo 'Hello world'" />
<postBuild command='echo "Hello world"' />

<!-- special attributes -->
<postBuild command="echo" arg0="Hello world" arg1="and so on" />

I like last variant:
<postBuild command="echo" arg0="Hello world" arg1="and so on" />

or maybe something like:

<postBuild cmd="echo">
    <arg>Hello world</arg>
    <arg>and so on</arg>
</postBuild>
1 Like

I like options with nested elements. But for simple call Sys.comand("echo", ["Hello world"]) it could be just <postBuild cmd="echo" args="Hello world"/> , like <assets> which currently supports both nested elements and single line.

haxeflag, haxedef, but postBuild . May be postbuild ?

I like it!

I think I prefer <postBuild cmd="echo Hello world" />, because that’s how you’d type it into the command line. (And I’d be happy to allow cmd as an alternative to command.)

Good point. I’ll update the issue.

Bumping the thread because I finally got around to implementing it. How’s this look?