diff options
| author | ruki <[email protected]> | 2021-02-15 23:44:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-15 23:44:13 +0800 |
| commit | ae1158ead18a0b646aec263ea85c15cabf0e0b2f (patch) | |
| tree | c3953f259e7145030c57f2f909c6602f21cfd9a0 | |
| parent | 79d406d4013d533d5c6bc85855f1b6af8fe3bb2a (diff) | |
pass package configs to tools/xmake
| -rw-r--r-- | xmake/modules/package/tools/xmake.lua | 28 | ||||
| -rw-r--r-- | xmake/modules/utils/archive/extract.lua | 2 |
2 files changed, 28 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index 1ebd2bbe7..d034d19e7 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -21,7 +21,9 @@ -- imports import("core.base.option") import("core.tool.toolchain") +import("core.project.project") import("core.package.repository") +import("private.action.require.impl.package", {alias = "require_package"}) -- get configs function _get_configs(package, configs) @@ -79,6 +81,21 @@ function _init_argv(package, ...) return argv end +-- get require info of package +function _get_package_requireinfo(packagename) + if os.isfile(os.projectfile()) then + local requires_str, requires_extra = project.requires_str() + local requireitems = require_package.load_requires(requires_str, requires_extra) + for _, requireitem in ipairs(requireitems) do + local requireinfo = requireitem.info or {} + local requirename = requireinfo.alias or requireitem.name + if requirename == packagename then + return requireinfo + end + end + end +end + -- get the build environments function buildenvs(package, opt) opt = opt or {} @@ -96,7 +113,16 @@ function buildenvs(package, opt) local rcfile_path = os.tmpfile() .. ".lua" local rcfile = io.open(rcfile_path, 'w') if #toolchain_packages > 0 then - rcfile:print("add_requires(\"%s\")", table.concat(toolchain_packages, '", "')) + for _, packagename in ipairs(toolchain_packages) do + -- pass package configurations, {configs = {}} + local requireinfo = _get_package_requireinfo(packagename) + if requireinfo then + requireinfo.originstr = nil + rcfile:print("add_requires(\"%s\", %s)", packagename, string.serialize(requireinfo, {strip = true, indent = false})) + else + rcfile:print("add_requires(\"%s\")", packagename) + end + end end rcfile:print("add_toolchains(\"%s\")", table.concat(table.wrap(toolchains), '", "')) rcfile:close() diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index c6fae9204..74b8e1fdf 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -276,7 +276,7 @@ function _extract_using_unzip(archivefile, outputdir, extension, opt) end -- init argv - local argv = {"-o"} -- overwrite existing files without prompting + local argv = {"-o"} -- overwrite existing files without prompting if not option.get("verbose") then table.insert(argv, "-q") end |
