summaryrefslogtreecommitdiff
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
parentcfd9db015cbb79b047280d0acfad5950530d4158 (diff)
remove on_check and deps for option
-rw-r--r--xmake/core/project/option.lua82
-rw-r--r--xmake/core/project/project.lua24
2 files changed, 26 insertions, 80 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
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 948eab3a8..e30d751ef 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -520,28 +520,6 @@ function project._interpreter()
return interp
end
--- check option
-function project._check(options, opt)
-
- -- exists the dependent options?
- for _, dep in ipairs(table.wrap(opt:get("deps"))) do
-
- -- get the dependent option
- opt = options[dep]
-
- -- no this option?
- if not opt then
- os.raise("invalid dependent option: %s", dep)
- end
-
- -- check this dependent option
- project._check(options, opt)
- end
-
- -- check option
- opt:check()
-end
-
-- get the project directory
function project.directory()
@@ -569,7 +547,7 @@ function project.check()
-- check all options
for _, opt in pairs(options) do
- project._check(options, opt)
+ opt:check()
end
-- leave toolchains environment