Browse Source

added vscode/hashlink debug generation

ncannasse 7 years ago
parent
commit
2ccd6bbbef
3 changed files with 55 additions and 2 deletions
  1. 14 2
      samples/Generator.hx
  2. 16 0
      samples/templates/.vscode/launch.json
  3. 25 0
      samples/templates/.vscode/tasks.json

+ 14 - 2
samples/Generator.hx

@@ -37,8 +37,17 @@ class Generator {
 	static function generateProjects() {
 
 		var templates = [];
-		for( f in sys.FileSystem.readDirectory("templates") )
-			templates.push({ file : f, data : sys.io.File.getContent("templates/" + f) });
+		function getRec(path) {			
+			for( f in sys.FileSystem.readDirectory(path) ) {
+				var file = path+"/"+f;
+				if( sys.FileSystem.isDirectory(file) ) {
+					getRec(file);
+					continue;
+				}
+				templates.push({ file : file.substr(10), data : sys.io.File.getContent(file) });
+			}
+		}
+		getRec("templates");
 
 		try sys.FileSystem.createDirectory("build") catch( e : Dynamic ) {};
 		sys.io.File.saveContent("build/README.txt","This directory is automatically generated by samples/Script.hx using samples/templates");
@@ -86,6 +95,9 @@ class Generator {
 					return "" + interp.execute(expr);
 				});
 				var file = t.file.split("__name").join(name);
+				var dir = file.split("/");
+				dir.pop();
+				try sys.FileSystem.createDirectory("build/" + name + "/" + dir.join("/")) catch( e : Dynamic ) {};
 				sys.io.File.saveContent("build/" + name + "/" + file, data);
 			}
 		}

+ 16 - 0
samples/templates/.vscode/launch.json

@@ -0,0 +1,16 @@
+{
+	// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
+	// Pointez pour afficher la description des attributs existants.
+	// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
+	"version": "0.2.0",
+	"configurations": [
+		{
+			"name": "HashLink",
+			"request": "launch",
+			"type": "hl",
+			"hxml": "::name::_hl.hxml",
+			"cwd": "${workspaceRoot}",
+			"preLaunchTask": "Build"
+		}
+	]
+}

+ 25 - 0
samples/templates/.vscode/tasks.json

@@ -0,0 +1,25 @@
+{
+	// See https://go.microsoft.com/fwlink/?LinkId=733558
+	// for the documentation about the tasks.json format
+	"version": "2.0.0",
+	"tasks": [
+		{
+			"type": "hxml",
+			"label": "Build",
+			"file": "::name::_hl.hxml",
+			"problemMatcher": [
+				"$haxe-absolute",
+				"$haxe",
+				"$haxe-error",
+				"$haxe-trace"
+			],
+			"presentation": {
+				"reveal": "never"
+			},
+			"group": {
+				"kind": "build",
+				"isDefault": true
+			}
+		}
+	]
+}