Author Topic: SDK Versioning sceme, plugin sdk version check  (Read 413 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3190
SDK Versioning sceme, plugin sdk version check
« on: June 05, 2022, 06:12:44 pm »
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
Code
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?

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5342
Re: SDK Versioning sceme, plugin sdk version check
« Reply #1 on: June 05, 2022, 06:50:50 pm »
seems reasonable to me. If we don't foresee any regressions, might be the way forward.

Offline AndrewCot

  • Lives here!
  • ****
  • Posts: 503
Re: SDK Versioning sceme, plugin sdk version check
« Reply #2 on: June 06, 2022, 12:33:57 am »
My 2c of feedback is:

1) Looks like a good change.
2) The WIKI documentation and the code will need to have info in them to ensure (okay try) people follow the semantic versioning as it's been like this for a very long time.
3) Be aware that most of the plugin's manifest.xml file are very old and specify the release as 1. With all of the changes over the years this may not be correct. These could be bumped in the same change or left for later.