xmake-io / xmake-vscode

🍩 A XMake integration in Visual Studio Code
https://xmake.io
Apache License 2.0
223 stars 55 forks source link

xmake-vacode buildrun Bugs #265

Closed PolarLinda6 closed 2 months ago

PolarLinda6 commented 2 months ago

Xmake 版本

2.9.1

操作系统版本和架构

Windows 11 version 23H2

描述问题

作者你好, 我在使用xmake-vscode 插件 xmake.onBuildRun 功能的时候遇到了一些问题

  1. 构建失败后, 仍会执行上次生成的可执行文件 问题1

  2. all target 时, 会执行xmake run all 而非 xmake run --all, 致使运行失败 问题2

期待的结果

  1. 构建失败后, 停止后续 run 操作 屏幕截图 2024-05-11 214753

  2. all target 时, 使用 xmake run --all 运行 屏幕截图 2024-05-11 214844

工程配置

xmake.lua.txt

附加信息和错误日志

屏幕截图 2024-05-11 215858

waruqi commented 2 months ago

构建失败后, 仍会执行上次生成的可执行文件

没法复现,这边正常

all target 时, 会执行xmake run all 而非 xmake run --all, 致使运行失败

这个修了,更新下插件

PolarLinda6 commented 2 months ago

构建失败后, 仍会执行上次生成的可执行文件

没法复现,这边正常

all target 时, 会执行xmake run all 而非 xmake run --all, 致使运行失败

这个修了,更新下插件

作者你好, 我尝试一个demo

  1. 第一次 xmake.onBuildRun 生成输出 hello world 的可执行文件
  2. 第二次 xmake.onBuildRun 构建失败, 执行旧可执行文件

屏幕截图 2024-05-11 225707

demo.zip

waruqi commented 2 months ago

buildRun 目前是两个独立的 process task ,build 出错暂时影响不到后面的 run ,并且不好改。。要么你直接 xmake.lua 里配,用 run

https://[xmake](https://xmake.io/#/zh-cn/guide/build_policies?id=runautobuild).io/#/zh-cn/guide/build_policies?id=runautobuild

PolarLinda6 commented 2 months ago

作者你好, 上面的问题已经完美解决了, 但我有一个问题, 无法解决您可以帮助我吗

有以下文件结构

我想要实现一个 target("All_Demo"), 他会对 Test 内的每个cpp文件进行构建, 生成多个可执行文件, 并调用

PolarLinda6 commented 2 months ago

buildRun 目前是两个独立的 process task ,build 出错暂时影响不到后面的 run ,并且不好改。。要么你直接 xmake.lua 里配,用 run

https://[xmake](https://xmake.io/#/zh-cn/guide/build_policies?id=runautobuild).io/#/zh-cn/guide/build_policies?id=runautobuild

作者你好, 我已经开启了run.autobuild, 但是当我选择 target: Test_Demo 时, 他好像不会 run前自动构建 image

如图: 他提示我需要需要手动构建一次

如图: 第一次我尝试输出 "first", 第二次我尝试输出 "second", 但是它仍输出 "first" 屏幕截图 2024-05-12 131845

Demo.zip

waruqi commented 2 months ago

再试试,xmake update -s dev

PolarLinda6 commented 2 months ago

再试试,xmake update -s dev

抱歉作者, 是我说错了, 在 all target 下才会出现的, 对不起 PS: 我是使用的是 xmake.onRun

1715527903474

waruqi commented 2 months ago

再试试 xmake update -s dev,如果代码没改动,不会构建

PolarLinda6 commented 2 months ago

再试试 xmake update -s dev,如果代码没改动,不会构建

当我将 target:Test_Demo 的 set_default(false) 改为 set_default(true) 之后, 这个问题成功解决了 PS: set_default(false) 下, 代码即使改动了, 仍然不会构建, 希望作者可以修复

waruqi commented 2 months ago

这边可以,没法复现

ruki-2:Demo ruki$ xmake run -a
[ 37%]: cache compiling.debug Test/Demo.cpp
[ 87%]: linking.debug Test_Demo
[100%]: build ok, spent 1.143s
mainruki-2:Demo ruki$ touch Test/Demo.cpp
ruki-2:Demo ruki$ xmake run -a
[ 37%]: cache compiling.debug Test/Demo.cpp
[ 87%]: linking.debug Test_Demo
[100%]: build ok, spent 0.421s
PolarLinda6 commented 2 months ago

这边可以,没法复现

ruki-2:Demo ruki$ xmake run -a
[ 37%]: cache compiling.debug Test/Demo.cpp
[ 87%]: linking.debug Test_Demo
[100%]: build ok, spent 1.143s
mainruki-2:Demo ruki$ touch Test/Demo.cpp
ruki-2:Demo ruki$ xmake run -a
[ 37%]: cache compiling.debug Test/Demo.cpp
[ 87%]: linking.debug Test_Demo
[100%]: build ok, spent 0.421s

我重新试了demo, 发现也无法复现( 我也不知道为什么 ) 最后感谢作者的解答, 祝作者生活快乐