summaryrefslogtreecommitdiff
path: root/xmake/core/project/option.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-06-15 11:46:47 +0800
committerruki <[email protected]>2016-06-15 11:46:47 +0800
commit0393ff118a61d3f5fc87e02df3752f28db5e8626 (patch)
treed4ec8e36869154f6e6629cd32e4737db75cc5ed8 /xmake/core/project/option.lua
parentcfd9db015cbb79b047280d0acfad5950530d4158 (diff)
remove on_check and deps for option
Diffstat (limited to 'xmake/core/project/option.lua')
-rw-r--r--xmake/core/project/option.lua82
1 files changed, 25 insertions, 57 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index f225a01a1..192660d74 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -430,37 +430,6 @@ function option:_check_condition()
return true
end
--- check option
-function option:_check()
-
- -- enable it?
- local enable = self:get("enable")
- if enable ~= nil and enable then
-
- -- enable this option
- config.set(self:name(), true)
-
- -- save this option to configure
- self:save()
-
- -- check option
- elseif enable == nil and self:_check_condition() then
-
- -- enable this option
- config.set(self:name(), true)
-
- -- save this option to configure
- self:save()
- else
-
- -- disable this option
- config.set(self:name(), false)
-
- -- clear this option to configure
- self:clear()
- end
-end
-
-- attempt to check option
function option:check()
@@ -474,24 +443,32 @@ function option:check()
-- need check?
if config.get(name) == nil then
-
- -- the option scripts
- local scripts =
- {
- self:get("check_before")
- , self:get("check") or option._check
- , self:get("check_after")
- }
+
+ -- enable it?
+ local enable = self:get("enable")
+ if enable ~= nil and enable then
+
+ -- enable this option
+ config.set(name, true)
+
+ -- save this option to configure
+ self:save()
+
+ -- check option
+ elseif enable == nil and self:_check_condition() then
+
+ -- enable this option
+ config.set(name, true)
- -- run the target scripts
- for i = 1, 3 do
- local script = scripts[i]
- if script ~= nil then
- local ok, errors = sandbox.load(script, self)
- if not ok then
- os.raise(errors)
- end
- end
+ -- save this option to configure
+ self:save()
+ else
+
+ -- disable this option
+ config.set(name, false)
+
+ -- clear this option to configure
+ self:clear()
end
-- no check
@@ -501,15 +478,6 @@ function option:check()
self:save()
end
- -- on result
- local on_result = self:get("result")
- if on_result ~= nil then
- local ok, errors = sandbox.load(on_result, self, self:enabled())
- if not ok then
- os.raise(errors)
- end
- end
-
-- checked
self._CHECKED = true
end