Files
goproxy/examples/plugin/plugins/build.sh
DarkiT 557059b2d2 增强插件系统:优化插件管理和动态插件实现
- 在插件管理器中引入 DynamicPlugin 结构体,支持动态加载和管理插件,提升插件的灵活性和可扩展性。
- 更新插件接口,添加插件名称、版本、描述、作者、类型和启用状态的获取和设置方法,增强插件信息的管理能力。
- 修改现有插件实现,确保兼容新的动态插件结构,提升插件的统一性和可维护性。
- 更新示例程序,展示如何使用新的动态插件功能,提升用户体验。

此更新提升了插件系统的灵活性和可扩展性,便于开发者更好地管理和使用插件功能。
2025-03-14 07:12:05 +00:00

61 lines
1.4 KiB
Bash
Executable File
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 ../../admin/plugins
echo "===== 开始编译插件 ====="
# 编译带有明确类型的日志插件
echo "编译日志插件 (明确类型)..."
cd logger
go build -buildmode=plugin -ldflags "-s -w" -o ../../admin/plugins/logger.so
if [ $? -eq 0 ]; then
echo "日志插件编译成功!"
else
echo "日志插件编译失败!"
exit 1
fi
cd ..
# 编译使用默认类型的日志插件
echo "编译默认日志插件 (默认类型)..."
cd defaultlogger
go build -buildmode=plugin -ldflags "-s -w" -o ../../admin/plugins/defaultlogger.so
if [ $? -eq 0 ]; then
echo "默认日志插件编译成功!"
else
echo "默认日志插件编译失败!"
exit 1
fi
cd ..
# 编译统计插件
echo "编译统计插件..."
cd stats
go build -buildmode=plugin -ldflags "-s -w" -o ../../admin/plugins/stats.so
if [ $? -eq 0 ]; then
echo "统计插件编译成功!"
else
echo "统计插件编译失败!"
exit 1
fi
cd ..
# 编译存储插件
echo "编译存储插件..."
cd storage
go build -buildmode=plugin -ldflags "-s -w" -o ../../admin/plugins/storage.so
if [ $? -eq 0 ]; then
echo "存储插件编译成功!"
else
echo "存储插件编译失败!"
exit 1
fi
cd ..
echo "===== 所有插件编译完成 ====="
# 对于Windows系统添加.exe后缀
# go build -buildmode=plugin -o ../dist/plugin_name.dll