diff options
| author | ruki <[email protected]> | 2016-02-28 14:14:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-02-28 14:14:25 +0800 |
| commit | 5c154ce0b281f073fb6c8e475e932837da0d5117 (patch) | |
| tree | b670dfe584762f397fe466be227b09d375b1ec90 | |
| parent | 9212146ac3d022a54f659d87fb0ecd7a7db2bee4 (diff) | |
hide _OPTIONS
| -rw-r--r-- | xmake/core/_xmake_main.lua | 1 | ||||
| -rw-r--r-- | xmake/core/action/build.lua | 3 | ||||
| -rw-r--r-- | xmake/core/action/clean.lua | 3 | ||||
| -rw-r--r-- | xmake/core/action/config.lua | 3 | ||||
| -rw-r--r-- | xmake/core/action/create.lua | 3 | ||||
| -rw-r--r-- | xmake/core/action/install.lua | 3 | ||||
| -rw-r--r-- | xmake/core/action/lua.lua | 5 | ||||
| -rw-r--r-- | xmake/core/action/package.lua | 5 | ||||
| -rw-r--r-- | xmake/core/action/run.lua | 3 | ||||
| -rw-r--r-- | xmake/core/action/uninstall.lua | 3 | ||||
| -rw-r--r-- | xmake/core/base/action.lua | 5 | ||||
| -rw-r--r-- | xmake/core/base/compiler.lua | 7 | ||||
| -rw-r--r-- | xmake/core/base/config.lua | 8 | ||||
| -rw-r--r-- | xmake/core/base/global.lua | 6 | ||||
| -rw-r--r-- | xmake/core/base/linker.lua | 3 | ||||
| -rw-r--r-- | xmake/core/base/main.lua | 4 | ||||
| -rw-r--r-- | xmake/core/base/option.lua | 89 | ||||
| -rw-r--r-- | xmake/core/base/platform.lua | 3 | ||||
| -rw-r--r-- | xmake/core/base/project.lua | 3 | ||||
| -rw-r--r-- | xmake/core/base/utils.lua | 5 | ||||
| -rw-r--r-- | xmake/core/platforms/windows/tools/nmake.lua | 3 | ||||
| -rw-r--r-- | xmake/core/tools/make.lua | 9 | ||||
| -rw-r--r-- | xmake/core/tools/verbose.lua | 3 |
23 files changed, 112 insertions, 68 deletions
diff --git a/xmake/core/_xmake_main.lua b/xmake/core/_xmake_main.lua index 39f49e3a7..2a1a1d935 100644 --- a/xmake/core/_xmake_main.lua +++ b/xmake/core/_xmake_main.lua @@ -33,7 +33,6 @@ xmake._CORE_DIR = _PROGRAM_DIR .. "/core" xmake._PACKAGES_DIR = _PROGRAM_DIR .. "/packages" xmake._TEMPLATES_DIR = _PROGRAM_DIR .. "/templates" xmake._PROJECT_FILE = "xmake.lua" -xmake._OPTIONS = {} xmake._CONFIGS = {} -- init package path diff --git a/xmake/core/action/build.lua b/xmake/core/action/build.lua index 2279d1a42..8e0858c22 100644 --- a/xmake/core/action/build.lua +++ b/xmake/core/action/build.lua @@ -28,6 +28,7 @@ local rule = require("base/rule") local utils = require("base/utils") local clean = require("base/clean") local config = require("base/config") +local option = require("base/option") local project = require("base/project") local makefile = require("base/makefile") @@ -48,7 +49,7 @@ end function action_build.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- the target name diff --git a/xmake/core/action/clean.lua b/xmake/core/action/clean.lua index 863afd5e2..b6955c942 100644 --- a/xmake/core/action/clean.lua +++ b/xmake/core/action/clean.lua @@ -28,6 +28,7 @@ local clean = require("base/clean") local config = require("base/config") local project = require("base/project") local utils = require("base/utils") +local option = require("base/option") local platform = require("base/platform") -- need access to the given file? @@ -47,7 +48,7 @@ end function action_clean.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- check target diff --git a/xmake/core/action/config.lua b/xmake/core/action/config.lua index 825d97a25..741eb49e9 100644 --- a/xmake/core/action/config.lua +++ b/xmake/core/action/config.lua @@ -25,6 +25,7 @@ local action_config = action_config or {} -- load modules local utils = require("base/utils") +local option = require("base/option") local config = require("base/config") local project = require("base/project") local makefile = require("base/makefile") @@ -47,7 +48,7 @@ end function action_config.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- check target diff --git a/xmake/core/action/create.lua b/xmake/core/action/create.lua index cf6dbcd71..eb420959e 100644 --- a/xmake/core/action/create.lua +++ b/xmake/core/action/create.lua @@ -26,6 +26,7 @@ local action_create = action_create or {} -- load modules local path = require("base/path") local utils = require("base/utils") +local option = require("base/option") local template = require("base/template") -- need access to the given file? @@ -39,7 +40,7 @@ end function action_create.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- the target name diff --git a/xmake/core/action/install.lua b/xmake/core/action/install.lua index 407a5ae4b..581945093 100644 --- a/xmake/core/action/install.lua +++ b/xmake/core/action/install.lua @@ -26,6 +26,7 @@ local action_install = action_install or {} -- load modules local utils = require("base/utils") local config = require("base/config") +local option = require("base/option") local global = require("base/global") local install = require("base/install") local package = require("base/package") @@ -77,7 +78,7 @@ end function action_install.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- trace diff --git a/xmake/core/action/lua.lua b/xmake/core/action/lua.lua index 76e5f7f7c..9e22eb5ee 100644 --- a/xmake/core/action/lua.lua +++ b/xmake/core/action/lua.lua @@ -27,6 +27,7 @@ local action_lua = action_lua or {} local os = require("base/os") local path = require("base/path") local utils = require("base/utils") +local option = require("base/option") local config = require("base/config") local string = require("base/string") local tools = require("tools/tools") @@ -36,7 +37,7 @@ local platform = require("base/platform") function action_lua.need(name) -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- do not load config if be not given -f or -P options @@ -58,7 +59,7 @@ end function action_lua.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- no script? diff --git a/xmake/core/action/package.lua b/xmake/core/action/package.lua index 72a071886..22866081f 100644 --- a/xmake/core/action/package.lua +++ b/xmake/core/action/package.lua @@ -27,6 +27,7 @@ local action_package = action_package or {} local rule = require("base/rule") local path = require("base/path") local utils = require("base/utils") +local option = require("base/option") local config = require("base/config") local global = require("base/global") local string = require("base/string") @@ -106,7 +107,7 @@ function action_package._makeconf(target_name, target) assert(target_name and target) -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- the configs @@ -247,7 +248,7 @@ end function action_package.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- trace diff --git a/xmake/core/action/run.lua b/xmake/core/action/run.lua index f9c6aa061..df0db276a 100644 --- a/xmake/core/action/run.lua +++ b/xmake/core/action/run.lua @@ -27,6 +27,7 @@ local action_run = action_run or {} local rule = require("base/rule") local path = require("base/path") local utils = require("base/utils") +local option = require("base/option") local config = require("base/config") local project = require("base/project") local sandbox = require("base/sandbox") @@ -49,7 +50,7 @@ end function action_run.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options and xmake._PROJECT_DIR) -- the target name diff --git a/xmake/core/action/uninstall.lua b/xmake/core/action/uninstall.lua index b0dc99f6a..18938dc5f 100644 --- a/xmake/core/action/uninstall.lua +++ b/xmake/core/action/uninstall.lua @@ -27,6 +27,7 @@ local action_uninstall = action_uninstall or {} local utils = require("base/utils") local config = require("base/config") local global = require("base/global") +local option = require("base/option") local install = require("base/install") local uninstall = require("base/uninstall") local package = require("base/package") @@ -62,7 +63,7 @@ end function action_uninstall.done() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- trace diff --git a/xmake/core/base/action.lua b/xmake/core/base/action.lua index b1b92d3ec..3e713221e 100644 --- a/xmake/core/base/action.lua +++ b/xmake/core/base/action.lua @@ -27,6 +27,7 @@ local action = action or {} local os = require("base/os") local path = require("base/path") local utils = require("base/utils") +local option = require("base/option") local global = require("base/global") local config = require("base/config") local project = require("base/project") @@ -43,7 +44,7 @@ end function action._load_project() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- enter the project directory @@ -81,7 +82,7 @@ end function action.done(name) -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- load the given action diff --git a/xmake/core/base/compiler.lua b/xmake/core/base/compiler.lua index a95ed3109..afcab4ab7 100644 --- a/xmake/core/base/compiler.lua +++ b/xmake/core/base/compiler.lua @@ -29,6 +29,7 @@ local path = require("base/path") local rule = require("base/rule") local utils = require("base/utils") local table = require("base/table") +local option = require("base/option") local string = require("base/string") local config = require("base/config") local tools = require("tools/tools") @@ -486,7 +487,7 @@ function compiler.check_include(opt, include, srcpath, objpath) if not module then return end -- execute the compile command - return module:main(compiler._make_for_option(module, opt, srcpath, objpath, utils.ifelse(xmake._OPTIONS.verbose, nil, xmake._NULDEV))) + return module:main(compiler._make_for_option(module, opt, srcpath, objpath, utils.ifelse(option.options().verbose, nil, xmake._NULDEV))) end -- check function for the project option @@ -530,7 +531,7 @@ function compiler.check_function(opt, interface, srcpath, objpath) srcfile:close() -- execute the compile command - return module:main(compiler._make_for_option(module, opt, srcpath, objpath, utils.ifelse(xmake._OPTIONS.verbose, nil, xmake._NULDEV))) + return module:main(compiler._make_for_option(module, opt, srcpath, objpath, utils.ifelse(option.options().verbose, nil, xmake._NULDEV))) end -- check typedef for the project option @@ -574,7 +575,7 @@ function compiler.check_typedef(opt, typedef, srcpath, objpath) srcfile:close() -- execute the compile command - return module:main(compiler._make_for_option(module, opt, srcpath, objpath, utils.ifelse(xmake._OPTIONS.verbose, nil, xmake._NULDEV))) + return module:main(compiler._make_for_option(module, opt, srcpath, objpath, utils.ifelse(option.options().verbose, nil, xmake._NULDEV))) end -- return module: compiler diff --git a/xmake/core/base/config.lua b/xmake/core/base/config.lua index 97aa721f4..f41340e2e 100644 --- a/xmake/core/base/config.lua +++ b/xmake/core/base/config.lua @@ -35,7 +35,7 @@ local global = require("base/global") function config._make(configs) -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- init current target configure @@ -96,7 +96,7 @@ end function config._target() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- check @@ -198,7 +198,7 @@ end function config.load() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- check @@ -322,7 +322,7 @@ function config.load() local target = config._target() assert(target and type(target) == "table") - -- merge xmake._OPTIONS to target + -- merge option.options() to target if options._TASK == "config" then for k, v in pairs(options) do diff --git a/xmake/core/base/global.lua b/xmake/core/base/global.lua index a3d06acda..2c178af71 100644 --- a/xmake/core/base/global.lua +++ b/xmake/core/base/global.lua @@ -37,7 +37,7 @@ function global._make() assert(configs) -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- init current global configure @@ -125,7 +125,7 @@ end function global.load() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- check @@ -171,7 +171,7 @@ function global.load() -- xmake global? if options._TASK == "global" then - -- merge xmake._OPTIONS to the global configure + -- merge option.options() to the global configure for k, v in pairs(options) do -- check diff --git a/xmake/core/base/linker.lua b/xmake/core/base/linker.lua index 28cf0d72d..905d56c5e 100644 --- a/xmake/core/base/linker.lua +++ b/xmake/core/base/linker.lua @@ -27,6 +27,7 @@ local linker = linker or {} local utils = require("base/utils") local table = require("base/table") local string = require("base/string") +local option = require("base/option") local config = require("base/config") local compiler = require("base/compiler") local tools = require("tools/tools") @@ -379,7 +380,7 @@ function linker.check_links(opt, links, sourcefile, objectfile, targetfile) flags = utils.unique(flags) -- execute the link command - return module:main(module:command_link(objectfile, targetfile, table.concat(flags, " "):trim(), utils.ifelse(xmake._OPTIONS.verbose, nil, xmake._NULDEV))) + return module:main(module:command_link(objectfile, targetfile, table.concat(flags, " "):trim(), utils.ifelse(option.options().verbose, nil, xmake._NULDEV))) end -- return module: linker diff --git a/xmake/core/base/main.lua b/xmake/core/base/main.lua index a7e0fe0b1..4bc077ff6 100644 --- a/xmake/core/base/main.lua +++ b/xmake/core/base/main.lua @@ -49,7 +49,7 @@ local menu = function main._done_help() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- done help @@ -83,7 +83,7 @@ end function main._done_option() -- the options - local options = xmake._OPTIONS + local options = option.options() assert(options) -- done help? diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua index 473830518..70d5e31be 100644 --- a/xmake/core/base/option.lua +++ b/xmake/core/base/option.lua @@ -24,9 +24,13 @@ local option = option or {} -- load modules -local utils = require("base/utils") local table = require("base/table") +-- ifelse, a? b : c +function option._ifelse(a, b, c) + if a then return b else return c end +end + -- translate the menu function option._translate(menu) @@ -65,8 +69,8 @@ function option.init(argv, menu) assert(main) -- init _OPTIONS - xmake._OPTIONS = {} - xmake._OPTIONS._DEFAULTS = {} + option._OPTIONS = {} + option._OPTIONS._DEFAULTS = {} -- parse _ARGV to _OPTIONS local _iter, _s, _k = ipairs(argv) @@ -111,7 +115,7 @@ function option.init(argv, menu) print("invalid option: " .. arg) -- print menu - option.print_menu(xmake._OPTIONS._TASK) + option.print_menu(option._OPTIONS._TASK) -- failed return false @@ -122,7 +126,7 @@ function option.init(argv, menu) -- find this option local opt = nil - for _, o in ipairs(menu[xmake._OPTIONS._TASK or "main"].options) do + for _, o in ipairs(menu[option._OPTIONS._TASK or "main"].options) do -- check assert(o) @@ -145,7 +149,7 @@ function option.init(argv, menu) print("invalid option: " .. arg) -- print menu - option.print_menu(xmake._OPTIONS._TASK) + option.print_menu(option._OPTIONS._TASK) -- failed return false @@ -162,10 +166,10 @@ function option.init(argv, menu) if idx == nil or arg:startswith("-") then -- invalid option - print("invalid option: " .. utils.ifelse(idx, arg, key)) + print("invalid option: " .. option._ifelse(idx, arg, key)) -- print menu - option.print_menu(xmake._OPTIONS._TASK) + option.print_menu(option._OPTIONS._TASK) -- failed return false @@ -182,7 +186,7 @@ function option.init(argv, menu) print("invalid option: " .. arg) -- print menu - option.print_menu(xmake._OPTIONS._TASK) + option.print_menu(option._OPTIONS._TASK) -- failed return false @@ -196,7 +200,7 @@ function option.init(argv, menu) end -- save option - xmake._OPTIONS[utils.ifelse(prefix == 1 and opt[2], opt[2], key)] = value + option._OPTIONS[option._ifelse(prefix == 1 and opt[2], opt[2], key)] = value -- task? elseif idx == 1 then @@ -210,13 +214,13 @@ function option.init(argv, menu) -- ok? if taskname == key or menu[taskname].shortname == key then -- save this task - xmake._OPTIONS._TASK = taskname + option._OPTIONS._TASK = taskname break end end -- not found? - if not xmake._OPTIONS._TASK or not menu[xmake._OPTIONS._TASK] then + if not option._OPTIONS._TASK or not menu[option._OPTIONS._TASK] then -- invalid task print("invalid task: " .. key) @@ -234,7 +238,7 @@ function option.init(argv, menu) -- find a value option with name local opt = nil - for _, o in ipairs(menu[xmake._OPTIONS._TASK or "main"].options) do + for _, o in ipairs(menu[option._OPTIONS._TASK or "main"].options) do -- the mode local mode = o[3] @@ -246,7 +250,7 @@ function option.init(argv, menu) assert(o and ((mode ~= "v" and mode ~= "vs") or name)) -- is value and with name? - if mode == "v" and name and not xmake._OPTIONS[name] then + if mode == "v" and name and not option._OPTIONS[name] then opt = o break -- is values and with name? @@ -267,13 +271,13 @@ function option.init(argv, menu) -- save value if mode == "v" then - xmake._OPTIONS[name] = key + option._OPTIONS[name] = key elseif mode == "vs" then -- the option - local o = xmake._OPTIONS[name] + local o = option._OPTIONS[name] if not o then - xmake._OPTIONS[name] = {} - o = xmake._OPTIONS[name] + option._OPTIONS[name] = {} + o = option._OPTIONS[name] end -- append value @@ -284,7 +288,7 @@ function option.init(argv, menu) print("invalid option: " .. arg) -- print menu - option.print_menu(xmake._OPTIONS._TASK) + option.print_menu(option._OPTIONS._TASK) -- failed return false @@ -294,7 +298,7 @@ function option.init(argv, menu) end -- init the default value - for _, o in ipairs(menu[xmake._OPTIONS._TASK or "main"].options) do + for _, o in ipairs(menu[option._OPTIONS._TASK or "main"].options) do -- key=value? if o[3] == "kv" then @@ -304,11 +308,11 @@ function option.init(argv, menu) assert(key) -- save the default value - xmake._OPTIONS._DEFAULTS[key] = o[4] + option._OPTIONS._DEFAULTS[key] = o[4] -- value with name? elseif o[3] == "v" and o[2] then -- save the default value - xmake._OPTIONS._DEFAULTS[o[2]] = o[4] + option._OPTIONS._DEFAULTS[o[2]] = o[4] end end @@ -348,6 +352,27 @@ function option.find(argv, name, shortname) end end +-- get the given option +function option.get(name) + + -- check + assert(name) + + -- the options + local options = option.options() + assert(options) + + -- get it + return options[name] +end + +-- get all options +function option.options() + + -- get it + return option._OPTIONS +end + -- get all default options from the given task function option.defaults(task) @@ -496,7 +521,7 @@ function option.print_main() -- print category name print("") - utils.printf("%s%ss: ", string.sub(categoryname, 1, 1):upper(), string.sub(categoryname, 2)) + print(string.format("%s%ss: ", string.sub(categoryname, 1, 1):upper(), string.sub(categoryname, 2))) -- the padding spaces local padding = 42 @@ -555,19 +580,19 @@ function option.print_options(options) local padding = 42 -- print options - for _, option in ipairs(options) do + for _, opt in ipairs(options) do -- init the option info local option_info = "" -- append the shortname - local shortname = option[1]; - local name = option[2]; - local mode = option[3]; + local shortname = opt[1]; + local name = opt[2]; + local mode = opt[3]; if shortname then option_info = option_info .. " -" .. shortname if mode == "kv" then - option_info = option_info .. " " .. utils.ifelse(name, name:upper(), "XXX") + option_info = option_info .. " " .. option._ifelse(name, name:upper(), "XXX") end end @@ -576,7 +601,7 @@ function option.print_options(options) if mode == "v" then option_info = option_info .. " " .. name else - option_info = option_info .. utils.ifelse(shortname, ", --", " --") .. name + option_info = option_info .. option._ifelse(shortname, ", --", " --") .. name end if mode == "kv" then option_info = option_info .. "=" .. name:upper() @@ -591,13 +616,13 @@ function option.print_options(options) end -- append the option description - local description = option[5] + local description = opt[5] if description then option_info = option_info .. description end -- append the default value - local default = option[4] + local default = opt[4] if default then option_info = option_info .. " (default: " .. tostring(default) .. ")" end @@ -609,7 +634,7 @@ function option.print_options(options) for i = 6, 64 do -- the description, @note some option may be nil - local description = option[i] + local description = opt[i] if not description then break end -- is function? get results diff --git a/xmake/core/base/platform.lua b/xmake/core/base/platform.lua index 2a144d2a5..eaa286d3a 100644 --- a/xmake/core/base/platform.lua +++ b/xmake/core/base/platform.lua @@ -27,6 +27,7 @@ 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("base/config") local global = require("base/global") @@ -245,7 +246,7 @@ function platform.dump() assert(platform._CONFIGS) -- dump - if xmake._OPTIONS.verbose then + if option.options().verbose then utils.dump(platform._configs(config.get("plat"))) end diff --git a/xmake/core/base/project.lua b/xmake/core/base/project.lua index d50400755..812ce1558 100644 --- a/xmake/core/base/project.lua +++ b/xmake/core/base/project.lua @@ -30,6 +30,7 @@ local rule = require("base/rule") local path = require("base/path") local utils = require("base/utils") local table = require("base/table") +local option = require("base/option") local config = require("base/config") local filter = require("base/filter") local linker = require("base/linker") @@ -946,7 +947,7 @@ end function project.dump() -- dump - if xmake._OPTIONS.verbose then + if option.options().verbose then utils.dump(project.targets()) end diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua index a73034261..edc302352 100644 --- a/xmake/core/base/utils.lua +++ b/xmake/core/base/utils.lua @@ -23,6 +23,9 @@ -- define module: utils local utils = utils or {} +-- load modules +local option = require("base/option") + -- the printf function function utils.printf(msg, ...) @@ -36,7 +39,7 @@ end -- the verbose function function utils.verbose(msg, ...) - if xmake._OPTIONS.verbose then + if option.options().verbose then -- check assert(msg) diff --git a/xmake/core/platforms/windows/tools/nmake.lua b/xmake/core/platforms/windows/tools/nmake.lua index 21bdcc038..dc659cafd 100644 --- a/xmake/core/platforms/windows/tools/nmake.lua +++ b/xmake/core/platforms/windows/tools/nmake.lua @@ -26,6 +26,7 @@ local path = require("base/path") local utils = require("base/utils") local string = require("base/string") local config = require("base/config") +local option = require("base/option") local platform = require("base/platform") -- define module: nmake @@ -38,7 +39,7 @@ function nmake.init(self, name) self.name = name or "nmake.exe" -- is verbose? - self._VERBOSE = utils.ifelse(xmake._OPTIONS.verbose, "-v", "") + self._VERBOSE = utils.ifelse(option.options().verbose, "-v", "") end diff --git a/xmake/core/tools/make.lua b/xmake/core/tools/make.lua index 568ddd2b4..74bd4a5f4 100644 --- a/xmake/core/tools/make.lua +++ b/xmake/core/tools/make.lua @@ -23,6 +23,7 @@ -- load modules local os = require("base/os") local utils = require("base/utils") +local option = require("base/option") -- define module: make local make = make or {} @@ -34,7 +35,7 @@ function make.init(self, name) self.name = name or "make" -- is verbose? - self._VERBOSE = utils.ifelse(xmake._OPTIONS.verbose, "-v", "") + self._VERBOSE = utils.ifelse(option.options().verbose, "-v", "") end @@ -43,9 +44,9 @@ function make.main(self, mkfile, target) -- enable jobs? local jobs = "" - if xmake._OPTIONS.jobs ~= nil then - if tonumber(xmake._OPTIONS.jobs) ~= 0 then - jobs = "-j" .. xmake._OPTIONS.jobs + if option.options().jobs ~= nil then + if tonumber(option.options().jobs) ~= 0 then + jobs = "-j" .. option.options().jobs else jobs = "-j" end diff --git a/xmake/core/tools/verbose.lua b/xmake/core/tools/verbose.lua index 5a76412d8..04e843e76 100644 --- a/xmake/core/tools/verbose.lua +++ b/xmake/core/tools/verbose.lua @@ -27,12 +27,13 @@ local verbose = verbose or {} -- load modules local io = require("base/io") local string = require("base/string") +local option = require("base/option") -- the main function function verbose.main(self, ...) -- verbose all - if xmake._OPTIONS.verbose then + if option.options().verbose then for _, v in ipairs(...) do io.write(string.format("%s ", v:decode())) end |
