From d574d28425a53e7d542b32719b250e43366c16be Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 23:34:34 +0800 Subject: [PATCH 1/4] remove some deprecated apis --- xmake/actions/config/configheader.lua | 115 --------------- xmake/actions/config/main.lua | 4 - xmake/actions/package/oldpkg/main.lua | 6 - xmake/core/project/deprecated/project.lua | 122 ---------------- xmake/core/project/target.lua | 132 ++--------------- xmake/languages/c++/load.lua | 138 +----------------- xmake/modules/target/action/clean/main.lua | 3 - xmake/plugins/project/cmake/cmakelists.lua | 5 - xmake/plugins/project/vstudio/impl/vs201x.lua | 56 ------- xmake/plugins/project/vsxmake/getinfo.lua | 2 - 10 files changed, 14 insertions(+), 569 deletions(-) delete mode 100644 xmake/actions/config/configheader.lua diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua deleted file mode 100644 index 995bf7a1b1..0000000000 --- a/xmake/actions/config/configheader.lua +++ /dev/null @@ -1,115 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-present, TBOOX Open Source Group. --- --- @author ruki --- @file configheader.lua --- - --- imports -import("core.base.option") -import("core.project.config") -import("core.project.project") - --- make configure for the given target name -function _make_for_target(target) - - -- get the target configure file - local configheader = target:configheader() - if not configheader then return end - - -- get the config prefix - local configprefix = target:configprefix() - - -- open the file - local file = _g.configfiles[configheader] or io.open(path.join(os.tmpdir(), hash.uuid4(configheader)), "w") - - -- make the head - if _g.configfiles[configheader] then file:print("") end - file:print("#ifndef %s_H", configprefix) - file:print("#define %s_H", configprefix) - file:print("") - - -- make version - local version, version_build = target:configversion() - if not version or not version_build then - local target_version, target_version_build = target:version() - if not version then - version = target_version - end - if not version_build then - version_build = target_version_build - end - end - if version then - file:print("// version") - file:print("#define %s_VERSION \"%s\"", configprefix, version) - local i = 1 - local m = {"MAJOR", "MINOR", "ALTER"} - for v in version:gmatch("%d+") do - file:print("#define %s_VERSION_%s %s", configprefix, m[i], v) - i = i + 1 - if i > 3 then break end - end - if version_build then - file:print("#define %s_VERSION_BUILD %s", configprefix, version_build) - end - file:print("") - end - - -- make the tail - file:print("#endif") - - -- cache the file - _g.configfiles[configheader] = file -end - --- the main entry function -function main() - - -- enter project directory - local oldir = os.cd(project.directory()) - - -- make configure for the given target name - _g.configfiles = {} - _g.configpathes = {} - - -- make configure for all targets - for _, target in pairs(project.targets()) do - _make_for_target(target) - end - - -- close and update files - for configpath, configfile_tmp in pairs(_g.configfiles) do - - -- close the temporary file first - configfile_tmp:close() - - -- update file if the content is changed - local configpath_tmp = path.join(os.tmpdir(), hash.uuid4(configpath)) - if os.isfile(configpath_tmp) then - if os.isfile(configpath) then - if io.readfile(configpath_tmp) ~= io.readfile(configpath) then - os.cp(configpath_tmp, configpath) - end - else - os.cp(configpath_tmp, configpath) - end - end - end - - -- leave project directory - os.cd(oldir) -end diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 70378ebfb1..47f5427067 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -30,7 +30,6 @@ import("core.cache.localcache") import("scangen") import("menuconf", {alias = "menuconf_show"}) import("configfiles", {alias = "generate_configfiles"}) -import("configheader", {alias = "generate_configheader"}) import("private.action.require.check", {alias = "check_packages"}) import("private.action.require.install", {alias = "install_packages"}) import("private.service.remote_build.action", {alias = "remote_build_action"}) @@ -404,9 +403,6 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) -- update the config files generate_configfiles({force = recheck}) - if recheck then - generate_configheader() - end end -- dump config diff --git a/xmake/actions/package/oldpkg/main.lua b/xmake/actions/package/oldpkg/main.lua index 4dea87c4b4..4c75e92619 100644 --- a/xmake/actions/package/oldpkg/main.lua +++ b/xmake/actions/package/oldpkg/main.lua @@ -55,12 +55,6 @@ function _package_library(target) end end - -- copy the config.h to the output directory (deprecated) - local configheader = target:configheader() - if configheader then - os.vcp(configheader, format("%s/%s.pkg/$(plat)/$(arch)/include/%s", outputdir, targetname, path.filename(configheader))) - end - -- copy headers local srcheaders, dstheaders = target:headerfiles(format("%s/%s.pkg/$(plat)/$(arch)/include", outputdir, targetname)) if srcheaders and dstheaders then diff --git a/xmake/core/project/deprecated/project.lua b/xmake/core/project/deprecated/project.lua index f2e60d248b..0336784e07 100644 --- a/xmake/core/project/deprecated/project.lua +++ b/xmake/core/project/deprecated/project.lua @@ -32,130 +32,8 @@ local config = require("project/config") local platform = require("platform/platform") local deprecated = require("base/deprecated") --- add_headers for target -function deprecated_project._api_target_add_headers(interp) - - -- get api function - local apifunc = interp:_api_within_scope("target", "add_headers") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("target", "add_headers", function (value, ...) - - -- deprecated - deprecated.add("add_headerfiles(%s)", "add_headers(%s)", tostring(value)) - - -- dispatch it - apifunc(value, ...) - end) -end - --- set_config_header for target -function deprecated_project._api_target_set_config_header(interp) - - -- get api function - local apifunc = interp:_api_within_scope("target", "set_config_header") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("target", "set_config_header", function (value, ...) - - -- deprecated - deprecated.add("add_configfiles(%s.in)", "set_config_header(%s)", tostring(value)) - - -- dispatch it - apifunc(value, ...) - end) -end - --- set_headerdir for target -function deprecated_project._api_target_set_headerdir(interp) - - -- get api function - local apifunc = interp:_api_within_scope("target", "set_headerdir") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("target", "set_headerdir", function (value, ...) - - -- deprecated - deprecated.add(false, "set_headerdir(%s)", tostring(value)) - - -- dispatch it - apifunc(value, ...) - end) -end - --- set_tools for target -function deprecated_project._api_target_set_tools(interp) - - -- get api function - local apifunc = interp:_api_within_scope("target", "set_tools") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("target", "set_tools", function (key, value, ...) - - -- deprecated - deprecated.add("set_toolset(%s, %s)", "set_tools(%s, %s)", tostring(key), tostring(value)) - - -- dispatch it - apifunc(key, value, ...) - end) -end - --- set_toolchain for target -function deprecated_project._api_target_set_toolchain(interp) - - -- get api function - local apifunc = interp:_api_within_scope("target", "set_toolchain") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("target", "set_toolchain", function (key, value, ...) - - -- deprecated - deprecated.add("set_toolset(%s, %s)", "set_toolchain(%s, %s)", tostring(key), tostring(value)) - - -- dispatch it - apifunc(key, value, ...) - end) -end - --- add_tools for target -function deprecated_project._api_target_add_tools(interp) - - -- get api function - local apifunc = interp:_api_within_scope("target", "add_tools") - assert(apifunc) - - -- register api - interp:_api_within_scope_set("target", "add_tools", function (key, value, ...) - - -- deprecated - deprecated.add("set_toolset(%s, %s)", "add_tools(%s, %s)", tostring(key), tostring(value)) - - -- dispatch it - apifunc(key, value, ...) - end) -end - -- register api function deprecated_project.api_register(interp) - - -- register api: add_headers() to target - deprecated_project._api_target_add_headers(interp) - - -- register api: set_config_header() to option/target - deprecated_project._api_target_set_config_header(interp) - - -- register api: set_headerdir() to target - deprecated_project._api_target_set_headerdir(interp) - - -- register api: set_toolchain/set_tools/add_tools() to target - deprecated_project._api_target_set_tools(interp) - deprecated_project._api_target_add_tools(interp) - deprecated_project._api_target_set_toolchain(interp) end -- return module: deprecated_project diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 0a1c68a4ae..d634dfe428 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1287,11 +1287,6 @@ function _instance:scriptdir() return self:get("__scriptdir") end --- TODO get header directory (deprecated) -function _instance:headerdir() - return self:get("headerdir") or config.buildir() -end - -- get configuration output directory function _instance:configdir() return self:get("configdir") or config.buildir() @@ -1633,35 +1628,22 @@ function _instance:objectfiles() return objectfiles end --- TODO get the header files, get("headers") (deprecated) -function _instance:headers(outputdir) - return self:headerfiles(outputdir, {only_deprecated = true}) -end - -- get the header files --- --- default: get("headers") + get("headerfiles") --- only_deprecated: get("headers") --- function _instance:headerfiles(outputdir, opt) -- get header files? opt = opt or {} - local headers = self:get("headers") -- TODO deprecated - local only_deprecated = opt.only_deprecated - if not only_deprecated then - headers = table.join(headers or {}, self:get("headerfiles")) - -- add_headerfiles("src/*.h", {install = false}) - -- @see https://github.com/xmake-io/xmake/issues/2577 - if opt.installonly then - local installfiles = {} - for _, headerfile in ipairs(table.wrap(headers)) do - if self:extraconf("headerfiles", headerfile, "install") ~= false then - table.insert(installfiles, headerfile) - end + local headers = table.join(headers or {}, self:get("headerfiles")) + -- add_headerfiles("src/*.h", {install = false}) + -- @see https://github.com/xmake-io/xmake/issues/2577 + if opt.installonly then + local installfiles = {} + for _, headerfile in ipairs(table.wrap(headers)) do + if self:extraconf("headerfiles", headerfile, "install") ~= false then + table.insert(installfiles, headerfile) end - headers = installfiles end + headers = installfiles end if not headers then return @@ -1670,9 +1652,7 @@ function _instance:headerfiles(outputdir, opt) -- get the installed header directory local headerdir = outputdir if not headerdir then - if only_deprecated then - headerdir = self:headerdir() - elseif self:installdir() then + if self:installdir() then headerdir = path.join(self:installdir(), "include") end end @@ -2025,78 +2005,6 @@ function _instance:script(name, generic) return result end --- TODO get the config header version (deprecated) -function _instance:configversion() - - -- get the config version and build version - local version = nil - local buildversion = nil - local configheader = self:get("config_header") - local configheader_extra = self:get("__extra_config_header") - if type(configheader_extra) == "table" then - version = table.wrap(configheader_extra[configheader]).version - buildversion = self._CONFIGHEADER_BUILDVERSION - if not buildversion then - buildversion = table.wrap(configheader_extra[configheader]).buildversion - if buildversion then - buildversion = os.date(buildversion, os.time()) - end - self._CONFIGHEADER_BUILDVERSION = buildversion - end - end - - -- ok? - return version, buildversion -end - --- get the config header prefix -function _instance:configprefix() - - -- get the config prefix - local configprefix = nil - local configheader = self:get("config_header") - local configheader_extra = self:get("__extra_config_header") - if type(configheader_extra) == "table" then - configprefix = table.wrap(configheader_extra[configheader]).prefix - end - return configprefix -end - --- get the config header files (deprecated) -function _instance:configheader(outputdir) - - -- get config header - local configheader = self:get("config_header") - if not configheader then - return - end - - -- get the root directory - local rootdir, count = configheader:gsub("|.*$", ""):gsub("%(.*%)$", "") - if count == 0 then - rootdir = nil - end - if rootdir and rootdir:trim() == "" then - rootdir = "." - end - - -- remove '(' and ')' - configheader = configheader:gsub("[%(%)]", "") - - -- get the output header - local outputheader = nil - if outputdir then - if rootdir then - outputheader = path.absolute(path.relative(configheader, rootdir), outputdir) - else - outputheader = path.join(outputdir, path.filename(configheader)) - end - end - - -- ok - return configheader, outputheader -end - -- get the precompiled header file (xxx.[h|hpp|inl]) -- -- @param langkind c/cxx @@ -2203,23 +2111,16 @@ function _instance:tool(toolkind) end return toolchain.tool(self:toolchains(), toolkind, {cachekey = "target_" .. self:name(), plat = self:plat(), arch = self:arch(), before_get = function() - -- get program from set_toolchain/set_tools (deprecated) - local toolname - local program = self:get("toolset." .. toolkind) or self:get("toolchain." .. toolkind) - if not program then - local tools = self:get("tools") -- TODO: deprecated - if tools then - program = tools[toolkind] - end - end -- get program from `xmake f --cc` + local program if not program and not self:get("toolchains") then program = config.get(toolkind) end -- contain toolname? parse it, e.g. 'gcc@xxxx.exe' -- https://github.com/xmake-io/xmake/issues/1361 - if program and not toolname then + local toolname + if program then local pos = program:find('@', 1, true) if pos then -- we need to ignore valid path with `@`, e.g. /usr/local/opt/go@1.17/bin/go @@ -2513,7 +2414,6 @@ function target.apis() "target.set_values" , "target.set_configvar" , "target.set_runenv" - , "target.set_toolchain" -- TODO: deprecated , "target.set_toolset" , "target.set_policy" -- target.add_xxx @@ -2540,12 +2440,6 @@ function target.apis() , "target.remove_files" , "target.remove_headerfiles" } - , dictionary = - { - -- target.set_xxx - "target.set_tools" -- TODO: deprecated - , "target.add_tools" -- TODO: deprecated - } , script = { -- target.on_xxx diff --git a/xmake/languages/c++/load.lua b/xmake/languages/c++/load.lua index 16380ab3c2..828385f6f0 100644 --- a/xmake/languages/c++/load.lua +++ b/xmake/languages/c++/load.lua @@ -18,132 +18,6 @@ -- @file load.lua -- --- get function name and function info --- --- sigsetjmp --- sigsetjmp((void*)0, 0) --- sigsetjmp{sigsetjmp((void*)0, 0);} --- sigsetjmp{int a = 0; sigsetjmp((void*)a, a);} --- -function _funcinfo(func) - local name, code = string.match(func, "(.+){(.+)}") - if code == nil then - local pos = func:find("%(") - if pos then - name = func:sub(1, pos - 1) - code = func - else - name = func - code = string.format("volatile void* p%s = (void*)&%s;", name, name) - end - end - return name:trim(), code -end - --- TODO add c function, deprecated -function _api_add_cfunc(interp, module, alias, links, includes, func) - - -- parse the function info - local funcname, funccode = _funcinfo(func) - - -- make the option name - local name = nil - if module ~= nil then - name = format("__%s_%s", module, funcname) - else - name = format("__%s", funcname) - end - - -- uses the alias name - if alias ~= nil then - funcname = alias - end - - -- make the option define - local define = nil - if module ~= nil then - define = format("$(prefix)_%s_HAVE_%s", module:upper(), funcname:upper()) - else - define = format("$(prefix)_HAVE_%s", funcname:upper()) - end - - -- save the current scope - interp:api_builtin_save_scope() - - -- check option - interp:api_call("option", name) - interp:api_call("set_category", "cfuncs") - 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 - - -- restore the current scope - interp:api_builtin_restore_scope() - - -- add this option - interp:api_call("add_options", name) -end - --- TODO add c functions, deprecated -function _api_add_cfuncs(interp, module, links, includes, ...) - wprint("target.add_cfuncs is deprecated, please use option.add_cfuncs()") - for _, func in ipairs({...}) do - _api_add_cfunc(interp, module, nil, links, includes, func) - end -end - --- TODO add c++ function, deprecated -function _api_add_cxxfunc(interp, module, alias, links, includes, func) - - -- parse the function info - local funcname, funccode = _funcinfo(func) - - -- make the option name - local name = nil - if module ~= nil then - name = format("__%s_%s", module, funcname) - else - name = format("__%s", funcname) - end - - -- uses the alias name - if alias ~= nil then - funcname = alias - end - - -- make the option define - local define = nil - if module ~= nil then - define = format("$(prefix)_%s_HAVE_%s", module:upper(), funcname:upper()) - else - define = format("$(prefix)_HAVE_%s", funcname:upper()) - end - - -- save the current scope - interp:api_builtin_save_scope() - - -- check option - interp:api_call("option", name) - interp:api_call("set_category", "cxxfuncs") - 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 - - -- restore the current scope - interp:api_builtin_restore_scope() - - -- add this option - interp:api_call("add_options", name) -end - --- TODO add c++ functions, deprecated -function _api_add_cxxfuncs(interp, module, links, includes, ...) - wprint("target.add_cxxfuncs is deprecated, please use option.add_cxxfuncs()") - for _, func in ipairs({...}) do - _api_add_cxxfunc(interp, module, nil, links, includes, func) - end -end - -- get apis function _get_apis() local apis = {} @@ -217,12 +91,9 @@ function _get_apis() } apis.paths = { -- target.set_xxx - "target.set_headerdir" -- TODO deprecated - , "target.set_config_header" -- TODO deprecated - , "target.set_pcheader" + "target.set_pcheader" , "target.set_pcxxheader" -- target.add_xxx - , "target.add_headers" -- TODO deprecated , "target.add_headerfiles" , "target.add_linkdirs" , "target.add_includedirs" @@ -239,13 +110,6 @@ function _get_apis() "option.add_csnippets" , "option.add_cxxsnippets" } - apis.custom = { - -- target.add_xxx - {"target.add_cfunc", _api_add_cfunc } - , {"target.add_cfuncs", _api_add_cfuncs } - , {"target.add_cxxfunc", _api_add_cxxfunc } - , {"target.add_cxxfuncs", _api_add_cxxfuncs } - } return apis end diff --git a/xmake/modules/target/action/clean/main.lua b/xmake/modules/target/action/clean/main.lua index 0335aa648f..d492c38b11 100644 --- a/xmake/modules/target/action/clean/main.lua +++ b/xmake/modules/target/action/clean/main.lua @@ -67,9 +67,6 @@ function main(target) local _, configfiles = target:configfiles() remove_files(configfiles) - -- TODO remove the config.h file (deprecated) - remove_files(target:configheader()) - -- remove all dependent files for each platform remove_files(target:dependir({root = true})) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 0c78ba4bf0..54d87a2515 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -482,11 +482,6 @@ function _add_target_include_directories(cmakelists, target, outputdir) end cmakelists:print(")") end - -- export config header directory (deprecated) - local configheader = target:configheader() - if configheader then - cmakelists:print("target_include_directories(%s PUBLIC %s)", target:name(), _get_relative_unix_path(path.directory(configheader), outputdir)) - end end -- add target system include directories diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index cc00c6b8e4..511494b19a 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -38,7 +38,6 @@ import("core.cache.localcache") import("private.action.require.install", {alias = "install_requires"}) import("private.action.run.runenvs") import("actions.config.configfiles", {alias = "generate_configfiles", rootdir = os.programdir()}) -import("actions.config.configheader", {alias = "generate_configheader", rootdir = os.programdir()}) import("private.utils.batchcmds") function _translate_path(dir, vcxprojdir) @@ -380,57 +379,6 @@ function _make_targetinfo(mode, arch, target, vcxprojdir) return targetinfo end --- make target headers -function _make_targetheaders(mode, arch, target, last) - - -- only for static and shared target - local kind = target:kind() - if kind == "static" or kind == "shared" then - - -- TODO make headers, (deprecated) - local srcheaders, dstheaders = target:headers() - if srcheaders and dstheaders then - local i = 1 - for _, srcheader in ipairs(srcheaders) do - local dstheader = dstheaders[i] - if dstheader then - os.cp(srcheader, dstheader) - end - i = i + 1 - end - end - - -- make config header - local configheader_raw = target:configheader() - if configheader_raw and os.isfile(configheader_raw) then - - -- init the config header path for each mode and arch - local configheader_mode_arch = path.join(path.directory(configheader_raw), mode .. "." .. arch .. "." .. path.filename(configheader_raw)) - - -- init the temporary config header path - local configheader_tmp = path.join(path.directory(configheader_raw), "tmp." .. path.filename(configheader_raw)) - - -- copy the original config header first - os.cp(configheader_raw, configheader_mode_arch) - - -- append the current config header - local file = io.open(configheader_tmp, "a+") - if file then - file:print("") - file:print("#if defined(__config_%s__) && defined(__config_%s__)", mode, arch) - file:print("# include \"%s.%s.%s\"", mode, arch, path.filename(configheader_raw)) - file:print("#endif") - file:close() - end - - -- override the raw config header at last - if last and os.isfile(configheader_tmp) then - os.mv(configheader_tmp, configheader_raw) - end - end - end -end - function _make_vsinfo_modes() local vsinfo_modes = {} local modes = option.get("modes") @@ -553,7 +501,6 @@ function make(outputdir, vsinfo) -- update config files generate_configfiles() - generate_configheader() end -- ensure to enter project directory @@ -607,9 +554,6 @@ function make(outputdir, vsinfo) end mergedconf.plain = groupconf.plain or mergedconf.plain end - - -- make target headers - _make_targetheaders(mode, arch, target, mode_idx == #vsinfo.modes and arch_idx == 2) end end end diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index 66537f0598..322292f721 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -33,7 +33,6 @@ import("core.cache.localcache") import("lib.detect.find_tool") import("private.action.run.runenvs") import("private.action.require.install", {alias = "install_requires"}) -import("actions.config.configheader", {alias = "generate_configheader", rootdir = os.programdir()}) import("actions.config.configfiles", {alias = "generate_configfiles", rootdir = os.programdir()}) import("vstudio.impl.vsutils", {rootdir = path.join(os.programdir(), "plugins", "project")}) @@ -463,7 +462,6 @@ function main(outputdir, vsinfo) -- update config files generate_configfiles() - generate_configheader() -- ensure to enter project directory os.cd(project.directory()) From 3d85db4ba0c923b9259e6bf88a742b17a70f8b48 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 23:35:04 +0800 Subject: [PATCH 2/4] remove some deprecated apis --- xmake/languages/asm/load.lua | 1 - xmake/languages/objc++/load.lua | 3 --- 2 files changed, 4 deletions(-) diff --git a/xmake/languages/asm/load.lua b/xmake/languages/asm/load.lua index 30d9d2ebda..97dba6b1b7 100644 --- a/xmake/languages/asm/load.lua +++ b/xmake/languages/asm/load.lua @@ -70,7 +70,6 @@ function _get_apis() } apis.paths = { -- target.add_xxx - "target.add_headers" -- TODO deprecated , "target.add_headerfiles" , "target.add_linkdirs" , "target.add_includedirs" diff --git a/xmake/languages/objc++/load.lua b/xmake/languages/objc++/load.lua index 9682981c62..8accb15037 100644 --- a/xmake/languages/objc++/load.lua +++ b/xmake/languages/objc++/load.lua @@ -90,12 +90,9 @@ function _get_apis() } apis.paths = { -- target.set_xxx - "target.set_headerdir" -- TODO deprecated - , "target.set_config_header" , "target.set_pmheader" , "target.set_pmxxheader" -- target.add_xxx - , "target.add_headers" -- TODO deprecated , "target.add_headerfiles" , "target.add_linkdirs" , "target.add_includedirs" From 589975db619ee3ff5611ea0e1887159dc89e49e4 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 23:35:56 +0800 Subject: [PATCH 3/4] fix error --- xmake/languages/asm/load.lua | 2 +- xmake/languages/objc++/load.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/languages/asm/load.lua b/xmake/languages/asm/load.lua index 97dba6b1b7..9d3e76659c 100644 --- a/xmake/languages/asm/load.lua +++ b/xmake/languages/asm/load.lua @@ -70,7 +70,7 @@ function _get_apis() } apis.paths = { -- target.add_xxx - , "target.add_headerfiles" + "target.add_headerfiles" , "target.add_linkdirs" , "target.add_includedirs" , "target.add_sysincludedirs" diff --git a/xmake/languages/objc++/load.lua b/xmake/languages/objc++/load.lua index 8accb15037..2b12871b35 100644 --- a/xmake/languages/objc++/load.lua +++ b/xmake/languages/objc++/load.lua @@ -90,7 +90,7 @@ function _get_apis() } apis.paths = { -- target.set_xxx - , "target.set_pmheader" + "target.set_pmheader" , "target.set_pmxxheader" -- target.add_xxx , "target.add_headerfiles" From 0f8899180e72c65ce48b37d30902b20f315bbdb9 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 23:38:33 +0800 Subject: [PATCH 4/4] remove more codes --- xmake/actions/build/kinds/shared.lua | 15 --------------- xmake/actions/build/kinds/static.lua | 15 --------------- xmake/modules/target/action/clean/main.lua | 4 ---- xmake/plugins/project/cmake/cmakelists.lua | 18 ------------------ xmake/plugins/project/make/makefile.lua | 3 --- 5 files changed, 55 deletions(-) diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua index cc9957ca9e..4363d19018 100644 --- a/xmake/actions/build/kinds/shared.lua +++ b/xmake/actions/build/kinds/shared.lua @@ -54,21 +54,6 @@ function _do_link_target(target, opt) local depvalues = {linkinst:program(), linkflags} depend.on_changed(function () - -- TODO make headers (deprecated) - if not dryrun then - local srcheaders, dstheaders = target:headers() - if srcheaders and dstheaders then - local i = 1 - for _, srcheader in ipairs(srcheaders) do - local dstheader = dstheaders[i] - if dstheader then - os.cp(srcheader, dstheader) - end - i = i + 1 - end - end - end - -- the target file local targetfile = target:targetfile() diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua index 6447101542..9d9ffdaf91 100644 --- a/xmake/actions/build/kinds/static.lua +++ b/xmake/actions/build/kinds/static.lua @@ -54,21 +54,6 @@ function _do_link_target(target, opt) local depvalues = {linkinst:program(), linkflags} depend.on_changed(function () - -- TODO make headers (deprecated) - if not dryrun then - local srcheaders, dstheaders = target:headers() - if srcheaders and dstheaders then - local i = 1 - for _, srcheader in ipairs(srcheaders) do - local dstheader = dstheaders[i] - if dstheader then - os.cp(srcheader, dstheader) - end - i = i + 1 - end - end - end - -- the target file local targetfile = target:targetfile() diff --git a/xmake/modules/target/action/clean/main.lua b/xmake/modules/target/action/clean/main.lua index d492c38b11..06bd39f70c 100644 --- a/xmake/modules/target/action/clean/main.lua +++ b/xmake/modules/target/action/clean/main.lua @@ -53,10 +53,6 @@ function main(target) remove_files(target:pcoutputfile("c")) remove_files(target:pcoutputfile("cxx")) - -- TODO remove the header files (deprecated) - local _, dstheaders = target:headers() - remove_files(dstheaders) - -- remove the clean files remove_files(target:get("cleanfiles")) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 54d87a2515..e4cf59e962 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -1005,21 +1005,6 @@ function _add_target_custom_commands(cmakelists, target, outputdir) _add_target_custom_commands_for_batchcmds(cmakelists, target, outputdir, "after", cmds_after) end --- TODO export target headers (deprecated) -function _export_target_headers(target) - local srcheaders, dstheaders = target:headers() - if srcheaders and dstheaders then - local i = 1 - for _, srcheader in ipairs(srcheaders) do - local dstheader = dstheaders[i] - if dstheader then - os.cp(srcheader, dstheader) - end - i = i + 1 - end - end -end - -- add target function _add_target(cmakelists, target, outputdir) @@ -1044,9 +1029,6 @@ function _add_target(cmakelists, target, outputdir) raise("unknown target kind %s", target:kind()) end - -- TODO export target headers (deprecated) - _export_target_headers(target) - -- add target dependencies _add_target_dependencies(cmakelists, target) diff --git a/xmake/plugins/project/make/makefile.lua b/xmake/plugins/project/make/makefile.lua index cae9806f0b..7f2e4f62cf 100644 --- a/xmake/plugins/project/make/makefile.lua +++ b/xmake/plugins/project/make/makefile.lua @@ -655,9 +655,6 @@ function _add_clean_target(makefile, target, outputdir) _add_remove_files(makefile, target:targetfile(), outputdir) _add_remove_files(makefile, target:symbolfile(), outputdir) _add_remove_files(makefile, target:objectfiles(), outputdir) - -- TODO remove the header files (deprecated) - local _, dstheaders = target:headers() - _add_remove_files(makefile, dstheaders, outputdir) end makefile:print("") end