Преглед изворни кода

[lua] show debug message if lua library exists

Justin Donaldson пре 7 година
родитељ
комит
1a764d0684
2 измењених фајлова са 74 додато и 0 уклоњено
  1. 72 0
      tests/;
  2. 2 0
      tests/runci/targets/Lua.hx

+ 72 - 0
tests/;

@@ -0,0 +1,72 @@
+package runci.targets;
+
+import sys.FileSystem;
+import runci.System.*;
+import runci.Config.*;
+using StringTools;
+
+class Lua {
+	static public function getLuaDependencies(){
+		switch (systemName){
+			case "Linux":
+				Linux.requireAptPackages(["libpcre3-dev"]);
+				runCommand("pip", ["install", "--user", "hererocks"]);
+			case "Mac": {
+				if (commandSucceed("python3", ["-V"]))
+					infoMsg('python3 has already been installed.');
+				else
+					runCommand("brew", ["install", "python3"], true);
+
+				runCommand("brew", ["install", "pcre"], false, true);
+				runCommand("pip3", ["install", "hererocks"]);
+			}
+		}
+	}
+
+	static function installLib(lib : String, version : String, server = "https://luarocks.org/dev"){
+		var server_arg = '--server=$server';
+		if (!commandSucceed("luarocks", ["show", lib, version])) {
+			runCommand("luarocks", ["install",lib, version, server_arg]);
+		} else {
+			infoMsg('Lua dependency $lib is already installed at version $version');
+		}
+	}
+
+	static public function installLuaVersionDependencies(lv:String){
+		if (lv == "-l5.1") installLib("luabitop", "1.0.2-3");
+
+		installLib("lrexlib-pcre" , "2.8.0-1");
+		installLib("luv"          , "1.22.0-1");
+		installLib("luasocket"    , "3.0rc1-2");
+		installLib("luautf8"      , "0.1.1-1");
+
+	}
+
+	static public function run(args:Array<String>) {
+		getLuaDependencies();
+		var envpath = Sys.getEnv("HOME") + '/lua_env';
+		addToPATH(envpath + '/bin');
+		for (lv in ["-l5.1", "-l5.2", "-l5.3", "-j2.0", "-j2.1" ]){
+			if (systemName == "Mac" && lv.startsWith("-j")) continue;
+			Sys.println('--------------------');
+			Sys.println('Lua Version: $lv');
+			runCommand("hererocks", [envpath, lv, "-rlatest", "-i"]);
+			trace('path: ' + Sys.getEnv("PATH"));
+			runCommand("lua",["-v"]);
+			runCommand("luarocks",[]);
+			installLuaVersionDependencies(lv);
+
+			changeDirectory(unitDir);
+			runCommand("haxe", ["compile-lua.hxml"].concat(args));
+			runCommand("lua", ["bin/unit.lua"]);
+
+			changeDirectory(sysDir);
+			haxelibInstall("utest");
+			runCommand("haxe", ["compile-lua.hxml"].concat(args));
+			runCommand("lua", ["bin/lua/sys.lua"]);
+
+			changeDirectory(miscDir + "luaDeadCode/stringReflection");
+			runCommand("haxe", ["compile.hxml"]);
+		}
+	}
+}

+ 2 - 0
tests/runci/targets/Lua.hx

@@ -27,6 +27,8 @@ class Lua {
 		var server_arg = '--server=$server';
 		if (!commandSucceed("luarocks", ["show", lib, version])) {
 			runCommand("luarocks", ["install",lib, version, server_arg]);
+		} else {
+			infoMsg('Lua dependency $lib is already installed at version $version');
 		}
 	}