summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-22 22:44:15 +0800
committerruki <[email protected]>2020-05-22 10:25:35 +0800
commitb1df391694245eb0f1555b3855fad3faee0d2a82 (patch)
tree44c84020580949a4ade4f6579a6a34b75a5f58a7
parente649d1c2a8dab803bacbdd1551f629469ab5158f (diff)
load toolchains for project
-rw-r--r--xmake/core/platform/platform.lua10
-rw-r--r--xmake/core/tool/toolchain.lua15
2 files changed, 9 insertions, 16 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index 56491c927..af6a2f0e0 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -34,11 +34,10 @@ local config = require("project/config")
local global = require("base/global")
-- new an instance
-function _instance.new(name, info, rootdir)
+function _instance.new(name, info)
local instance = table.inherit(_instance)
instance._NAME = name
instance._INFO = info
- instance._ROOTDIR = rootdir
return instance
end
@@ -465,13 +464,8 @@ function platform.load(plat)
return nil, string.format("the platform %s not found!", plat)
end
- -- new an instance
- local instance, errors = _instance.new(plat, result, interp:rootdir())
- if not instance then
- return nil, errors
- end
-
-- save instance to the cache
+ local instance = _instance.new(plat, result)
platform._PLATFORMS[cachekey] = instance
return instance
end
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index dddfb841a..dd682d3b2 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -36,11 +36,10 @@ local sandbox = require("sandbox/sandbox")
local sandbox_module = require("sandbox/modules/import/core/sandbox/module")
-- new an instance
-function _instance.new(name, info, rootdir)
+function _instance.new(name, info)
local instance = table.inherit(_instance)
instance._NAME = name
instance._INFO = info
- instance._ROOTDIR = rootdir
return instance
end
@@ -370,16 +369,16 @@ function toolchain.load(name)
return nil, string.format("the toolchain %s not found!", name)
end
- -- new an instance
- local instance, errors = _instance.new(name, result, interp:rootdir())
- if not instance then
- return nil, errors
- end
-
-- save instance to the cache
+ local instance = _instance.new(name, result)
toolchain._TOOLCHAINS[name] = instance
return instance
end
+-- new toolchain
+function toolchain.new(name, info)
+ return _instance.new(name, info)
+end
+
-- return module
return toolchain