Files
goproxy/examples/plugin/plugins/build.sh
DarkiT 0990e8c42c 增强插件系统:添加硬件插件类型及默认插件构造函数
- 在插件类型中新增硬件插件类型(PluginTypeHardware),以支持更多插件类型的扩展。
- 添加便捷的构造函数 NewBasePluginWithDefaultType 和 NewPluginWithDefaultType,简化插件创建过程,适用于不需要指定特殊类型的场景。
- 更新日志插件和统计插件的创建示例,展示如何使用默认插件类型。

此更新提升了插件系统的灵活性,便于开发者快速创建和管理插件。
2025-03-14 11:14:47 +08:00

63 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 构建脚本,用于编译所有插件
# 确保输出目录存在
mkdir -p dist
echo "===== 开始编译插件 ====="
# 编译带有明确类型的日志插件
echo "编译日志插件 (明确类型)..."
cd logger
go build -buildmode=plugin -o ../dist/logger.so
if [ $? -eq 0 ]; then
echo "日志插件编译成功!"
else
echo "日志插件编译失败!"
exit 1
fi
cd ..
# 编译使用默认类型的日志插件
echo "编译默认日志插件 (默认类型)..."
cd defaultlogger
go build -buildmode=plugin -o ../dist/defaultlogger.so
if [ $? -eq 0 ]; then
echo "默认日志插件编译成功!"
else
echo "默认日志插件编译失败!"
exit 1
fi
cd ..
# 编译统计插件
echo "编译统计插件..."
cd stats
go build -buildmode=plugin -o ../dist/stats.so
if [ $? -eq 0 ]; then
echo "统计插件编译成功!"
else
echo "统计插件编译失败!"
exit 1
fi
cd ..
# 编译存储插件
echo "编译存储插件..."
cd storage
go build -buildmode=plugin -o ../dist/storage.so
if [ $? -eq 0 ]; then
echo "存储插件编译成功!"
else
echo "存储插件编译失败!"
exit 1
fi
cd ..
echo "===== 所有插件编译完成 ====="
echo "插件文件保存在 dist 目录中:"
ls -la dist/
# 对于Windows系统添加.exe后缀
# go build -buildmode=plugin -o ../dist/plugin_name.dll