diff options
| author | ruki <[email protected]> | 2019-04-18 00:49:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-04-17 22:55:01 +0800 |
| commit | fe7395793bf186b54c6ccb777b9086a9e2b5d2e9 (patch) | |
| tree | 6b306704c3c7598f5dd55aca9d88580eb98f4a3b | |
| parent | da2e7200b81638ffae4ca46594b1ee8f37a6dca0 (diff) | |
improve vcpkg and package errors tip
| -rw-r--r-- | xmake/actions/require/impl/action/install.lua | 8 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/package/manager/vcpkg/install_package.lua | 5 |
3 files changed, 12 insertions, 7 deletions
diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua index 9463ce269..8e1a0c658 100644 --- a/xmake/actions/require/impl/action/install.lua +++ b/xmake/actions/require/impl/action/install.lua @@ -222,11 +222,12 @@ function main(package) function (errors) -- show or save the last errors + local errorfile = path.join(package:installdir("logs"), "install.txt") if errors then if (option.get("verbose") or option.get("diagnosis")) then cprint("${dim color.error}error: ${clear}%s", errors) else - io.writefile(path.join(package:installdir("logs"), "install.txt"), errors) + io.writefile(errorfile, errors .. "\n") end end @@ -245,11 +246,16 @@ function main(package) if not os.isdir(installdir_failed) then os.cp(installdir, installdir_failed) end + errorfile = path.join(installdir_failed, "logs", "install.txt") end os.tryrm(installdir) -- failed if not package:requireinfo().optional then + if os.isfile(errorfile) then + print("if you want to get verbose errors, please see:") + cprint(" -> ${bright}%s${clear}", errorfile) + end raise("install failed!") end end diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index c9e298a33..8e343f7d9 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -231,7 +231,11 @@ end -- get the installed directory of this package function _instance:installdir(...) local name = self:name():lower():gsub("::", "_") - local dir = path.join(package.installdir(), name:sub(1, 1):lower(), name, self:version_str(), self:buildhash(), ...) + local dir = path.join(package.installdir(), name:sub(1, 1):lower(), name) + if self:version_str() then + dir = path.join(dir, self:version_str()) + end + dir = path.join(dir, self:buildhash(), ...) if not os.isdir(dir) then os.mkdir(dir) end diff --git a/xmake/modules/package/manager/vcpkg/install_package.lua b/xmake/modules/package/manager/vcpkg/install_package.lua index 8f5aa92d1..2ef3bae90 100644 --- a/xmake/modules/package/manager/vcpkg/install_package.lua +++ b/xmake/modules/package/manager/vcpkg/install_package.lua @@ -48,11 +48,6 @@ function main(name, opt) arch = "x64" end - -- check architecture - if opt.arch ~= os.arch() then - raise("cannot install package(%s) for arch(%s)!", name, opt.arch) - end - -- init argv local argv = {"install", string.format("%s:%s-%s", name, arch, plat)} |
