Parcourir la source

added runci.Config.isCi()

Alexander Kuzmenko il y a 6 ans
Parent
commit
e2a70f92a7
2 fichiers modifiés avec 18 ajouts et 4 suppressions
  1. 4 0
      tests/runci/Config.hx
  2. 14 4
      tests/runci/targets/Php.hx

+ 4 - 0
tests/runci/Config.hx

@@ -28,4 +28,8 @@ class Config {
 			AppVeyor;
 		else
 			null;
+
+	static public function isCi():Bool {
+		return ci != null;
+	}
 }

+ 14 - 4
tests/runci/targets/Php.hx

@@ -31,17 +31,27 @@ class Php {
 	static public function run(args:Array<String>) {
 		getPhpDependencies();
 
-		var binDir = "bin/php";
+	var binDir = "bin/php";
 
-		for(prefix in [[], ['-D', 'php-prefix=haxe'], ['-D', 'php-prefix=my.pack']]) {
+		var prefixes = [[]];
+		if(isCi()) {
+			prefixes.push(['-D', 'php-prefix=haxe']);
+			prefixes.push(['-D', 'php-prefix=my.pack']);
+		}
+
+		for(prefix in prefixes) {
 			changeDirectory(unitDir);
-			deleteDirectoryRecursively(binDir);
+			if(isCi()) {
+				deleteDirectoryRecursively(binDir);
+			}
 
 			runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
 			runCommand("php", [binDir + "/index.php"]);
 
 			changeDirectory(sysDir);
-			deleteDirectoryRecursively(binDir);
+			if(isCi()) {
+				deleteDirectoryRecursively(binDir);
+			}
 			runCommand("haxe", ["compile-php.hxml"].concat(prefix));
 			runCommand("php", ["bin/php/Main/index.php"]);
 		}