summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-19 22:56:34 +0800
committerruki <[email protected]>2017-07-19 22:56:34 +0800
commit0614ca6a2eebcf8b4d4be3c6171a783731720888 (patch)
tree2400dd538374fa88f322ede41e8cdb0b1ffb24b9
parent1ea7269e5078041df9c170b020953273ea176675 (diff)
fix flush option bug
-rw-r--r--xmake/core/project/option.lua19
-rw-r--r--xmake/core/sandbox/modules/import/core/project/project.lua4
2 files changed, 10 insertions, 13 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index d8e347ca9..ba3b19904 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -72,11 +72,6 @@ function option:_clear()
option._cache():set(self:name(), nil)
end
--- flush the option cache to file
-function option:_flush()
- option._cache():flush()
-end
-
-- check option for c/c++
function option:_cx_check()
@@ -218,9 +213,8 @@ function option:set_value(value)
-- set value to option
config.set(self:name(), value)
- -- save option and flush cache to file
+ -- save option
self:_save()
- self:_flush()
end
-- clear the option status and need recheck it
@@ -231,9 +225,6 @@ function option:clear()
-- clear this option in cache
self:_clear()
-
- -- flush cache to file
- self:_flush()
end
-- this option is enabled?
@@ -255,9 +246,6 @@ function option:enable(enabled)
else
self:_clear()
end
-
- -- flush cache to file
- self:_flush()
end
-- dump this option
@@ -336,5 +324,10 @@ function option.load(name)
return instance
end
+-- save all options to the cache file
+function option.save()
+ option._cache():flush()
+end
+
-- return module
return option
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua
index 0c536e700..4a7beb3e0 100644
--- a/xmake/core/sandbox/modules/import/core/project/project.lua
+++ b/xmake/core/sandbox/modules/import/core/project/project.lua
@@ -29,6 +29,7 @@ local sandbox_core_project = sandbox_core_project or {}
local table = require("base/table")
local deprecated = require("base/deprecated")
local config = require("project/config")
+local option = require("project/option")
local project = require("project/project")
local sandbox = require("sandbox/sandbox")
local raise = require("sandbox/modules/raise")
@@ -100,6 +101,9 @@ function sandbox_core_project.check()
-- leave toolchains environment
environment.leave("toolchains")
+ -- save all options to the cache file
+ option.save()
+
-- leave the project directory
ok, errors = os.cd(oldir)
if not ok then