Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add shell utility registration #2059

Merged
merged 6 commits into from
Feb 15, 2022
Merged

add shell utility registration #2059

merged 6 commits into from
Feb 15, 2022

Conversation

xq114
Copy link
Contributor

@xq114 xq114 commented Feb 14, 2022

#1817
#2054

  • 增加了xmake update --integrate接口来初始化shell integration;
  • 改进了xmake update --uninstall接口以卸载shell integration;
  • 接受set_toolchains("msvc", {vs=2019})写法;
  • 增加了从git ssh升级xmake的选项。

get.ps1和get.sh由于需要保持前向兼容,暂未进行更改,之后也可以切到xmake update接口来安装shell integration

已知问题:
set_toolchains("msvc", {vs="2019"})设置之后,运行xmake config会执行两次查找,输出

checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft Visual Studio (x64) version ... 2019

这个行为很奇怪,为什么toolchain:on_check看起来被执行了两次?

@waruqi
Copy link
Member

waruqi commented Feb 14, 2022

这个行为很奇怪,为什么toolchain:on_check看起来被执行了两次?

首次检测是无set_toolchains时候的整个全局平台工具链检测

如果设置了 set_toolchains,这个会对 target 单独附加,属于局部工具链检测

而全局的不管用没用到,都是会检测的,这个执行实际很靠前,那个阶段 targets 和对应的 toolchains 都还没被解析出来

所以这两次是避免不了的,如果你配置了 set_toolchains

不过我记得整体vs list是有探测缓存的,不过我也记不清了,第二次只是选取版本,应该不会太慢,如果之前find_vstudio没加缓存,那可以加个改进缓存下就好

@xq114
Copy link
Contributor Author

xq114 commented Feb 15, 2022

还有一个问题是os.iorun和os.iorunv的返回值,为什么os.iorun返回ok, out, err,而os.iorunv只返回out, err?

@xq114
Copy link
Contributor Author

xq114 commented Feb 15, 2022

还有就是os.shell里面目前在windows上也是用运行pwsh来判断的,这点并不合理,应该用os.getppid+os.getprocname来获取父进程,从父进程判断属于哪个shell。不过xmake没提供这两个函数,也只能先这样了

参考:
https://stackoverflow.com/questions/55597797/detect-whether-current-shell-is-powershell-in-python
https://stackoverflow.com/questions/185254/how-can-a-win32-process-get-the-pid-of-its-parent
https://github.com/giampaolo/psutil/blob/master/psutil/_psutil_windows.c#L338

@waruqi
Copy link
Member

waruqi commented Feb 15, 2022

还有一个问题是os.iorun和os.iorunv的返回值,为什么os.iorun返回ok, out, err,而os.iorunv只返回out, err?

都是 out, err ,然后出错直接 raise, 除非是 core 里面非 sandbox 里面跑的脚本,才是 ok, out, err,不触发 raise

@waruqi
Copy link
Member

waruqi commented Feb 15, 2022

还有就是os.shell里面目前在windows上也是用运行pwsh来判断的,这点并不合理,应该用os.getppid+os.getprocname来获取父进程,从父进程判断属于哪个shell。不过xmake没提供这两个函数,也只能先这样了

参考: https://stackoverflow.com/questions/55597797/detect-whether-current-shell-is-powershell-in-python https://stackoverflow.com/questions/185254/how-can-a-win32-process-get-the-pid-of-its-parent https://github.com/giampaolo/psutil/blob/master/psutil/_psutil_windows.c#L338

暂时不支持,可以单开 feature request

@waruqi waruqi merged commit 5433ec8 into xmake-io:dev Feb 15, 2022
@waruqi waruqi added this to the v2.6.4 milestone Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants