diff options
| author | ruki <[email protected]> | 2021-02-26 00:11:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-26 00:11:47 +0800 |
| commit | 4a385a981f83ad40d19d590dd147e7f88525cc3a (patch) | |
| tree | 0ab40ec67135c6d98ea506f5fab21f6b571cdde2 | |
| parent | dce905c7c5c7edd59666fd9f9078cc0432f9091e (diff) | |
remove deprecated add_defines_h and add_defines_if_ok
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | xmake/actions/config/configheader.lua | 42 | ||||
| -rw-r--r-- | xmake/core/project/deprecated/project.lua | 40 | ||||
| -rw-r--r-- | xmake/core/project/project.lua | 12 | ||||
| -rw-r--r-- | xmake/core/tool/builder.lua | 11 | ||||
| -rw-r--r-- | xmake/languages/c++/api.lua | 10 | ||||
| -rw-r--r-- | xmake/languages/objc++/api.lua | 6 |
7 files changed, 4 insertions, 119 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 543ebc82e..bf81ba15f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ * [#1065](https://github.com/xmake-io/xmake/issues/1065): Improve protobuf rule to support compile_commands generators * [#1249](https://github.com/xmake-io/xmake/issues/1249): Improve vs/vsxmake generator to support startproject * [#605](https://github.com/xmake-io/xmake/issues/605): Improve to link orders for add_deps/add_packages +* Remove deprecated `add_defines_h_if_ok` and `add_defines_h` apis for option ### Bugs fixed @@ -960,6 +961,7 @@ * [#1065](https://github.com/xmake-io/xmake/issues/1065): 改进 protobuf 规则,支持 compile_commands 生成器 * [#1249](https://github.com/xmake-io/xmake/issues/1249): 改进 vs/vsxmake 生成器去支持启动工程设置 * [#605](https://github.com/xmake-io/xmake/issues/605): 改进 add_deps 和 add_packages 直接的导出 links 顺序 +* 移除废弃的 `add_defines_h_if_ok` and `add_defines_h` 接口 ### Bugs 修复 diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua index e693d0b3e..7372f07c8 100644 --- a/xmake/actions/config/configheader.lua +++ b/xmake/actions/config/configheader.lua @@ -69,48 +69,6 @@ function _make_for_target(target) file:print("") end - -- make the defines - local defines = table.copy(target:get("defines_h")) - - -- make the undefines - local undefines = table.copy(target:get("undefines_h")) - - -- make the defines for options - for _, opt in ipairs(target:orderopts()) do - table.join2(defines, opt:get("defines_h")) - table.join2(defines, opt:get("defines_h_if_ok")) -- deprecated - table.join2(undefines, opt:get("undefines_h")) - table.join2(undefines, opt:get("undefines_h_if_ok")) -- deprecated - end - - -- make the defines for packages - for _, pkg in ipairs(target:orderpkgs()) do - table.join2(defines, pkg:get("defines_h")) - table.join2(undefines, pkg:get("undefines_h")) - end - - -- make the defines - if #defines ~= 0 then - file:print("// defines") - for _, define in ipairs(defines) do - if define:find("=") then - file:print("#define %s", define:gsub("=", " "):gsub("%$%((.-)%)", function (w) if w == "prefix" then return configprefix end end)) - else - file:print("#define %s 1", define:gsub("%$%((.-)%)", function (w) if w == "prefix" then return configprefix end end)) - end - end - file:print("") - end - - -- make the undefines - if #undefines ~= 0 then - file:print("// undefines") - for _, undefine in ipairs(undefines) do - file:print("#undef %s", undefine:gsub("%$%((.-)%)", function (w) if w == "prefix" then return configprefix end end)) - end - file:print("") - end - -- make the tail file:print("#endif") diff --git a/xmake/core/project/deprecated/project.lua b/xmake/core/project/deprecated/project.lua index e90f5ad26..ea6a103d8 100644 --- a/xmake/core/project/deprecated/project.lua +++ b/xmake/core/project/deprecated/project.lua @@ -170,42 +170,6 @@ function deprecated_project._api_target_add_headerdirs(interp) end) end --- add_defines_h for target -function deprecated_project._api_target_add_defines_h(interp) - - -- get api function - local apifunc = interp:_api_within_scope("target", "add_defines_h") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("target", "add_defines_h", function (value, ...) - - -- deprecated - deprecated.add("add_configfiles() and set_configvar(%s)", "add_defines_h(%s)", tostring(value)) - - -- dispatch it - apifunc(value, ...) - end) -end - --- add_defines_h for option -function deprecated_project._api_option_add_defines_h(interp) - - -- get api function - local apifunc = interp:_api_within_scope("option", "add_defines_h") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("option", "add_defines_h", function (value, ...) - - -- deprecated - deprecated.add("add_configfiles() and set_configvar(%s)", "add_defines_h(%s)", tostring(value)) - - -- dispatch it - apifunc(value, ...) - end) -end - -- set_config_header for target function deprecated_project._api_target_set_config_header(interp) @@ -341,9 +305,7 @@ function deprecated_project.api_register(interp) deprecated_project._api_target_add_headers(interp) deprecated_project._api_target_add_headerdirs(interp) - -- register api: add_defines_h()/set_config_header() to option/target - deprecated_project._api_option_add_defines_h(interp) - deprecated_project._api_target_add_defines_h(interp) + -- register api: set_config_header() to option/target deprecated_project._api_target_set_config_header(interp) -- register api: set_headerdir() to target diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index ba97f973b..75cfa106e 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -560,20 +560,8 @@ function project._load_options(disable_filter) -- check options local options = {} for optionname, optioninfo in pairs(results) do - - -- init an option instance local instance = option.new(optionname, optioninfo) - - -- save it options[optionname] = instance - - -- mark add_defines_h_if_ok and add_undefines_h_if_ok as deprecated - if instance:get("defines_h_if_ok") then - deprecated.add("add_defines_h(\"%s\")", "add_defines_h_if_ok(\"%s\")", table.concat(table.wrap(instance:get("defines_h_if_ok")), "\", \"")) - end - if instance:get("undefines_h_if_ok") then - deprecated.add("add_undefines_h(\"%s\")", "add_undefines_h_if_ok(\"%s\")", table.concat(table.wrap(instance:get("undefines_h_if_ok")), "\", \"")) - end end -- load and attach options deps diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 2e503022e..48ba6777e 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -308,16 +308,7 @@ function builder:_add_flags_from_language(flags, target, getters) if getter then -- get api name of tool - -- - -- ignore "nf_" and "_if_ok" (deprecated) - -- - -- e.g. - -- - -- defines => define - -- defines_if_ok => define - -- ... - -- - local apiname = flagname:gsub("^nf_", ""):gsub("_if_ok$", "") + local apiname = flagname:gsub("^nf_", "") -- use multiple values mapper if be defined in tool module local multival = false diff --git a/xmake/languages/c++/api.lua b/xmake/languages/c++/api.lua index 29e59ef60..277223139 100644 --- a/xmake/languages/c++/api.lua +++ b/xmake/languages/c++/api.lua @@ -80,7 +80,6 @@ function _api_add_cfunc(interp, module, alias, links, includes, func) interp:api_call("add_cfuncs", func) if links then interp:api_call("add_links", links) end if includes then interp:api_call("add_cincludes", includes) end - interp:api_call("add_defines_h", define) -- restore the current scope interp:scope_restore(scope) @@ -134,7 +133,6 @@ function _api_add_cxxfunc(interp, module, alias, links, includes, func) interp:api_call("add_cxxfuncs", func) if links then interp:api_call("add_links", links) end if includes then interp:api_call("add_cxxincludes", includes) end - interp:api_call("add_defines_h", define) -- restore the current scope interp:scope_restore(scope) @@ -172,8 +170,6 @@ function apis() , "target.add_shflags" , "target.add_defines" , "target.add_undefines" - , "target.add_defines_h" - , "target.add_undefines_h" , "target.add_frameworks" , "target.add_rpathdirs" -- @note do not translate path, it's usually an absolute path or contains $ORIGIN/@loader_path -- option.add_xxx @@ -192,13 +188,7 @@ function apis() , "option.add_arflags" , "option.add_shflags" , "option.add_defines" - , "option.add_defines_h" -- TODO deprecated - , "option.add_defines_if_ok" -- TODO deprecated - , "option.add_defines_h_if_ok" -- TODO deprecated , "option.add_undefines" - , "option.add_undefines_h" -- TODO deprecated - , "option.add_undefines_if_ok" -- TODO deprecated - , "option.add_undefines_h_if_ok"-- TODO deprecated , "option.add_frameworks" , "option.add_rpathdirs" -- package.add_xxx diff --git a/xmake/languages/objc++/api.lua b/xmake/languages/objc++/api.lua index 0816e3d15..656bc2174 100644 --- a/xmake/languages/objc++/api.lua +++ b/xmake/languages/objc++/api.lua @@ -37,8 +37,6 @@ function apis() , "target.add_shflags" , "target.add_defines" , "target.add_undefines" - , "target.add_defines_h" - , "target.add_undefines_h" , "target.add_frameworks" , "target.add_rpathdirs" -- @note do not translate path, it's usually an absolute path or contains $ORIGIN/@loader_path -- option.add_xxx @@ -57,11 +55,7 @@ function apis() , "option.add_arflags" , "option.add_shflags" , "option.add_defines" - , "option.add_defines_if_ok" - , "option.add_defines_h_if_ok" , "option.add_undefines" - , "option.add_undefines_if_ok" - , "option.add_undefines_h_if_ok" , "option.add_frameworks" , "option.add_rpathdirs" -- toolchain.add_xxx |
