Browse Source

Lua: Travis tweaks

Justin Donaldson 9 years ago
parent
commit
8fc445f9fd
1 changed files with 17 additions and 3 deletions
  1. 17 3
      tests/RunCi.hx

+ 17 - 3
tests/RunCi.hx

@@ -438,21 +438,33 @@ class RunCi {
 
 	static function getLuaDependencies(jit = false, lua_version = "lua5.2", luarocks_version = "2.3.0") {
 		var home_dir = Sys.getEnv("HOME");
+
 		// the lua paths created by the setup script.
 		addToPATH('$home_dir/.lua');
 		addToPATH('$home_dir/.local/bin');
 
+		// we need to cd back into the build directory to do some work
 		var build_dir = Sys.getEnv("TRAVIS_BUILD_DIR");
 		changeDirectory(build_dir);
+
+		// luarocks needs to be in the path
 		addToPATH('$build_dir/install/luarocks/bin');
 
-		var luarocks_path_additions = commandResult("luarocks", ["path"]);
-		addToPATH(luarocks_path_additions.stdout.trim());
+
+		// we did user land installs of luarocks and lua.  We need to point lua
+		// to the luarocks install using the luarocks path and env variables
+		var lua_path = commandResult("luarocks", ["path", "--lr-path"]).stdout.trim();
+		Sys.putEnv("LUA_PATH", lua_path);
+
+		// step two of the variable setting
+		var lua_cpath = commandResult("luarocks", ["path", "--lr-cpath"]).stdout.trim();
+		Sys.putEnv("LUA_CPATH", lua_cpath);
 
 		if (jit) Sys.putEnv("LUAJIT","yes");
 		Sys.putEnv("LUAROCKS", luarocks_version);
 		Sys.putEnv("LUA", lua_version);
-		// use the helper scripts in .travis
+
+		// use the helper scripts in .travis. TODO: Refactor as pure haxe?
 		runCommand("sh", ['${build_dir}/.travis/setenv_lua.sh']);
 		if (jit){
 			runCommand("luajit", ["-v"]);
@@ -462,6 +474,8 @@ class RunCi {
 		runCommand("pip", ["install", "--user", "cpp-coveralls"]);
 		runCommand("luarocks", ["install", "lrexlib-pcre", "2.7.2-1", "--server=https://luarocks.org/dev"]);
 		runCommand("luarocks", ["install", "luautf8", "--server=https://luarocks.org/dev"]);
+
+		// change back to the unit dir for the rest of the tests
 		changeDirectory(unitDir);
 	}