### P4-01 插件 ABI 1.4 mesher 扩展点 - VDE_PLUGIN_ABI_MINOR 3→4;VdePluginKind MESHER=8;VdeMesherStatus/Options/Result/Plugin; VdePluginRegistration 尾追加 mesher 指针(48→56B,旧 1.3 按 struct_size 安全); - PluginManager kind/meshers()/invoke_mesher()/失败隔离/unload 清理;ABI 语义 manifest.minor<=query.minor<=host.minor; - sample_mesher(mock tet4);ABI 矩阵 1.0–1.4 accepted=5 + 2.0 rejected;--abi/--check 适配; - test_plugin_mesher 7 用例 + VDE_PluginToolMesherAbi CTest;docs plugin-development §15/plugin-distribution §12; ### P4-02 Python ctypes 回归 - 可选 CTest VDE_PythonCtypesSmoke(Python3 可选/vde_capi_shared/smoke_test_ctypes.py;无 Python 跳过); - VDE_BUILD_PYTHON=ON MinGW 原生 pybind 明确跳过(ctypes 保留);README/testing 文档更新(C API 61/绑定 60); ### P4-03 模块包 CI 矩阵 - cmake/check_module_packages.cmake:configure/build/install → 10 模块包 find_package + 仓库内 consumer 编译运行; - tests/module_packages/consumers/(10 个最小工程);CI module-packages job;本地 MODULE_PACKAGES_PASS pass=10 fail=0; ### P4-04 宿主复测/平台 CI 交接 + 多团队分发体系 - docs/reference/76-宿主复测与平台CI交接包(1.0.78).md;VDE-1251/1252 反馈单追加复测指引; - docs/design/multi-team-development.md(T1–T8/ownership/契约/流程)、docs/planning/work-packages.md(39 WP)、 docs/guides/team-onboarding.md、docs/design/plugin-ecosystem-handoff.md、.github/ISSUE_TEMPLATE/work-package.yml; - roadmap P4-01..05 交付;WP 状态 27 Delivered/0 In-Progress/12 Candidate; ### 工程 - 版本 1.0.79;与远端 f6e0ac97(plugin template SDK consumption/ecosystem plan)rebase 集成; - 全量构建 0 error(405 targets);全量 ctest 7569 注册、7474/7474 PASS(0 failed,25 skipped,238.13s)。
119 lines
3.9 KiB
C++
119 lines
3.9 KiB
C++
// tests/plugin/fixtures/legacy_plugin.cpp
|
||
// 模拟 ABI 1.3 旧插件(注册结构 48B):用于验证宿主 ABI 1.4 的二进制向后兼容。
|
||
// - 默认:kind=format,只填 format/generic/cae/cam/gcs 字段,struct_size=48;
|
||
// - VDE_LEGACY_KIND_MESHER:kind=mesher,同样只报到 48B(旧插件不认识 mesher 字段),
|
||
// 宿主必须因 struct_size 不足而明确拒绝。
|
||
#include <cstddef>
|
||
#include <cstdint>
|
||
|
||
#include "vde/plugin/vde_plugin_api.h"
|
||
|
||
namespace {
|
||
|
||
int probe(const void* head, std::size_t head_size) {
|
||
(void)head;
|
||
(void)head_size;
|
||
return 0;
|
||
}
|
||
|
||
int read_file(const VdePluginHost* host, const char* path, VdeBody** bodies, size_t* count) {
|
||
(void)host;
|
||
(void)path;
|
||
if (bodies) *bodies = nullptr;
|
||
if (count) *count = 0;
|
||
return VDE_PLUGIN_ERR_UNSUPPORTED;
|
||
}
|
||
|
||
int read_memory(const VdePluginHost* host, const void* data, size_t size, VdeBody** bodies,
|
||
size_t* count) {
|
||
(void)host;
|
||
(void)data;
|
||
(void)size;
|
||
if (bodies) *bodies = nullptr;
|
||
if (count) *count = 0;
|
||
return VDE_PLUGIN_ERR_UNSUPPORTED;
|
||
}
|
||
|
||
int write_file(const VdePluginHost* host, const char* path, const VdeBody* bodies, size_t count) {
|
||
(void)host;
|
||
(void)path;
|
||
(void)bodies;
|
||
(void)count;
|
||
return VDE_PLUGIN_ERR_UNSUPPORTED;
|
||
}
|
||
|
||
const char* format_describe() { return "legacy ABI 1.3 format plugin"; }
|
||
|
||
const VdeFormatPlugin kFormat = {sizeof(VdeFormatPlugin), "legacy.format", ".legacy",
|
||
probe, read_file, read_memory, write_file, nullptr,
|
||
format_describe};
|
||
|
||
#if defined(VDE_LEGACY_KIND_MESHER)
|
||
int legacy_mesh(const VdePluginHost* host, const void* model_data, size_t model_size,
|
||
const VdeMesherOptions* options, VdeMesherResult* result) {
|
||
(void)host;
|
||
(void)model_data;
|
||
(void)model_size;
|
||
(void)options;
|
||
(void)result;
|
||
return VDE_PLUGIN_ERR_UNSUPPORTED;
|
||
}
|
||
const VdeMesherPlugin kMesher = {sizeof(VdeMesherPlugin), "legacy.mesher", nullptr,
|
||
legacy_mesh, nullptr};
|
||
#endif
|
||
|
||
constexpr const char* kPluginId = "com.vde.test.legacy.format";
|
||
#if defined(VDE_LEGACY_KIND_MESHER)
|
||
constexpr const char* kMesherPluginId = "com.vde.test.legacy.mesher48";
|
||
#endif
|
||
|
||
} // namespace
|
||
|
||
extern "C" {
|
||
|
||
VDE_PLUGIN_EXPORT int vde_plugin_query(std::uint32_t host_abi_major, VdePluginInfo* info) {
|
||
if (!info || info->struct_size < sizeof(VdePluginInfo)) return VDE_PLUGIN_ERR_INVALID_ARG;
|
||
if (host_abi_major != VDE_PLUGIN_ABI_MAJOR) return VDE_PLUGIN_ERR_ABI;
|
||
#if defined(VDE_LEGACY_KIND_MESHER)
|
||
info->id = kMesherPluginId;
|
||
info->name = "Legacy ABI 1.4 mesher declaration (48B registration)";
|
||
info->kind = VDE_PLUGIN_KIND_MESHER;
|
||
info->capabilities = "mesher:legacy";
|
||
info->abi_minor = 4;
|
||
#else
|
||
info->id = kPluginId;
|
||
info->name = "Legacy ABI 1.3 format plugin";
|
||
info->kind = VDE_PLUGIN_KIND_FORMAT;
|
||
info->capabilities = "format:legacy";
|
||
info->abi_minor = 3;
|
||
#endif
|
||
info->version = "0.1.0";
|
||
info->abi_major = VDE_PLUGIN_ABI_MAJOR;
|
||
info->license = "Apache-2.0";
|
||
return VDE_PLUGIN_OK;
|
||
}
|
||
|
||
VDE_PLUGIN_EXPORT int vde_plugin_init(const VdePluginHost* host, VdePluginRegistration* reg) {
|
||
(void)host;
|
||
if (!reg) return VDE_PLUGIN_ERR_INVALID_ARG;
|
||
// 真实 ABI 1.3 插件编译时 sizeof(VdePluginRegistration)==48;这里显式写 48,
|
||
// 宿主(ABI 1.4,sizeof==56)必须按 struct_size 判断字段存在性。
|
||
reg->struct_size = static_cast<std::uint32_t>(offsetof(VdePluginRegistration, mesher));
|
||
reg->format = nullptr;
|
||
reg->generic = nullptr;
|
||
reg->cae_solver = nullptr;
|
||
reg->cam_strategy = nullptr;
|
||
reg->gcs_solver = nullptr;
|
||
#if defined(VDE_LEGACY_KIND_MESHER)
|
||
reg->kind = VDE_PLUGIN_KIND_MESHER;
|
||
#else
|
||
reg->kind = VDE_PLUGIN_KIND_FORMAT;
|
||
reg->format = &kFormat;
|
||
#endif
|
||
return VDE_PLUGIN_OK;
|
||
}
|
||
|
||
VDE_PLUGIN_EXPORT void vde_plugin_shutdown() {}
|
||
|
||
} // extern "C"
|