1 Star 0 Fork 1

SmartSmallBoy/loongcollector_cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
add_test_arg.py 910 Bytes
一键复制 编辑 原始数据 按行查看 历史
vimoon.zheng 提交于 4个月前 . 支持xmake交叉编译
import os
import shutil
script_path = os.path.abspath(__file__)
# 获取所在目录
script_dir = os.path.dirname(script_path)
def replace_txt(file_path, old_text, new_text):
# 读取文件内容
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
shutil.copy2(file_path, file_path + ".bak")
# 执行替换
new_content = content.replace(old_text, new_text)
# 写回文件
with open(file_path, 'w', encoding='utf-8') as f:
f.write(new_content)
for root, dirs, files in os.walk(script_dir, topdown=False):
dir_name = os.path.basename(root)
if dir_name == "unittest":
continue
for file in files:
if file != "xmake.lua":
continue
replace_txt(os.path.join(root, file), "\tadd_deps(", f"\tset_default(false)\n\tadd_tests(\"default\")\n\tset_group(\"{dir_name}\")\n\tadd_deps(")
break
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/SmartSmallBoy/loongcollector_cpp.git
git@gitee.com:SmartSmallBoy/loongcollector_cpp.git
SmartSmallBoy
loongcollector_cpp
loongcollector_cpp
master

搜索帮助