Skip to content

Plugin Adaptation

Rasbats edited this page Feb 26, 2021 · 40 revisions

Adapting the legacy plugin

Follow this link for extra detail on the source code changes

Source Code Changes

Make the following changes to the plugin source code.

Replace/add files to enable CI (Continuous Integration)

General

Files can be updated using git or (partly) with GUI tools. The GUI method uses less of the command line which can be an advantage for some users. However, the git method offers other advantages:

  • The commands could easily be copy-pasted and works on all platforms.
  • The shipdriver sources are always updated
  • The permissions problem which otherwise hits Windows users is avoided.

The git method

  • Create a shipdriver remote, used to "fetch" files updated to latest version:

    $ git remote add shipdriver https://github.com/Rasbats/shipdriver_pi.git
    $ git remote update shipdriver
    
  • Update all directories with the shipdriver templates. Use actual plugin name, not tidefinder-plugin.

    $ git rm -rf  .circleci build-deps ci flatpak libs mingw cmake
    $ git checkout shipdriver/master .circleci build-deps ci flatpak libs mingw cmake
    $ git mv shipdriver-plugin.xml.in tidefinder-plugin.xml.in  (problem even with the source)
    $ git commit -m "Initial import of shipdriver directories"
    $ git push
    
  • Update plain files.

    $ git checkout shipdriver/master \
         .cmake-format.yaml .drone.yml appveyor.yml config.h.in COPYING 
    $ git commit -m "Initial import of shipdriver files."
    
  • Update files which should be edited. This part requires that the previous version is available. One could use backup copies, use git to make a diff against previous version, use an editor with git support. YMMV. In any case, make sure that current version is available by other means before updating these files using:

    $ git checkout shipdriver/master README.md CMakeLists.txt \
        shipdriver-plugin.xml.in flatpak/org.opencpn.OpenCPN.Plugin.shipdriver.yaml
    $ git mv flatpak/org.opencpn.OpenCPN.Plugin.shipdriver.yaml \
        flatpak/org.opencpn.OpenCPN.Plugin.TideFinder.yaml
    

    Use the actaul plugin name instead of TideFinder. Then, proceed to Editing files as described in this section

The GUI method

Use the ShipDriver files/directories to make the changes required. In order to do this, clone the github repository, and make sure the clone is updated.

1files.jpg

The following directories are copied from ShipDriver to the TideFinder directory:

  • .circleci
  • build-deps
  • ci
  • flatpak (rename org.opencpn.OpenCPN.Plugin.ShipDriver.yaml as org.opencpn.OpenCPN.Plugin.TideFinder.yaml)
  • libs
  • mingw

This directory replaces the original in TideFinder:

  • cmake

These ShipDriver files are added to the TideFinder/ directory:

  • .cmake-format.yaml
  • .drone.yml
  • appveyor.yml
  • config.h.in
  • COPYING
  • shipdriver-plugin.xml.in (rename as TideFinder-plugin.xml.in)

Windows users need to consider permission problems on these files as described in https://github.com/Rasbats/managed_plugins/wiki/Cloud-Service-Changes#now-check-the-cloud-services-for-errors

Files to edit

  • README.md
  • CMakeLists.txt
  • org.opencpn.OpenCPN.Plugin.TideFinder.yaml (in the flatpak directory)

It may be easiest to use two text editor windows, one showing the TideFinder file with the other showing ShipDriver.

  • README.md

    Change the description, building instructions and copyright notice (important!), make other edits as necessary.

  • CMakeLists.txt

    A draft copy using ShipMaker CMakeLists.txt can be used as a template for the new file. Edit the draft copy and substitute TideFinder for ShipDriver. Then delete the original TideFinder file and rename the draft copy CMakeLists.txt.

    2files.jpg

    Remove 'src/ocpn_plugin.h' from the source files. This is in the libs/api-16 directory and used later, when building.

  • org.opencpn.OpenCPN.Plugin.TideFinder.yaml

    This file is found in the 'flatpak' directory. Just 3 name substitutions.

Return to the workflow guide

Clone this wiki locally