diff options
| author | ruki <[email protected]> | 2022-02-09 00:55:20 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-02-09 00:55:20 +0800 |
| commit | 306d0f847c7f77e4f5405689e67320dc53d2d7cb (patch) | |
| tree | 34d2c088f8535b179cc152fceb8cb7c71f690ae9 | |
| parent | 60674942ef4c5139a2b86a9625e352f8bb1d6ec8 (diff) | |
improve xrepo fetch
| -rw-r--r-- | xmake/modules/private/xrepo/action/fetch.lua | 20 | ||||
| -rw-r--r-- | xmake/modules/private/xrepo/action/install.lua | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/xmake/modules/private/xrepo/action/fetch.lua b/xmake/modules/private/xrepo/action/fetch.lua index 9b775337d..886e470d9 100644 --- a/xmake/modules/private/xrepo/action/fetch.lua +++ b/xmake/modules/private/xrepo/action/fetch.lua @@ -54,6 +54,7 @@ function menu_options() {nil, "packages", "vs", nil, "The packages list.", "e.g.", " - xrepo fetch zlib boost", + " - xrepo fetch /tmp/zlib.lua", " - xrepo fetch -p iphoneos -a arm64 \"zlib >=1.2.0\"", " - xrepo fetch -p android -m debug \"pcre2 10.x\"", " - xrepo fetch -p mingw -k shared zlib", @@ -92,6 +93,21 @@ function _fetch_packages(packages) os.cd(workdir) end + -- is package configuration file? e.g. xrepo fetch 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 + -- do configure first local config_argv = {"f", "-c"} if option.get("verbose") then @@ -176,7 +192,9 @@ function _fetch_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 diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua index 6d36e5a92..1daa34e14 100644 --- a/xmake/modules/private/xrepo/action/install.lua +++ b/xmake/modules/private/xrepo/action/install.lua @@ -72,6 +72,7 @@ function menu_options() {nil, "packages", "vs", nil, "The packages list.", "e.g.", " - xrepo install zlib boost", + " - xrepo install /tmp/zlib.lua", " - xrepo install -p iphoneos -a arm64 \"zlib >=1.2.0\"", " - xrepo install -p android [--ndk=/xxx] -m debug \"pcre2 10.x\"", " - xrepo install -p mingw [--mingw=/xxx] -k shared zlib", |
