Ver código fonte

macroify all.hxml

Nicolas Cannasse 9 anos atrás
pai
commit
cf6d6d6c3f
2 arquivos alterados com 32 adições e 60 exclusões
  1. 31 0
      samples/All.hx
  2. 1 60
      samples/all.hxml

+ 31 - 0
samples/All.hx

@@ -0,0 +1,31 @@
+class All {
+	static function main() {
+		var cwd = Sys.getCwd();
+		var errored = [];
+		for( f in sys.FileSystem.readDirectory(".") ) {
+			if( !sys.FileSystem.isDirectory(f) )
+				continue;
+			var dir = cwd+"/"+f;
+			Sys.setCwd(dir);
+			for( d in sys.FileSystem.readDirectory(dir) ) {
+				if( !StringTools.endsWith(d,".hxml") ) continue;
+				var name = d.substr(0,-5);
+				if( f != name ) name = f+"/"+name;
+				var pass = false;
+				Sys.println(name);
+				try {
+					if( Sys.command("haxe "+d) == 0 ) pass = true;
+				} catch( e : Dynamic ) {
+					Sys.println(e);
+				}
+				if( !pass ) errored.push(name);
+			}
+			Sys.setCwd(cwd);
+		}
+		if( errored.length > 0 ) {
+			Sys.println(errored.length+" ERRORED : "+errored);
+			Sys.exit(1);
+		}
+		Sys.println("DONE");
+	}
+}

+ 1 - 60
samples/all.hxml

@@ -1,60 +1 @@
---macro Sys.println('2d')
---cwd 2d
-2d_swf.hxml
---next
-2d_swf.hxml
-
---next
---macro Sys.println('basic')
---cwd ../basic
-basic_swf.hxml
---next
-basic_wgl.hxml
-
---next
---macro Sys.println('bounds')
---cwd ../bounds
-bounds.hxml
-
---next
---macro Sys.println('col')
---cwd ../col
-col.hxml
-
---next
---macro Sys.println('comps')
---cwd ../comps
-comps.hxml
-
---next
---macro Sys.println('draw')
---cwd ../draw
-draw.hxml
-
---next
---macro Sys.println('lights')
---cwd ../lights
-lights.hxml
-
---next
---macro Sys.println('quat')
---cwd ../quat
-quat.hxml
-
---next
---macro Sys.println('sao')
---cwd ../sao
-sao.hxml
-
---next
---macro Sys.println('shadows')
---cwd ../shadows
-shadows.hxml
-
---next
---macro Sys.println('skin')
---cwd ../skin
-skin.hxml
-
---next
---macro Sys.println('done')
+--macro All.main()