diff --git a/appveyor.yml b/appveyor.yml index 46753b9be..7ec6d880b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,7 @@ services: - mysql install: + - git submodule update --init --recursive - ps: Set-Service wuauserv -StartupType Manual - cinst haxe -y - cinst nssm -y diff --git a/ci.hxml b/ci.hxml index 42c091d47..56ba9f250 100644 --- a/ci.hxml +++ b/ci.hxml @@ -1,2 +1,4 @@ -cp test --x RunCi +-main RunCi +-neko bin/ci.n +-cmd neko bin/ci.n diff --git a/run.n b/run.n index 3293c6fff..4e353fa89 100644 Binary files a/run.n and b/run.n differ diff --git a/src/Package.hx b/src/Package.hx index 3fdd2d190..5f2e442b7 100644 --- a/src/Package.hx +++ b/src/Package.hx @@ -15,7 +15,16 @@ class Package { static function main() { checkVersion(); + switch Sys.systemName() { + case 'Windows': + zipWindows(); + case _: + var exitCode = Sys.command('zip', ['-r', outPath, 'src/haxelib', 'haxelib.json', 'run.n', 'README.md']); + Sys.exit(exitCode); + } + } + static function zipWindows() { var entries = new List(); function add(path:String, ?target:String) { diff --git a/src/haxelib/Data.hx b/src/haxelib/Data.hx index ee922f61c..b5d696bb8 100644 --- a/src/haxelib/Data.hx +++ b/src/haxelib/Data.hx @@ -58,6 +58,22 @@ typedef ProjectInfos = { var tags : List; } +@:enum abstract CheckLevel(Int) { + var NoCheck = 0; + var CheckSyntax = 1; + var CheckData = 2; + + @:from static inline function fromBool(check:Bool):CheckLevel { + return check ? CheckData : NoCheck; + } + + @:op(A > B) function gt(b:CheckLevel):Bool; + @:op(A >= B) function gte(b:CheckLevel):Bool; + @:op(A == B) function eq(b:CheckLevel):Bool; + @:op(A <= B) function lte(b:CheckLevel):Bool; + @:op(A < B) function lt(b:CheckLevel):Bool; +} + abstract DependencyVersion(String) to String from SemVer { inline function new(s:String) this = s; @@ -298,7 +314,7 @@ class Data { } - public static function readInfos( zip : List, check : Bool ) : Infos + public static function readInfos( zip : List, check : CheckLevel ) : Infos return readData(Reader.unzip(getJson(zip)).toString(), check); public static function checkClassPath( zip : List, infos : Infos ) { @@ -314,11 +330,11 @@ class Data { } } - public static function readData( jsondata: String, check : Bool ) : Infos { + public static function readData( jsondata: String, check : CheckLevel ) : Infos { var doc:Infos = try Json.parse(jsondata) catch ( e : Dynamic ) - if (check) + if (check >= CheckLevel.CheckSyntax) throw 'JSON parse error: $e'; else { name : ProjectName.DEFAULT, @@ -330,7 +346,7 @@ class Data { contributors: [], } - if (check) + if (check >= CheckLevel.CheckData) Validator.validate(doc); else { if (!doc.version.valid) diff --git a/src/haxelib/client/Main.hx b/src/haxelib/client/Main.hx index 997e33c25..09de2eb4b 100644 --- a/src/haxelib/client/Main.hx +++ b/src/haxelib/client/Main.hx @@ -1465,7 +1465,7 @@ class Main { throw "Library "+prj+" has two versions included : "+version+" and "+p.version; } var json = try File.getContent(vdir+"/"+Data.JSON) catch( e : Dynamic ) null; - var inf = Data.readData(json, json != null); + var inf = Data.readData(json, json != null ? CheckSyntax : NoCheck); l.add({ project : prj, version : version, dir : Path.addTrailingSlash(vdir), info: inf }); if( returnDependencies ) { for( d in inf.dependencies ) diff --git a/test/Prepare.hx b/test/Prepare.hx index cc12b5bae..f54278821 100644 --- a/test/Prepare.hx +++ b/test/Prepare.hx @@ -1,7 +1,6 @@ import sys.*; import sys.io.*; import haxe.io.*; -using StringTools; class Prepare { static function zipDir(dir:String, outPath:String):Void { @@ -38,6 +37,8 @@ class Prepare { } static function main():Void { + var system = Sys.systemName(); + var cwd = Sys.getCwd(); /* (re)package the dummy libraries */ @@ -45,8 +46,17 @@ class Prepare { for (item in FileSystem.readDirectory(libsPath)) { var path = Path.join([libsPath, item]); if (FileSystem.isDirectory(path)) { - trace('Preparing $item'); - zipDir(path, 'test/libraries/${item}.zip'); + switch system { + case 'Windows': + zipDir(path, 'test/libraries/${item}.zip'); + case _: + Sys.setCwd(path); + var exitCode = Sys.command('zip', ['-r', '../${item}.zip', '.']); + Sys.setCwd(cwd); + if(exitCode != 0) { + Sys.stderr().writeString('Failed to zip $item\n'); + } + } } } } diff --git a/test/RunCi.hx b/test/RunCi.hx index 078381638..5245aba70 100644 --- a/test/RunCi.hx +++ b/test/RunCi.hx @@ -198,6 +198,7 @@ Listen 2000 return; } catch (e:Dynamic) { trace(e); + trace(CallStack.toString(CallStack.exceptionStack())); Sys.sleep(5.0); } throw "cannot config database";