浏览代码

port flash setup from 4.0

Simon Krajewski 6 年之前
父节点
当前提交
0674723b09
共有 1 个文件被更改,包括 28 次插入12 次删除
  1. 28 12
      tests/RunCi.hx

+ 28 - 12
tests/RunCi.hx

@@ -168,7 +168,13 @@ class RunCi {
 		Sys.setCwd(path);
 	}
 
-	static function setupFlashPlayerDebugger():Void {
+	static public function getLatestFPVersion():Array<Int> {
+		var appcast = Xml.parse(haxe.Http.requestUrl("http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pep.xml"));
+		var versionStr = new haxe.xml.Fast(appcast).node.XML.node.update.att.version;
+		return versionStr.split(",").map(Std.parseInt);
+	}
+
+	static public function setupFlashPlayerDebugger():Void {
 		var mmcfgPath = switch (systemName) {
 			case "Linux":
 				Sys.getEnv("HOME") + "/mm.cfg";
@@ -180,21 +186,31 @@ class RunCi {
 
 		switch (systemName) {
 			case "Linux":
-				requireAptPackages([
-					"libcurl3:i386", "libglib2.0-0:i386", "libx11-6:i386", "libxext6:i386",
-					"libxt6:i386", "libxcursor1:i386", "libnss3:i386", "libgtk2.0-0:i386"
-				]);
-				runCommand("wget", ["-nv", "http://fpdownload.macromedia.com/pub/flashplayer/updaters/25/flash_player_sa_linux_debug.x86_64.tar.gz"], true);
+				requireAptPackages(["libglib2.0", "libfreetype6"]);
+				var majorVersion = getLatestFPVersion()[0];
+				runCommand("wget", ["-nv", 'http://fpdownload.macromedia.com/pub/flashplayer/updaters/${majorVersion}/flash_player_sa_linux_debug.x86_64.tar.gz'], true);
 				runCommand("tar", ["-xf", "flash_player_sa_linux_debug.x86_64.tar.gz", "-C", Sys.getEnv("HOME")]);
-				File.saveContent(mmcfgPath, "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
+				if (!FileSystem.exists(mmcfgPath)) {
+					File.saveContent(mmcfgPath, "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
+				}
 				runCommand(Sys.getEnv("HOME") + "/flashplayerdebugger", ["-v"]);
 			case "Mac":
-				runCommand("brew", ["tap", "caskroom/versions"]);
+				if (commandResult("brew", ["cask", "list", "flash-player-debugger"]).exitCode == 0) {
+					return;
+				}
 				runCommand("brew", ["cask", "install", "flash-player-debugger"]);
+
+				// Disable the "application downloaded from Internet" warning
+				runCommand("xattr", ["-d", "-r", "com.apple.quarantine", "/Applications/Flash Player Debugger.app"]);
+
 				var dir = Path.directory(mmcfgPath);
-				runCommand("sudo", ["mkdir", "-p", dir]);
-				runCommand("sudo", ["chmod", "a+w", dir]);
-				File.saveContent(mmcfgPath, "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
+				if (!FileSystem.exists(dir)) {
+					runCommand("sudo", ["mkdir", "-p", dir]);
+					runCommand("sudo", ["chmod", "a+w", dir]);
+				}
+				if (!FileSystem.exists(mmcfgPath)) {
+					File.saveContent(mmcfgPath, "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
+				}
 		}
 	}
 
@@ -720,7 +736,7 @@ class RunCi {
 
 	static function isDeployApiDocsRequired () {
 		return
-			Sys.getEnv("DEPLOY_API_DOCS") != null && 
+			Sys.getEnv("DEPLOY_API_DOCS") != null &&
 			switch(Sys.getEnv("TRAVIS_TAG")) {
 				case null, _.trim() => "":
 					false;