From e1e38b8b2cf04bfd41ded133aac6604bdde06293 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 17 Feb 2016 21:04:40 +0800 Subject: remove vformat for templates --- xmake/core/base/sandbox.lua | 2 +- xmake/core/sandbox/assert.lua | 25 +++ xmake/core/sandbox/builtin/assert.lua | 25 --- xmake/core/sandbox/builtin/format.lua | 26 --- xmake/core/sandbox/builtin/import.lua | 52 ------ xmake/core/sandbox/builtin/ipairs.lua | 25 --- xmake/core/sandbox/builtin/os.lua | 149 --------------- xmake/core/sandbox/builtin/pairs.lua | 25 --- xmake/core/sandbox/builtin/path.lua | 25 --- xmake/core/sandbox/builtin/print.lua | 25 --- xmake/core/sandbox/builtin/printf.lua | 25 --- xmake/core/sandbox/builtin/string.lua | 63 ------- xmake/core/sandbox/builtin/table.lua | 25 --- xmake/core/sandbox/builtin/utils.lua | 46 ----- xmake/core/sandbox/builtin/vformat.lua | 26 --- xmake/core/sandbox/builtin/vprintf.lua | 25 --- xmake/core/sandbox/format.lua | 26 +++ xmake/core/sandbox/import.lua | 52 ++++++ xmake/core/sandbox/import/project.lua | 73 ++++++++ xmake/core/sandbox/ipairs.lua | 25 +++ xmake/core/sandbox/os.lua | 206 +++++++++++++++++++++ xmake/core/sandbox/pairs.lua | 25 +++ xmake/core/sandbox/path.lua | 25 +++ xmake/core/sandbox/print.lua | 25 +++ xmake/core/sandbox/printf.lua | 25 +++ xmake/core/sandbox/project.lua | 73 -------- xmake/core/sandbox/string.lua | 63 +++++++ xmake/core/sandbox/table.lua | 25 +++ xmake/core/sandbox/utils.lua | 46 +++++ xmake/core/sandbox/vformat.lua | 26 +++ xmake/templates/c++/console_tbox/template.lua | 4 +- .../templates/c++/shared_library_tbox/template.lua | 8 +- .../templates/c++/static_library_tbox/template.lua | 8 +- xmake/templates/c/console_tbox/template.lua | 4 +- xmake/templates/c/shared_library_tbox/template.lua | 8 +- xmake/templates/c/static_library_tbox/template.lua | 8 +- 36 files changed, 688 insertions(+), 656 deletions(-) create mode 100644 xmake/core/sandbox/assert.lua delete mode 100644 xmake/core/sandbox/builtin/assert.lua delete mode 100644 xmake/core/sandbox/builtin/format.lua delete mode 100644 xmake/core/sandbox/builtin/import.lua delete mode 100644 xmake/core/sandbox/builtin/ipairs.lua delete mode 100644 xmake/core/sandbox/builtin/os.lua delete mode 100644 xmake/core/sandbox/builtin/pairs.lua delete mode 100644 xmake/core/sandbox/builtin/path.lua delete mode 100644 xmake/core/sandbox/builtin/print.lua delete mode 100644 xmake/core/sandbox/builtin/printf.lua delete mode 100644 xmake/core/sandbox/builtin/string.lua delete mode 100644 xmake/core/sandbox/builtin/table.lua delete mode 100644 xmake/core/sandbox/builtin/utils.lua delete mode 100644 xmake/core/sandbox/builtin/vformat.lua delete mode 100644 xmake/core/sandbox/builtin/vprintf.lua create mode 100644 xmake/core/sandbox/format.lua create mode 100644 xmake/core/sandbox/import.lua create mode 100644 xmake/core/sandbox/import/project.lua create mode 100644 xmake/core/sandbox/ipairs.lua create mode 100644 xmake/core/sandbox/os.lua create mode 100644 xmake/core/sandbox/pairs.lua create mode 100644 xmake/core/sandbox/path.lua create mode 100644 xmake/core/sandbox/print.lua create mode 100644 xmake/core/sandbox/printf.lua delete mode 100644 xmake/core/sandbox/project.lua create mode 100644 xmake/core/sandbox/string.lua create mode 100644 xmake/core/sandbox/table.lua create mode 100644 xmake/core/sandbox/utils.lua create mode 100644 xmake/core/sandbox/vformat.lua diff --git a/xmake/core/base/sandbox.lua b/xmake/core/base/sandbox.lua index 570a22fa4..495be81fd 100644 --- a/xmake/core/base/sandbox.lua +++ b/xmake/core/base/sandbox.lua @@ -96,7 +96,7 @@ function sandbox._init() end -- load builtin module files - local builtin_module_files = os.match(path.join(xmake._CORE_DIR, "sandbox/builtin/*.lua")) + local builtin_module_files = os.match(path.join(xmake._CORE_DIR, "sandbox/*.lua")) if builtin_module_files then for _, builtin_module_file in ipairs(builtin_module_files) do diff --git a/xmake/core/sandbox/assert.lua b/xmake/core/sandbox/assert.lua new file mode 100644 index 000000000..480271b4f --- /dev/null +++ b/xmake/core/sandbox/assert.lua @@ -0,0 +1,25 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file assert.lua +-- + +-- load module +return assert + diff --git a/xmake/core/sandbox/builtin/assert.lua b/xmake/core/sandbox/builtin/assert.lua deleted file mode 100644 index 480271b4f..000000000 --- a/xmake/core/sandbox/builtin/assert.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file assert.lua --- - --- load module -return assert - diff --git a/xmake/core/sandbox/builtin/format.lua b/xmake/core/sandbox/builtin/format.lua deleted file mode 100644 index 13417e546..000000000 --- a/xmake/core/sandbox/builtin/format.lua +++ /dev/null @@ -1,26 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file format.lua --- - --- return module -return require("sandbox/builtin/string").format - - diff --git a/xmake/core/sandbox/builtin/import.lua b/xmake/core/sandbox/builtin/import.lua deleted file mode 100644 index ccbef0052..000000000 --- a/xmake/core/sandbox/builtin/import.lua +++ /dev/null @@ -1,52 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file import.lua --- - --- load modules -local utils = require("base/utils") - --- import module -function sandbox_builtin_import(name) - - -- load module - local module = require("sandbox/" .. name) - if not module then - utils.error("cannot import module: %s", name) - utils.abort() - end - - -- get the parent scope - local scope_parent = getfenv(2) - assert(scope_parent) - - -- this module has been imported? - if rawget(scope_parent, name) then - utils.error("this module: %s has been imported!", name) - utils.abort() - end - - -- import this module into the parent scope - scope_parent[name] = module -end - --- load module -return sandbox_builtin_import - diff --git a/xmake/core/sandbox/builtin/ipairs.lua b/xmake/core/sandbox/builtin/ipairs.lua deleted file mode 100644 index b3551f862..000000000 --- a/xmake/core/sandbox/builtin/ipairs.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file ipairs.lua --- - --- load module -return ipairs - diff --git a/xmake/core/sandbox/builtin/os.lua b/xmake/core/sandbox/builtin/os.lua deleted file mode 100644 index cd1380f03..000000000 --- a/xmake/core/sandbox/builtin/os.lua +++ /dev/null @@ -1,149 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file os.lua --- - --- load modules -local io = require("base/io") -local os = require("base/os") -local utils = require("base/utils") - --- define module -local sandbox_builtin_os = sandbox_builtin_os or {} - --- copy file or directory -function sandbox_builtin_os.cp(src, dst) - - -- check - assert(src and dst) - - -- done - local ok, errors = os.cp(src, dst) - if not ok then - utils.error(errors) - utils.abort() - end - -end - --- move file or directory -function sandbox_builtin_os.mv(src, dst) - - -- check - assert(src and dst) - - -- done - local ok, errors = os.mv(src, dst) - if not ok then - utils.error(errors) - utils.abort() - end - -end - --- remove file or directory -function sandbox_builtin_os.rm(file_or_dir, emptydir) - - -- check - assert(file_or_dir) - - -- done - local ok, errors = os.rm(file_or_dir, emptydir) - if not ok then - utils.error(errors) - utils.abort() - end - -end - --- change to directory -function sandbox_builtin_os.cd(dir) - - -- check - assert(dir) - - -- done - local ok, errors = os.cd(dir) - if not ok then - utils.error(errors) - utils.abort() - end - -end - --- create directory -function sandbox_builtin_os.mkdir(dir) - - -- check - assert(dir) - - -- done - if not os.mkdir(dir) then - utils.error("create directory: %s failed!", dir) - utils.abort() - end - -end - --- remove directory -function sandbox_builtin_os.rmdir(dir) - - -- check - assert(dir) - - -- done - if os.isdir(dir) then - if not os.rmdir(dir) then - utils.error("remove directory: %s failed!", dir) - utils.abort() - end - end - -end - --- run shell -function sandbox_builtin_os.run(cmd, ...) - - -- make command - cmd = string.format(cmd, ...) - - -- make temporary log file - log = os.tmpname() - - -- run command - if 0 ~= os.execute(cmd .. string.format(" > %s 2>&1", log)) then - io.cat(log) - utils.error("run: %s failed!", cmd) - utils.abort() - end - - -- remove the temporary log file - os.rm(log) -end - --- register some public interfaces -sandbox_builtin_os.match = os.match -sandbox_builtin_os.isdir = os.isdir -sandbox_builtin_os.isfile = os.isfile -sandbox_builtin_os.curdir = os.curdir - --- return module -return sandbox_builtin_os - diff --git a/xmake/core/sandbox/builtin/pairs.lua b/xmake/core/sandbox/builtin/pairs.lua deleted file mode 100644 index f4f74b7e4..000000000 --- a/xmake/core/sandbox/builtin/pairs.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file pairs.lua --- - --- load module -return pairs - diff --git a/xmake/core/sandbox/builtin/path.lua b/xmake/core/sandbox/builtin/path.lua deleted file mode 100644 index 925ad7cf8..000000000 --- a/xmake/core/sandbox/builtin/path.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file path.lua --- - --- load module -return require("base/path") - diff --git a/xmake/core/sandbox/builtin/print.lua b/xmake/core/sandbox/builtin/print.lua deleted file mode 100644 index b9e9b9f86..000000000 --- a/xmake/core/sandbox/builtin/print.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file print.lua --- - --- load module -return print - diff --git a/xmake/core/sandbox/builtin/printf.lua b/xmake/core/sandbox/builtin/printf.lua deleted file mode 100644 index 41acbf7c6..000000000 --- a/xmake/core/sandbox/builtin/printf.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file printf.lua --- - --- load module -return require("sandbox/builtin/utils").printf - diff --git a/xmake/core/sandbox/builtin/string.lua b/xmake/core/sandbox/builtin/string.lua deleted file mode 100644 index 1947e9f0a..000000000 --- a/xmake/core/sandbox/builtin/string.lua +++ /dev/null @@ -1,63 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file string.lua --- - --- load modules -local string = require("base/string") -local sandbox = require("base/sandbox") - --- define module -local sandbox_builtin_string = sandbox_builtin_string or {} - --- format string with the builtin variables -function sandbox_builtin_string.vformat(format, ...) - - -- check - assert(format) - - -- get the current sandbox instance - local instance = sandbox.instance() - assert(instance) - - -- format string - local result = string.format(format, ...) - assert(result) - - -- get filter from the current sandbox - local filter = instance:filter() - if filter then - result = filter:handle(result) - end - - -- ok? - return result -end - --- inherit the public interfaces of string -for k, v in pairs(string) do - if not k:startswith("_") and type(v) == "function" then - sandbox_builtin_string[k] = v - end -end - --- return module -return sandbox_builtin_string - diff --git a/xmake/core/sandbox/builtin/table.lua b/xmake/core/sandbox/builtin/table.lua deleted file mode 100644 index a697504fd..000000000 --- a/xmake/core/sandbox/builtin/table.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file table.lua --- - --- load module -return require("base/table") - diff --git a/xmake/core/sandbox/builtin/utils.lua b/xmake/core/sandbox/builtin/utils.lua deleted file mode 100644 index 96e8d74d9..000000000 --- a/xmake/core/sandbox/builtin/utils.lua +++ /dev/null @@ -1,46 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file utils.lua --- - --- load modules -local utils = require("base/utils") -local string = require("sandbox/builtin/string") - --- define module -local sandbox_builtin_utils = sandbox_builtin_utils or {} - --- printf with the builtin variables -function sandbox_builtin_utils.vprintf(format, ...) - - -- done - return print(string.vformat(format, ...)) -end - --- inherit the public interfaces of utils -for k, v in pairs(utils) do - if not k:startswith("_") and type(v) == "function" then - sandbox_builtin_utils[k] = v - end -end - --- return module -return sandbox_builtin_utils - diff --git a/xmake/core/sandbox/builtin/vformat.lua b/xmake/core/sandbox/builtin/vformat.lua deleted file mode 100644 index 462d5f54d..000000000 --- a/xmake/core/sandbox/builtin/vformat.lua +++ /dev/null @@ -1,26 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file vformat.lua --- - --- return module -return require("sandbox/builtin/string").vformat - - diff --git a/xmake/core/sandbox/builtin/vprintf.lua b/xmake/core/sandbox/builtin/vprintf.lua deleted file mode 100644 index f0381aff4..000000000 --- a/xmake/core/sandbox/builtin/vprintf.lua +++ /dev/null @@ -1,25 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file vprintf.lua --- - --- load module -return require("sandbox/builtin/utils").vprintf - diff --git a/xmake/core/sandbox/format.lua b/xmake/core/sandbox/format.lua new file mode 100644 index 000000000..deb7280ac --- /dev/null +++ b/xmake/core/sandbox/format.lua @@ -0,0 +1,26 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file format.lua +-- + +-- return module +return require("sandbox/string").format + + diff --git a/xmake/core/sandbox/import.lua b/xmake/core/sandbox/import.lua new file mode 100644 index 000000000..e2011c55b --- /dev/null +++ b/xmake/core/sandbox/import.lua @@ -0,0 +1,52 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file import.lua +-- + +-- load modules +local utils = require("base/utils") + +-- import module +function sandbox_builtin_import(name) + + -- load module + local module = require("sandbox/import" .. name) + if not module then + utils.error("cannot import module: %s", name) + utils.abort() + end + + -- get the parent scope + local scope_parent = getfenv(2) + assert(scope_parent) + + -- this module has been imported? + if rawget(scope_parent, name) then + utils.error("this module: %s has been imported!", name) + utils.abort() + end + + -- import this module into the parent scope + scope_parent[name] = module +end + +-- load module +return sandbox_builtin_import + diff --git a/xmake/core/sandbox/import/project.lua b/xmake/core/sandbox/import/project.lua new file mode 100644 index 000000000..f3f726c6f --- /dev/null +++ b/xmake/core/sandbox/import/project.lua @@ -0,0 +1,73 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file project.lua +-- + +-- define module: project +local project = project or {} + +-- load modules +local rule = require("base/rule") +local config = require("base/config") + +-- get the build directory +function project.buildir() + + -- get it + return config.get("buildir") +end + +-- get the project directory +function project.projectdir() + + -- get it + return xmake._PROJECT_DIR +end + +-- get the log file +function project.logfile() + + -- get it + return rule.logfile() +end + +-- get the current platform +function project.plat() + + -- get it + return config.get("plat") +end + +-- get the current architecture +function project.arch() + + -- get it + return config.get("arch") +end + +-- get the current mode +function project.mode() + + -- get it + return config.get("mode") +end + +-- return module: project +return project diff --git a/xmake/core/sandbox/ipairs.lua b/xmake/core/sandbox/ipairs.lua new file mode 100644 index 000000000..b3551f862 --- /dev/null +++ b/xmake/core/sandbox/ipairs.lua @@ -0,0 +1,25 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file ipairs.lua +-- + +-- load module +return ipairs + diff --git a/xmake/core/sandbox/os.lua b/xmake/core/sandbox/os.lua new file mode 100644 index 000000000..c83593cd4 --- /dev/null +++ b/xmake/core/sandbox/os.lua @@ -0,0 +1,206 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file os.lua +-- + +-- load modules +local io = require("base/io") +local os = require("base/os") +local utils = require("base/utils") +local vformat = require("sandbox/vformat") + +-- define module +local sandbox_builtin_os = sandbox_builtin_os or {} + +-- inherit the public interfaces of os +sandbox_builtin_os.curdir = os.curdir + +-- copy file or directory +function sandbox_builtin_os.cp(src, dst) + + -- check + assert(src and dst) + + -- format it first + src = vformat(src) + dst = vformat(dst) + + -- done + local ok, errors = os.cp(src, dst) + if not ok then + utils.error(errors) + utils.abort() + end + +end + +-- move file or directory +function sandbox_builtin_os.mv(src, dst) + + -- check + assert(src and dst) + + -- format it first + src = vformat(src) + dst = vformat(dst) + + -- done + local ok, errors = os.mv(src, dst) + if not ok then + utils.error(errors) + utils.abort() + end + +end + +-- remove file or directory +function sandbox_builtin_os.rm(file_or_dir, emptydir) + + -- check + assert(file_or_dir) + + -- format it first + file_or_dir = vformat(file_or_dir) + + -- done + local ok, errors = os.rm(file_or_dir, emptydir) + if not ok then + utils.error(errors) + utils.abort() + end + +end + +-- change to directory +function sandbox_builtin_os.cd(dir) + + -- check + assert(dir) + + -- format it first + dir = vformat(dir) + + -- done + local ok, errors = os.cd(dir) + if not ok then + utils.error(errors) + utils.abort() + end + +end + +-- create directory +function sandbox_builtin_os.mkdir(dir) + + -- check + assert(dir) + + -- format it first + dir = vformat(dir) + + -- done + if not os.mkdir(dir) then + utils.error("create directory: %s failed!", dir) + utils.abort() + end + +end + +-- remove directory +function sandbox_builtin_os.rmdir(dir) + + -- check + assert(dir) + + -- format it first + dir = vformat(dir) + + -- done + if os.isdir(dir) then + if not os.rmdir(dir) then + utils.error("remove directory: %s failed!", dir) + utils.abort() + end + end + +end + +-- run shell +function sandbox_builtin_os.run(cmd, ...) + + -- make command + cmd = vformat(cmd, ...) + + -- make temporary log file + log = os.tmpname() + + -- run command + if 0 ~= os.execute(cmd .. string.format(" > %s 2>&1", log)) then + io.cat(log) + utils.error("run: %s failed!", cmd) + utils.abort() + end + + -- remove the temporary log file + os.rm(log) +end + +-- match files or directories +function sandbox_builtin_os.match(pattern, findir) + + -- check + assert(pattern) + + -- format it first + pattern = vformat(pattern) + + -- match it + return os.match(pattern, findir) +end + +-- is directory? +function sandbox_builtin_os.isdir(dirpath) + + -- check + assert(dirpath) + + -- format it first + dirpath = vformat(dirpath) + + -- done + return os.isdir(dirpath) +end + +-- is directory? +function sandbox_builtin_os.isfile(filepath) + + -- check + assert(filepath) + + -- format it first + filepath = vformat(filepath) + + -- done + return os.isfile(filepath) +end + +-- return module +return sandbox_builtin_os + diff --git a/xmake/core/sandbox/pairs.lua b/xmake/core/sandbox/pairs.lua new file mode 100644 index 000000000..f4f74b7e4 --- /dev/null +++ b/xmake/core/sandbox/pairs.lua @@ -0,0 +1,25 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file pairs.lua +-- + +-- load module +return pairs + diff --git a/xmake/core/sandbox/path.lua b/xmake/core/sandbox/path.lua new file mode 100644 index 000000000..925ad7cf8 --- /dev/null +++ b/xmake/core/sandbox/path.lua @@ -0,0 +1,25 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file path.lua +-- + +-- load module +return require("base/path") + diff --git a/xmake/core/sandbox/print.lua b/xmake/core/sandbox/print.lua new file mode 100644 index 000000000..b9e9b9f86 --- /dev/null +++ b/xmake/core/sandbox/print.lua @@ -0,0 +1,25 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file print.lua +-- + +-- load module +return print + diff --git a/xmake/core/sandbox/printf.lua b/xmake/core/sandbox/printf.lua new file mode 100644 index 000000000..e3d524abd --- /dev/null +++ b/xmake/core/sandbox/printf.lua @@ -0,0 +1,25 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file printf.lua +-- + +-- load module +return require("sandbox/utils").printf + diff --git a/xmake/core/sandbox/project.lua b/xmake/core/sandbox/project.lua deleted file mode 100644 index f3f726c6f..000000000 --- a/xmake/core/sandbox/project.lua +++ /dev/null @@ -1,73 +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 http://www.gnu.org/licenses/ --- --- Copyright (C) 2009 - 2015, ruki All rights reserved. --- --- @author ruki --- @file project.lua --- - --- define module: project -local project = project or {} - --- load modules -local rule = require("base/rule") -local config = require("base/config") - --- get the build directory -function project.buildir() - - -- get it - return config.get("buildir") -end - --- get the project directory -function project.projectdir() - - -- get it - return xmake._PROJECT_DIR -end - --- get the log file -function project.logfile() - - -- get it - return rule.logfile() -end - --- get the current platform -function project.plat() - - -- get it - return config.get("plat") -end - --- get the current architecture -function project.arch() - - -- get it - return config.get("arch") -end - --- get the current mode -function project.mode() - - -- get it - return config.get("mode") -end - --- return module: project -return project diff --git a/xmake/core/sandbox/string.lua b/xmake/core/sandbox/string.lua new file mode 100644 index 000000000..f87460a39 --- /dev/null +++ b/xmake/core/sandbox/string.lua @@ -0,0 +1,63 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file string.lua +-- + +-- load modules +local string = require("base/string") +local sandbox = require("base/sandbox") + +-- define module +local sandbox_builtin_string = sandbox_builtin_string or {} + +-- inherit the public interfaces of string +for k, v in pairs(string) do + if not k:startswith("_") and type(v) == "function" then + sandbox_builtin_string[k] = v + end +end + +-- format string with the builtin variables +function sandbox_builtin_string.vformat(format, ...) + + -- check + assert(format) + + -- get the current sandbox instance + local instance = sandbox.instance() + assert(instance) + + -- format string + local result = string.format(format, ...) + assert(result) + + -- get filter from the current sandbox + local filter = instance:filter() + if filter then + result = filter:handle(result) + end + + -- ok? + return result +end + +-- return module +return sandbox_builtin_string + diff --git a/xmake/core/sandbox/table.lua b/xmake/core/sandbox/table.lua new file mode 100644 index 000000000..a697504fd --- /dev/null +++ b/xmake/core/sandbox/table.lua @@ -0,0 +1,25 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file table.lua +-- + +-- load module +return require("base/table") + diff --git a/xmake/core/sandbox/utils.lua b/xmake/core/sandbox/utils.lua new file mode 100644 index 000000000..9c80cb05d --- /dev/null +++ b/xmake/core/sandbox/utils.lua @@ -0,0 +1,46 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file utils.lua +-- + +-- load modules +local utils = require("base/utils") +local vformat = require("sandbox/vformat") + +-- define module +local sandbox_builtin_utils = sandbox_builtin_utils or {} + +-- inherit the public interfaces of utils +for k, v in pairs(utils) do + if not k:startswith("_") and type(v) == "function" then + sandbox_builtin_utils[k] = v + end +end + +-- printf with the builtin variables +function sandbox_builtin_utils.printf(format, ...) + + -- done + return print(vformat(format, ...)) +end + +-- return module +return sandbox_builtin_utils + diff --git a/xmake/core/sandbox/vformat.lua b/xmake/core/sandbox/vformat.lua new file mode 100644 index 000000000..eb8751856 --- /dev/null +++ b/xmake/core/sandbox/vformat.lua @@ -0,0 +1,26 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file vformat.lua +-- + +-- return module +return require("sandbox/string").vformat + + diff --git a/xmake/templates/c++/console_tbox/template.lua b/xmake/templates/c++/console_tbox/template.lua index 7bcf3001c..0b63ab745 100644 --- a/xmake/templates/c++/console_tbox/template.lua +++ b/xmake/templates/c++/console_tbox/template.lua @@ -14,7 +14,7 @@ add_macrofiles("src/xmake.lua") set_createscript(function () -- copy packages - os.cp(vformat("$(packagesdir)/tbox.pkg"), "pkg/tbox.pkg") - os.cp(vformat("$(packagesdir)/base.pkg"), "pkg/base.pkg") + os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg") + os.cp("$(packagesdir)/base.pkg", "pkg/base.pkg") end) diff --git a/xmake/templates/c++/shared_library_tbox/template.lua b/xmake/templates/c++/shared_library_tbox/template.lua index 89d0ecedf..56cff2596 100644 --- a/xmake/templates/c++/shared_library_tbox/template.lua +++ b/xmake/templates/c++/shared_library_tbox/template.lua @@ -17,11 +17,11 @@ add_macrofiles("src/_library/xmake.lua") set_createscript(function () -- rename target directory - os.mv("src/_library", vformat("src/$(targetname)")) - os.mv("src/_demo", vformat("src/$(targetname)_demo")) + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") -- copy packages - os.cp(vformat("$(packagesdir)/tbox.pkg"), "pkg/tbox.pkg") - os.cp(vformat("$(packagesdir)/base.pkg"), "pkg/base.pkg") + os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg") + os.cp("$(packagesdir)/base.pkg", "pkg/base.pkg") end) diff --git a/xmake/templates/c++/static_library_tbox/template.lua b/xmake/templates/c++/static_library_tbox/template.lua index 6b0ae2801..97e9fc089 100644 --- a/xmake/templates/c++/static_library_tbox/template.lua +++ b/xmake/templates/c++/static_library_tbox/template.lua @@ -17,11 +17,11 @@ add_macrofiles("src/_library/xmake.lua") set_createscript(function () -- rename target directory - os.mv("src/_library", vformat("src/$(targetname)")) - os.mv("src/_demo", vformat("src/$(targetname)_demo")) + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") -- copy packages - os.cp(vformat("$(packagesdir)/tbox.pkg"), "pkg/tbox.pkg") - os.cp(vformat("$(packagesdir)/base.pkg"), "pkg/base.pkg") + os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg") + os.cp("$(packagesdir)/base.pkg", "pkg/base.pkg") end) diff --git a/xmake/templates/c/console_tbox/template.lua b/xmake/templates/c/console_tbox/template.lua index 7bcf3001c..0b63ab745 100644 --- a/xmake/templates/c/console_tbox/template.lua +++ b/xmake/templates/c/console_tbox/template.lua @@ -14,7 +14,7 @@ add_macrofiles("src/xmake.lua") set_createscript(function () -- copy packages - os.cp(vformat("$(packagesdir)/tbox.pkg"), "pkg/tbox.pkg") - os.cp(vformat("$(packagesdir)/base.pkg"), "pkg/base.pkg") + os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg") + os.cp("$(packagesdir)/base.pkg", "pkg/base.pkg") end) diff --git a/xmake/templates/c/shared_library_tbox/template.lua b/xmake/templates/c/shared_library_tbox/template.lua index 89d0ecedf..56cff2596 100644 --- a/xmake/templates/c/shared_library_tbox/template.lua +++ b/xmake/templates/c/shared_library_tbox/template.lua @@ -17,11 +17,11 @@ add_macrofiles("src/_library/xmake.lua") set_createscript(function () -- rename target directory - os.mv("src/_library", vformat("src/$(targetname)")) - os.mv("src/_demo", vformat("src/$(targetname)_demo")) + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") -- copy packages - os.cp(vformat("$(packagesdir)/tbox.pkg"), "pkg/tbox.pkg") - os.cp(vformat("$(packagesdir)/base.pkg"), "pkg/base.pkg") + os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg") + os.cp("$(packagesdir)/base.pkg", "pkg/base.pkg") end) diff --git a/xmake/templates/c/static_library_tbox/template.lua b/xmake/templates/c/static_library_tbox/template.lua index 6b0ae2801..97e9fc089 100644 --- a/xmake/templates/c/static_library_tbox/template.lua +++ b/xmake/templates/c/static_library_tbox/template.lua @@ -17,11 +17,11 @@ add_macrofiles("src/_library/xmake.lua") set_createscript(function () -- rename target directory - os.mv("src/_library", vformat("src/$(targetname)")) - os.mv("src/_demo", vformat("src/$(targetname)_demo")) + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") -- copy packages - os.cp(vformat("$(packagesdir)/tbox.pkg"), "pkg/tbox.pkg") - os.cp(vformat("$(packagesdir)/base.pkg"), "pkg/base.pkg") + os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg") + os.cp("$(packagesdir)/base.pkg", "pkg/base.pkg") end) -- cgit v1.3.1