Hi,
i would like to add a new function to the sdk, this means increasing the sdk version.
I have found some problems i would like to discuss.
I think we should (and i think we are using) use semantic versioning scheme: https://semver.org/
According to my understanding we have "shiftet" the scheme by one and are not using the "patch" number.:
PLUGIN_SDK_VERSION_MINOR -> patch version (internal changes, probably behaviour changes)
PLUGIN_SDK_VERSION_MAJOR -> minor version (adding functions)
PLUGIN_SDK_VERSION_RELEASE -> major version (removing functions, non backwards compatible interface changes)
So adding new features should be covered by incrementing the PLUGIN_SDK_VERSION_MAJOR. This should allow all plugins to still be usable without recompiling.
Our current implementation does not allow me to change any version number and still use old compiled plugins.
The check is performed in pluginmanager.cpp:700
if (major != PLUGIN_SDK_VERSION_MAJOR ||
minor != PLUGIN_SDK_VERSION_MINOR ||
release != PLUGIN_SDK_VERSION_RELEASE)
{
// wrong version: in this case, inform the user...
wxString fmt;
fmt.Printf(_("SDK version mismatch for %s (%d.%d.%d). Expecting %d.%d.%d"),
name.c_str(),
major,
minor,
release,
PLUGIN_SDK_VERSION_MAJOR,
PLUGIN_SDK_VERSION_MINOR,
PLUGIN_SDK_VERSION_RELEASE);
Manager::Get()->GetLogManager()->LogError(fmt);
return;
}
I think this is wrong and the PLUGIN_SDK_VERSION_MINOR and PLUGIN_SDK_VERSION_MAJOR check should be a ">" check. So if we add functions old plugins should still be working without problems.
Removing functions or changing the interface of functions should result in increase of the major version. Here we can perform an = check because no backwards compatibility
any comments?
This afternoon I jot clobbered on the Mac with the version check change failing (plugin 2.16.0 and CB SDK 2.19.0 btw).. I have no idea why the plugin loaded on Windows without triggering the failure.
If you look at the some of the version number of MS DLL's that are to do with the MSVC the last octect of the version number jumps 100's between releases in allot of cases.
BTW I changed the check to the following as it makes more sense and resolved the issue I had:
if ( major > PLUGIN_SDK_VERSION_MAJOR ||
(
major == PLUGIN_SDK_VERSION_MAJOR &&
minor > PLUGIN_SDK_VERSION_MINOR
) ||
(
major == PLUGIN_SDK_VERSION_MAJOR &&
minor == PLUGIN_SDK_VERSION_MINOR &&
release > PLUGIN_SDK_VERSION_RELEASE
)
)
I think a better check is
if(( release != PLUGIN_SDK_VERSION_RELEASE ||
( major > PLUGIN_SDK_VERSION_MAJOR ) ||
( minor > PLUGIN_SDK_VERSION_MINOR && major >= PLUGIN_SDK_VERSION_MAJOR)))
PLUGIN_SDK_VERSION_RELEASE is a total breaker of plugins. Change in this version means binary incompatibility: signature of function change, or function removal this means no backwards compatibility.
Big call to other devs: What are you thinking about this?
Increasing PLUGIN_SDK_VERSION_RELEASE will mean break binary compatibility. So a plugin previously compiled will not work. When do you want increase this? On an effective change in code or only after a release?
We use a lot nightly builds so it would be reasonable to change it after every effective code change. But in the end it could happen that we have high release numbers.
This is only a thing of taste, but we have to decide...