From 34ee1de74fbd88bb92fa4aa7d399ab2b657f9d17 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 13 Oct 2022 23:28:34 +0800 Subject: improve xrepo export --- xmake/modules/private/xrepo/action/export.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xmake/modules/private/xrepo/action/export.lua b/xmake/modules/private/xrepo/action/export.lua index ac6b98594..89d34ed75 100644 --- a/xmake/modules/private/xrepo/action/export.lua +++ b/xmake/modules/private/xrepo/action/export.lua @@ -42,6 +42,7 @@ function menu_options() " - xrepo export -f \"vs_runtime='MD'\" zlib", " - xrepo export -f \"regex=true,thread=true\" boost"}, {}, + {nil, "includes", "kv", nil, "Includes extra lua configuration files."}, {nil, "toolchain", "kv", nil, "Set the toolchain name." }, {nil, "shallow", "k", nil, "Does not export dependent packages."}, {'o', "packagedir", "kv", "packages","Set the exported packages directory."}, @@ -86,8 +87,15 @@ function _export_packages(packages) end end - local oldir = os.curdir() + -- add includes to rcfiles + local rcfiles = {} + local includes = option.get("includes") + if includes then + table.join2(rcfiles, path.splitenv(includes)) + end + -- enter working project directory + local oldir = os.curdir() local subdir = "working" if packagefile then subdir = subdir .. "-" .. hash.uuid(packagefile):split('-')[1] @@ -131,7 +139,11 @@ function _export_packages(packages) table.insert(config_argv, "-k") table.insert(config_argv, kind) end - os.vrunv("xmake", config_argv) + local envs = {} + if #rcfiles > 0 then + envs.XMAKE_RCFILES = path.joinenv(rcfiles) + end + os.vrunv("xmake", config_argv, {envs = envs}) -- do export local require_argv = {"require", "--export"} @@ -179,7 +191,7 @@ function _export_packages(packages) end table.join2(require_argv, packages) end - os.vexecv("xmake", require_argv) + os.vexecv("xmake", require_argv, {envs = envs}) end -- export packages in current project -- cgit v1.3.1