summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-02-09 00:49:27 +0800
committerruki <[email protected]>2022-02-09 00:49:27 +0800
commit60674942ef4c5139a2b86a9625e352f8bb1d6ec8 (patch)
tree2e8edc6560bec4630d3baae586110316eb18712d
parent12849536a491932f2fac1e34d57216e04c047d06 (diff)
update changelog
-rw-r--r--CHANGELOG.md8
-rw-r--r--xmake/modules/private/xrepo/action/install.lua19
2 files changed, 26 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2cd9552bb..86e62a898 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,10 @@
* [#2031](https://github.com/xmake-io/xmake/issues/2031): Support linker scripts and version scripts for add_files
* [#2033](https://github.com/xmake-io/xmake/issues/2033): Catch ctrl-c to get current backtrace for debugging stuck
+### Changes
+
+* [#2036](https://github.com/xmake-io/xmake/issues/2036): Improve xrepo to install packages from configuration file, e.g. `xrepo install xxx.lua`
+
### Bugs fixed
* [#2005](https://github.com/xmake-io/xmake/issues/2005): Fix path.extension
@@ -1217,6 +1221,10 @@
* [#2031](https://github.com/xmake-io/xmake/issues/2031): 为 add_files 增加 linker scripts 和 version scripts 支持
* [#2033](https://github.com/xmake-io/xmake/issues/2033): 捕获 ctrl-c 去打印当前运行栈,用于调试分析卡死问题
+### 改进
+
+* [#2036](https://github.com/xmake-io/xmake/issues/2036): 改进 xrepo 支持从配置文件批量安装包,例如:`xrepo install xxx.lua`
+
### Bugs 修复
* [#2005](https://github.com/xmake-io/xmake/issues/2005): 修复 path.extension
diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua
index 691b3b09c..6d36e5a92 100644
--- a/xmake/modules/private/xrepo/action/install.lua
+++ b/xmake/modules/private/xrepo/action/install.lua
@@ -107,6 +107,21 @@ function _install_packages(packages)
os.cd(workdir)
end
+ -- is package configuration file? e.g. xrepo install xxx.lua
+ --
+ -- xxx.lua
+ -- add_requires("libpng", {system = false})
+ -- add_requireconfs("libpng.*", {configs = {shared = true}})
+ local filemode = false
+ if type(packages) == "string" or #packages == 1 then
+ local packagefile = table.unwrap(packages)
+ if type(packagefile) == "string" and packagefile:endswith(".lua") and os.isfile(packagefile) then
+ assert(os.isfile("xmake.lua"), "xmake.lua not found!")
+ os.cp(packagefile, "xmake.lua")
+ filemode = true
+ end
+ end
+
-- disable xmake-stats
os.setenv("XMAKE_STATS", "false")
@@ -224,7 +239,9 @@ function _install_packages(packages)
local extra_str = string.serialize(extra, {indent = false, strip = true})
table.insert(require_argv, "--extra=" .. extra_str)
end
- table.join2(require_argv, packages)
+ if not filemode then
+ table.join2(require_argv, packages)
+ end
os.vexecv("xmake", require_argv, {envs = envs})
end