Ver código fonte

improve test.lua

ruki 6 anos atrás
pai
commit
21b9cde1ad
4 arquivos alterados com 30 adições e 8 exclusões
  1. 1 1
      .appveyor.yml
  2. 1 1
      .travis.yml
  3. 1 4
      packages/f/freetype/xmake.lua
  4. 27 2
      scripts/test.lua

+ 1 - 1
.appveyor.yml

@@ -11,5 +11,5 @@ before_build:
   - cmd: xmake --version
 
 build_script:
-  - cmd: xmake l scripts/test.lua
+  - cmd: xmake l scripts/test.lua -D
 

+ 1 - 1
.travis.yml

@@ -14,5 +14,5 @@ install:
   - cd -
 
 script:
-  - travis_wait 60 xmake l ./scripts/test.lua
+  - travis_wait 60 xmake l ./scripts/test.lua -D
 

+ 1 - 4
packages/f/freetype/xmake.lua

@@ -12,10 +12,7 @@ package("freetype")
         add_versions("2.9.1", "db8d87ea720ea9d5edc5388fc7a0497bb11ba9fe972245e0f7f4c7e8b1e1e84d")
     end
 
-    add_deps("libpng")
-    if not is_plat("macosx") then
-        add_deps("bzip2", "zlib")
-    end
+    add_deps("libpng", "bzip2", "zlib")
 
     if not is_plat("windows") then
         add_includedirs("include/freetype2")

+ 27 - 2
scripts/test.lua

@@ -1,5 +1,22 @@
+-- imports
+import("core.base.option")
+
+-- the options
+local options =
+{
+    {'v', "verbose",    "k",  nil, "Enable verbose information."   }
+,   {'D', "diagnosis",  "k",  nil, "Enable diagnosis information." }
+,   {nil, "packages",   "vs", nil, "The package list."             }
+}
+
+-- the main entry
 function main(...)
-    local packages = {...}
+
+    -- parse arguments
+    local argv = option.parse({...}, options, "Test all the given or changed packages.")
+
+    -- get packages
+    local packages = argv.packages
     if #packages == 0 then
         local files = os.iorun("git diff --name-only HEAD^")
         for _, file in ipairs(files:split('\n'), string.trim) do
@@ -24,5 +41,13 @@ function main(...)
     print(os.curdir())
     os.exec("xmake repo --add local-repo %s", repodir)
     os.exec("xmake repo -l")
-    os.exec("xmake require -f -D -y %s", table.concat(packages, " "))
+    local require_argv = {"require", "-f", "-y"}
+    if argv.verbose then
+        table.insert(require_argv, "-v")
+    end
+    if argv.diagnosis then
+        table.insert(require_argv, "-D")
+    end
+    table.join2(require_argv, packages)
+    os.execv("xmake", require_argv)
 end