jongough / testplugin_pi

Pluing to test JSON and ODAPI
GNU General Public License v3.0
3 stars 9 forks source link

TP Convert to 'opencpn-libs' submodule #332

Closed rgleason closed 1 year ago

rgleason commented 1 year ago

Convert to opencpn-libs submodule


  1. Create a new branch called "sublibs" (locally)

    $ git checkout -b sublibs
  2. In root directory of plugin, do:

     $ git submodule add -b devel https://github.com/leamas/opencpn-libs.git

    1.1. This adds the "devel" branch of leamas' opencpn-libs repo to the plugin project as a submodule. 1.2. It also immediately downloads opencpn-libs, and places it in the plugin project root directory. 1.3 This needs only to be done ONCE. 1.4. Also, DO NOT add the raw contents of opencpn-libs to the plugin project git tree. 1.5. Submodules use only a reference to the github resident version of the submodule.

    Do not edit the copy of opencpn-libs as pulled to local plugin root.  Treat as READ-ONLY.
    
    $ git commit -m "Adding opencpn-libs submodule"
    $ git push origin sublibs
    Commit and push the submodule definition.
  3. Edit CMakeLists.txt in plugin project to change all instances of "libs/x" to "opencpn-libs/x"

    Use the syntax shown in watchdog_pi for adding directories from the opencpn-libs submodule.

    You may test build locally from the plugin project root as normal. When satisfies with local builds, got to #3.

    Review the CMakeLists.txt changes made in Watchdog Weatherfax, Weather_routing, Testplugin for submodule changes including:

  1. Copy entire folder "ci" from watchdog_pi to plugin root directory, verbatim. This adds the required sublibrary command to all build scripts.

Build Locally

For your local builds, after doing:

 Delete opencpn-libs,and then issue:
$ git submodule update --init opencpn-libs
$ git submodule update --remote --merge opencpn-libs
Commit and push the results.
This command pulls in all the latest updates to the opencpn-libs module.
This will fix all builds except flatpak.

This is exactly what the CI process does. It will bring in a fresh copy of opencpn-libs from github. It does not change the git repo contents at all, since you already have the git reference to opencpn-libs.

You generally need to only do this once (for each plugin), unless opencpn-libs is changed by me or Alec. We will let you know if that happens.

Remember: treat opencpn-libs as a read-only library. Do not edit. Do not commit contents.

Dave

More rules about submodules

  1. There is only one true opencpn-libs, and it lives in the Alec's opencpn-libs repo.
  2. All plugins must use the same golden opencpn-libs. That is the objective of this "sublibs" project.
  3. To fetch the most current opencpn-libs, just do git submodule update --init opencpn-libs
  4. It is always safe and good practice to do "submodule update" whenever you start working on a project.
  5. Do not ever edit or change opencpn-libs locally. If you do, then the next "submodule update...." will fail.
  6. If you find that opencpn-libs differs in two projects locally, it means that one or both need "submodule update...."

If you follow these rules locally, then you will be following exactly the same process as CCI does in its scripts. Remember, CCI is the "golden build", from which production plugins are released.

I'm sure you know all this, so just reminders.

Regarding Watchdog opencpn-libs Issue

from Dave More research, working on the flatpak builds. You need to do this for each plugin:

  1. In ci directory, add this line to build scripts after each submodule update.

    git submodule update --init opencpn-libs git submodule update --remote --merge opencpn-libs <-- ADD THIS.

Then commit and push the results. This will fix all builds except flatpak.

  1. To fix failing flatpak builds, for each plugin that you have IN PROCESS that fails flatpak on CCI, from source root, do this:

    $ cd opencpn-libs $ git checkout devel $ git pull origin devel $ cd .. $ git add opencpn-libs $ git commit -m "Updating the submodule 'opencpn-libs' to the latest version" $ git push origin sublibs

For plugin that you have not started yet, you only need to do this, as described in the adaptation guide.:

$ git submodule add -b devel https://github.com/leamas/opencpn-libs.git

Lets confirm this on watchdog, and then move on.

Changes to opencpn-libs (notice from Dave or Alec)

When the change lands in opencpn-libs main branch, you will need to (for these two plugins only): $ git submodule update --remote --merge opencpn-libs $ git add opencpn-libs $ git commit -m "Update opencpn-libs submodule" $ git push origin master (or other branch as you decide)

rgleason commented 1 year ago

link-rm.bat

REM Remove the current opencpn-libs submodule linkage.
    git submodule deinit -f opencpn-libs
    git rm --cached opencpn-libs
    rmdir /S .\.git\modules\opencpn-libs    <--- try taking this out (LATER: Leave in, required)
    rmdir /S .\opencpn-libs
    git config -f .gitmodules --remove-section submodule.opencpn-libs  
    git add .gitmodules
    git commit -m "Remove opencpn-libs submodule."
REM opencpn-libs linkage and files removed and  commit made

link-add.bat

REM Add the new linkage
git submodule add https://github.com/OpenCPN/opencpn-libs.git
git commit -m "Adding revised opencpn-libs submodule main"
REM Added new linkage to module opencpn-libs main and made commit.
rgleason commented 1 year ago

OK, I think I've got this now, watchdog has been done too.

bdbcat commented 1 year ago

I checked testplugin_pi, reading the logs. I see that you got my email about late change for PluginCOnfigure. Good. Thanks. All builds look good. On the home stretch.

Let us carry on.

rgleason commented 1 year ago

Had to reload submodule "data" in Climatology_pi https://github.com/jongough/testplugin_pi/issues/345