diff options
| author | ruki <[email protected]> | 2021-08-16 22:42:20 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-08-16 22:42:20 +0800 |
| commit | 5322929d89183b19f115e7418ffe1fc44bcbc78b (patch) | |
| tree | 7bd67a79280a8a3ecb25a46b865e73ce424f86ff | |
| parent | f79a870188275a9fff71dd9ae7a5d2a6759c602a (diff) | |
improve add_repositories
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/package/repository.lua | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index bd50adf44..a58a11cda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Change * [#1540](https://github.com/xmake-io/xmake/issues/1540): Better support for compilation of automatically generated code +* [#1578](https://github.com/xmake-io/xmake/issues/1578): Improve add_repositories to support relative path better ### Bugs fixed @@ -1063,6 +1064,7 @@ ### 改进 * [#1540](https://github.com/xmake-io/xmake/issues/1540): 更好更方便地编译自动生成的代码 +* [#1578](https://github.com/xmake-io/xmake/issues/1578): 改进 add_repositories 去更好地支持相对路径 ### Bugs 修复 @@ -2100,3 +2102,4 @@ * 修复set_installscript接口的一些bug * 修复在windows x86_64下,安装失败的问题 * 修复相对路径的一些bug + diff --git a/xmake/core/sandbox/modules/import/core/package/repository.lua b/xmake/core/sandbox/modules/import/core/package/repository.lua index 86f27b497..4dc00a0ed 100644 --- a/xmake/core/sandbox/modules/import/core/package/repository.lua +++ b/xmake/core/sandbox/modules/import/core/package/repository.lua @@ -92,12 +92,20 @@ function sandbox_core_package_repository.repositories(is_global) -- in project xmake.lua: -- -- add_repositories("other-repo https://github.com/other/other-repo.git dev") + -- add_repositories("other-repo dirname", {rootdir = os.scriptdir()}) -- if not is_global then for _, repo in ipairs(table.wrap(project.get("repositories"))) do local repoinfo = repo:split('%s') if #repoinfo <= 3 then - local repo = repository.load(repoinfo[1], repoinfo[2], repoinfo[3], is_global) + local name = repoinfo[1] + local url = repoinfo[2] + local branch = repoinfo[3] + local rootdir = project.extraconf("repositories", repo, "rootdir") + if url and rootdir and not path.is_absolute(url) and not url:find(":", 1, true) then + url = path.join(rootdir, url) + end + local repo = repository.load(name, url, branch, is_global) if repo then table.insert(repositories, repo) end @@ -167,3 +175,4 @@ end -- return module return sandbox_core_package_repository + |
