Structure
Source:CONTRIBUTING.md
dggridR consists of several parts connected together with a discomforting amount of duct tape and superglue. These parts are assembled into a directory called src which is designed to be nuke-able.
These parts are: * submodules/DGGRID - The upstream engine for manipulating discrete global grids * copy_to_src/dglib.{cpp,h} - A simplifying layer of C++ * copy_to_src/Rwrapper.{h,cpp} - Code that wraps dglib.{cpp,h} for use with R * copy_to_src/cgen_{head,body,funcs}.h - Full-factorial coordinate conversion code generated with copy_to_src/func_gen.py * copy_to_src/func_gen.py - Autogenerates full-factorial coordinate conversion code * ./update_from_upstream.h - Copies the appropriate files from submodules/DGGRID into src/
Why do we have to do this copying? Because R’s build model is pretty terrible: it assumes all the code lives in the same directory. If you want a reasonable, subdirectory-based organization of your code things become very painful.
Making changes to the C++
Updating the C++ code in dggridR is a multi-step process.
- Pull code from https://github.com/sahrk/DGGRID into https://github.com/SebKrantz/DGGRID
- Update submodules/DGGRID from https://github.com/SebKrantz/DGGRID
- Run ./update_from_upstream.sh to update dggridR/src from submodules/DGGRID
Making fixes to the C++ code requires running this process in reverse. The following workflow is suggested.
- Make any changes you need to submodules/DGGRID. Use submodules/DGGRID/CMakeLists.txt and the usual CMake workflow to ensure these compile.
- Use ./update_from_upstream.sh to import your changes into dggridR and test that they work.
- Iterate on the above until everything is working.
- If you need changes to CRAN soonish, collect changes to submodules/DGGRID into a branch on SebKrantz/DGGRID that submodules/DGGRID can point to.
- Break changes in submodules/DGGRID apart into small branches on SebKrantz/DGGRID which can be made into pull requests to https://github.com/sahrk/DGGRID.
- Get Kevin Sahr’s to approve and merge the PR’s into https://github.com/sahrk/DGGRID.
- Update https://github.com/SebKrantz/DGGRID
- Point submodules/DGGRID to master on https://github.com/SebKrantz/DGGRID
- Run ./update_from_upstream.sh to update dggridR/src from submodules/DGGRID