summaryrefslogtreecommitdiff
path: root/xmake/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2015-12-05 20:38:26 +0800
committerruki <[email protected]>2015-12-05 20:38:40 +0800
commitf77eb028a770969a3e87af41e41fe1e66b3b7842 (patch)
treebb9b7d8a63c26b4446fded0028bfcd10fdd67d71 /xmake/scripts
parentb753c9e182813b395dd4910476ff4fb3c5e26fd9 (diff)
load config for the lua action
Diffstat (limited to 'xmake/scripts')
-rw-r--r--xmake/scripts/action/_lua.lua29
-rw-r--r--xmake/scripts/platform/windows/tools/lib.lua6
-rw-r--r--xmake/scripts/tools/ar.lua4
3 files changed, 34 insertions, 5 deletions
diff --git a/xmake/scripts/action/_lua.lua b/xmake/scripts/action/_lua.lua
index 9c37d461a..c1a89dc39 100644
--- a/xmake/scripts/action/_lua.lua
+++ b/xmake/scripts/action/_lua.lua
@@ -35,8 +35,23 @@ local platform = require("platform/platform")
-- need access to the given file?
function _lua.need(name)
- -- no accessors
- return false
+ -- the options
+ local options = xmake._OPTIONS
+ assert(options)
+
+ -- do not load config if be not given -f or -P options
+ if options.file == nil and options.project == nil then
+ return false
+ end
+
+ -- patch target for loading config ok
+ options.target = "all"
+
+ -- the accessors
+ local accessors = { config = true, global = true, platform = true }
+
+ -- need it?
+ return accessors[name]
end
-- done
@@ -124,7 +139,15 @@ function _lua.menu()
-- options
, options =
{
- {'s', "string", "k", nil, "Run the lua string script." }
+ {'f', "file", "kv", nil, "Read a given xmake.lua file." }
+ , {'P', "project", "kv", nil, "Change to the given project directory."
+ , "Search priority:"
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
+
+ , {}
+ , {'s', "string", "k", nil, "Run the lua string script." }
, {}
, {'v', "verbose", "k", nil, "Print lots of verbose information." }
diff --git a/xmake/scripts/platform/windows/tools/lib.lua b/xmake/scripts/platform/windows/tools/lib.lua
index 0e464f38c..ad83c9348 100644
--- a/xmake/scripts/platform/windows/tools/lib.lua
+++ b/xmake/scripts/platform/windows/tools/lib.lua
@@ -57,6 +57,12 @@ function lib.extract(self, ...)
return false
end
+ -- list object files
+ if not self:main(string.format("%s -list:%s", self.name, libfile)) then
+ utils.error("extract %s to %s failed!", libfile, objdir)
+ return false
+ end
+
print(libfile, objfile)
assert(false)
diff --git a/xmake/scripts/tools/ar.lua b/xmake/scripts/tools/ar.lua
index dbe947111..75e63f83d 100644
--- a/xmake/scripts/tools/ar.lua
+++ b/xmake/scripts/tools/ar.lua
@@ -82,8 +82,8 @@ function ar.extract(self, ...)
end
-- extract it
- local ok = os.execute(string.format("%s -x %s", self.name, libfile))
- if ok ~= 0 then
+ local ok = self:main(string.format("%s -x %s", self.name, libfile))
+ if not ok then
utils.error("extract %s to %s failed!", libfile, objdir)
return false
end