diff options
| author | ruki <[email protected]> | 2016-03-22 20:24:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-22 20:24:31 +0800 |
| commit | aca0257d26134ff95889acb419d49701fee4ec61 (patch) | |
| tree | c1a2f332156aba8295b0522fa70f08783e9633c6 /xmake/core/platform | |
| parent | c1460e5be7f4b4e3356a8bda99703828c356cbfb (diff) | |
impl lua action
Diffstat (limited to 'xmake/core/platform')
| -rw-r--r-- | xmake/core/platform/platform.lua | 73 | ||||
| -rw-r--r-- | xmake/core/platform/tools/echo.lua | 44 |
2 files changed, 24 insertions, 93 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index c0e974460..f552ea3ef 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -27,7 +27,6 @@ local platform = platform or {} local os = require("base/os") local path = require("base/path") local utils = require("base/utils") -local option = require("base/option") local config = require("project/config") local global = require("project/global") @@ -123,8 +122,29 @@ function platform._load(plat) return module end --- get the configure of the given platform -function platform._configs(plat) +-- get the current platform module +function platform.module() + + -- get the platform + local plat = config.get("plat") + if plat then + -- load it + return platform._load(plat) + end +end + +-- get the current platform module directory +function platform.directory() + + -- load it + local module = platform.module() + if module then + return module._DIRECTORY + end +end + +-- load the configure of the given platform +function platform.load(plat) -- check assert(plat) @@ -154,38 +174,6 @@ function platform._configs(plat) return configs end --- get the current platform module -function platform.module() - - -- get the platform - local plat = config.get("plat") - if plat then - -- load it - return platform._load(plat) - end -end - --- get the current platform module directory -function platform.directory() - - -- load it - local module = platform.module() - if module then - return module._DIRECTORY - end -end - --- make the current platform configure -function platform.make() - - -- get the platform - local plat = config.get("plat") - assert(plat) - - -- make and get the current platform configure - return platform._configs(plat) -end - -- get the platform os function platform.os() @@ -204,7 +192,7 @@ function platform.get(name) assert(platform._CONFIGS) -- get the current platform configure - local configs = platform._configs(config.get("plat")) + local configs = platform.load(config.get("plat")) if configs then -- get it return configs[name] @@ -239,19 +227,6 @@ function platform.format(kind) end --- dump the platform configure -function platform.dump() - - -- check - assert(platform._CONFIGS) - - -- dump - if option.get("verbose") then - table.dump(platform._configs(config.get("plat"))) - end - -end - -- list all platforms function platform.plats() diff --git a/xmake/core/platform/tools/echo.lua b/xmake/core/platform/tools/echo.lua deleted file mode 100644 index 9a858c765..000000000 --- a/xmake/core/platform/tools/echo.lua +++ /dev/null @@ -1,44 +0,0 @@ ---!The Automatic Cross-platform Build Tool --- --- XMake is free software; you can redistribute it and/or modify --- it under the terms of the GNU Lesser General Public License as published by --- the Free Software Foundation; either version 2.1 of the License, or --- (at your option) any later version. --- --- XMake is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public License --- along with XMake; --- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> --- --- Copyright (C) 2015 - 2016, ruki All rights reserved. --- --- @author ruki --- @file echo.lua --- - --- define module: echo -local echo = echo or {} - --- load modules -local io = require("base/io") -local string = require("base/string") - --- the main function -function echo.main(self, ...) - - -- echo all - for _, v in ipairs(...) do - io.write(string.format("%s ", v:decode())) - end - io.write("\n") - - -- ok - return true -end - --- return module: echo -return echo |
