How to include ThrowTheSwitch/Unity in a C project?

183 Views Asked by At

I would like to use ThrowTheSwitch Unity for my unit tests in several projects so I have this generic structure:

.
├── README.md
├── Makefile
├── src
│   ├── ...
│   └── main.c
└── test
    ├── vendor
    │   ├── unity.c
    │   └── unity.h
    └── test_main.c

To include unity I could use different approach:

  1. Git Submodules
    • pros: git only, one single source of truth
    • cons: get all the unity repository while only 3 files are required
  2. Git Submodules with sparse checkout
    • pros: only get what I need
    • cons: need some hack to enable the sparse-checkout
  3. Git Subtree
    • pros: safe if no internet available
    • cons: keep local copies of unity in the history
  4. Wget from a release
    • pros: very simple, very effective
    • cons: dependency on wget and tar and internet (no local cache)
  5. Local copy of unity
    • pros: most simple solution, effective
    • cons: not SSOT, all similar projects will have their local copy of unity, lost track of which unity version is synced.

It seems none of the above method is perfect and I don't know which one to choose. The best solution would be to have a simple package manager with a package.json file that list my dependencies and their versions.

Is there any other/better solution?

0

There are 0 best solutions below