summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-04-05 20:59:09 +0800
committerruki <[email protected]>2016-04-05 20:59:09 +0800
commit17cef33022bf3308ebd03546ab65464f9390e69c (patch)
treeadf735a77bfbfa87a1c08d121f1348062e84dfb2
parent444f3f3f9e9dabf46da999d6d8d6f200c672a866 (diff)
impl auto rebuild for config
-rwxr-xr-xxmake/actions/clean/main.lua3
-rwxr-xr-xxmake/actions/config/main.lua3
-rwxr-xr-xxmake/actions/lua/xmake.lua3
-rw-r--r--xmake/core/project/config.lua22
4 files changed, 20 insertions, 11 deletions
diff --git a/xmake/actions/clean/main.lua b/xmake/actions/clean/main.lua
index 120c39bab..6528420b1 100755
--- a/xmake/actions/clean/main.lua
+++ b/xmake/actions/clean/main.lua
@@ -134,9 +134,6 @@ function main()
-- get the target name
local targetname = option.get("target")
- -- load global configure
- global.load()
-
-- load project configure
config.load(targetname)
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 3a9305361..3a4c2b9df 100755
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -105,6 +105,9 @@ function main()
raise("unknown target: %s", targetname)
end
+ -- need rebuild it
+ config.set("__rebuild", true)
+
-- save the project configure
config.save(targetname)
diff --git a/xmake/actions/lua/xmake.lua b/xmake/actions/lua/xmake.lua
index 96089d0b6..dc34eda56 100755
--- a/xmake/actions/lua/xmake.lua
+++ b/xmake/actions/lua/xmake.lua
@@ -38,9 +38,6 @@ task("lua")
-- do not load config if be not given -f or -P options
if option.get("file") or option.get("project") then
- -- load global configure
- global.load()
-
-- load project configure
config.load()
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 761855011..b43584f83 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -151,16 +151,28 @@ function config.save(targetname)
results.__version = xmake._VERSION
-- update options for the given target
- local target = results
+ local target = nil
if targetname ~= "all" then
- -- get target
- target = results._TARGETS or {}
- results._TARGETS = target
+ -- the targets
+ local targets = results._TARGETS or {}
+ results._TARGETS = targets
+
+ -- clear target and get it
+ targets[targetname] = {}
+ target = targets[targetname]
+ else
+
+ -- the targets
+ local targets = results._TARGETS
+
+ -- clear the root target and get it
+ results = {_TARGETS = targets}
+ target = results
end
- -- update it
+ -- update target
for name, value in pairs(config.options()) do
target[name] = value
end