summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-04-06 10:06:50 +0800
committerruki <[email protected]>2016-04-06 10:06:50 +0800
commit986109fa37d1c4b13ad970395358cc5ca6bacc08 (patch)
treedfb50f4e61d54b9d9c9946e0389f96646407ebe5
parent17cef33022bf3308ebd03546ab65464f9390e69c (diff)
re-config it if host changed
-rwxr-xr-xxmake/actions/config/main.lua5
-rwxr-xr-xxmake/actions/global/main.lua5
-rw-r--r--xmake/core/base/interpreter.lua2
-rw-r--r--xmake/core/base/option.lua5
-rw-r--r--xmake/core/project/config.lua9
-rw-r--r--xmake/core/project/global.lua8
-rw-r--r--xmake/core/sandbox/modules/import/core/project/config.lua14
-rw-r--r--xmake/core/sandbox/modules/import/core/project/global.lua7
-rw-r--r--xmake/core/sandbox/sandbox.lua2
9 files changed, 52 insertions, 5 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 3a4c2b9df..522b32ce2 100755
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -48,10 +48,13 @@ function main()
-- load global configure
global.load()
- -- override the option configure
+ -- init the project configure
--
-- priority: option > global > option_default > config_check > config_cache
--
+ config.init()
+
+ -- override the option configure
for name, value in pairs(option.options()) do
if _option_filter(name) then
config.set(name, value)
diff --git a/xmake/actions/global/main.lua b/xmake/actions/global/main.lua
index 9c3434091..cf8ab67a3 100755
--- a/xmake/actions/global/main.lua
+++ b/xmake/actions/global/main.lua
@@ -27,10 +27,13 @@ import("core.project.global")
-- main
function main()
- -- override the option configure
+ -- init the global configure
--
-- priority: option > option_default > config_check > global_cache
--
+ global.init()
+
+ -- override the option configure
for name, value in pairs(option.options()) do
if name ~= "verbose" and name ~= "clean" then
global.set(name, value)
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 74eb4fa18..97be6a9e7 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -49,7 +49,7 @@ function interpreter._traceback(errors)
local info = debug.getinfo(level, "Sln")
-- end?
- if not info or (info.name and info.name == "xpcall") then
+ if not info then
break
end
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index 144b41edc..ad103ccbb 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -99,6 +99,11 @@ function option.save(taskname)
-- new a context
local context = {options = {}, defaults = {}, taskname = taskname}
+ -- init defaults
+ if taskname then
+ context.defaults = option.defaults(taskname) or context.defaults
+ end
+
-- push this new context to the top stack
table.insert(option._CONTEXTS, context)
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index b43584f83..a687d5416 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -94,7 +94,6 @@ function config.directory()
return path.join(xmake._PROJECT_DIR, ".xmake")
end
--- TODO: reconfig, rebuild
-- load the project configure
function config.load(targetname)
@@ -181,6 +180,14 @@ function config.save(targetname)
return io.save(config._file(), results)
end
+-- init the config
+function config.init()
+
+ -- clear it
+ config._CONFIGS = {}
+
+end
+
-- dump the configure
function config.dump()
diff --git a/xmake/core/project/global.lua b/xmake/core/project/global.lua
index cd4682e15..d695f7bef 100644
--- a/xmake/core/project/global.lua
+++ b/xmake/core/project/global.lua
@@ -131,6 +131,14 @@ function global.save()
return io.save(global._file(), options)
end
+-- init the config
+function global.init()
+
+ -- clear it
+ global._CONFIGS = {}
+
+end
+
-- dump the configure
function global.dump()
diff --git a/xmake/core/sandbox/modules/import/core/project/config.lua b/xmake/core/sandbox/modules/import/core/project/config.lua
index e1fe93e20..0caa2dc2c 100644
--- a/xmake/core/sandbox/modules/import/core/project/config.lua
+++ b/xmake/core/sandbox/modules/import/core/project/config.lua
@@ -70,6 +70,13 @@ function sandbox_core_project_config.host()
return config.get("host")
end
+-- host has been changed?
+function sandbox_core_project_config.host_changed()
+
+ -- changed?
+ return config.get("host") ~= xmake._HOST
+end
+
-- get the configure directory
function sandbox_core_project_config.directory()
@@ -115,6 +122,13 @@ function sandbox_core_project_config.save(targetname)
end
end
+-- init the configure
+function sandbox_core_project_config.init()
+
+ -- init it
+ config.init()
+end
+
-- probe the configure
function sandbox_core_project_config.probe()
diff --git a/xmake/core/sandbox/modules/import/core/project/global.lua b/xmake/core/sandbox/modules/import/core/project/global.lua
index 8c2492c62..5e0d8b594 100644
--- a/xmake/core/sandbox/modules/import/core/project/global.lua
+++ b/xmake/core/sandbox/modules/import/core/project/global.lua
@@ -69,6 +69,13 @@ function sandbox_core_project_global.save()
end
end
+-- init the configure
+function sandbox_core_project_global.init()
+
+ -- init it
+ global.init()
+end
+
-- probe the configure
function sandbox_core_project_global.probe()
diff --git a/xmake/core/sandbox/sandbox.lua b/xmake/core/sandbox/sandbox.lua
index 5e457d590..880e803e4 100644
--- a/xmake/core/sandbox/sandbox.lua
+++ b/xmake/core/sandbox/sandbox.lua
@@ -61,7 +61,7 @@ function sandbox._traceback(errors)
local info = debug.getinfo(level, "Sln")
-- end?
- if not info or (info.name and (info.name == "xpcall" or info.name == "load")) then
+ if not info then
break
end