FBuilder a tool to help working with multiple targets

19.03.2014 1813 0

Screenshot

Project XML file

A simple project file looks like that :

<!--<fbuilder always-on-top="false" taskbar="true" stick-edge="50">-->
<fbuilder>
	<target name="hss" color="#FFFF00"><![CDATA[
		execute( "hss.exe", [ "-output", "www/css/", "src/hss/default.hss" ] );
	]]></target>
	<target name="templo" color="#00FF00"><![CDATA[
		var err	= "";
		var out	= "";
		for( i in [ "login", "shell", "news", "media", "album", "picture", "live" ] ){
			var p	= new sys.io.Process( "temploc2.exe", [ i + ".mtt", "-cp", "src/mtt", "-output", "www/tpl", "-macros", "macro.mtt" ] );
			out	+= p.stdout.readAll().toString();
			err	+= p.stderr.readAll().toString();
		}
		{ out : out, err : err }
	]]></target>
	<target name="neko" color="#FF0000"><![CDATA[
		execute( "haxe", [ "neko.hxml" ] );
	]]></target>
	<target name="js" color="#0000FF"><![CDATA[
		execute( "haxe", [ "js.hxml" ] );
	]]></target>
	<target name="notepad" color="#FF00FF"><![CDATA[
		command( "c:/Windows/notepad.exe", [] );
	]]></target>
	<target name="test" color="#FFFFFF"><![CDATA[
		"The last line in the script is the console output ! :)";
	]]></target>
	<target name="test2" color="#999999"><![CDATA[
		var rd	= sys.FileSystem.readDirectory( "." );
		var a	= [];
		for( i in rd ){
			if( StringTools.endsWith( i, ".log" ) ){
				sys.io.File.copy( i, "_old_" + i );
				a.push( i );
			}
		}
		a;
	]]></target>
</fbuilder>

You can define special attributes as seen at the top of the xml in the commented node if you don't want the tool to be always on the top of the screen for example and then...

Scripting

Inside the CData node, you write your hscript that will be executed once the button clicked.
These things are available in the HScript context :

  • StringTools
  • Sys
  • sys.FileSystem
  • sys.io.File
  • sys.io.Process

And 3 shortcut functions :

process( cmd : String, args : Array<String> ) : { out : String, err : String }
execute( cmd : String, args : Array<String> ) : { out : String, err : String }
command( cmd : String, args : Array<String>, keepPrompt = false ) : Void

The "process" and "execute" functions are the same. They run a background process and display stdout & stderr.
The "command" function launches a program in a separated Thread with or without the prompt. It was not done for that at the begining but it can help anyway

Download

You can download the source and the Windows' executable here.
I've built it on Windows but it can run on Mac or linux without Windows' linked systools (tray icon).

Building from sources

You'll need to modify a bit the SWHX, Systools and HScript libs to make it compiling right for Haxe 3.
If you have some problems don't hesitate to ask.

Hope that helps !

Commentaires

Laisser un commentaire

http://
×