CMock Artifact
Portable source distribution of CMock (ThrowTheSwitch/CMock), a mock and stub generator for C that works together with the Unity unit test framework. This repository is consumed by the Embedbits Platform Artifact Handler to locate, download, verify, and configure CMock in downstream embedded projects.
CMock has two parts, both shipped in this package:
- a Ruby generator (
lib/cmock.rb) that parses C headers and generatesMock<name>.c/.hfiles at build time — requires the Ruby artifact, - a small C runtime (
src/cmock.c) compiled into the test binary — requires the Unity artifact headers.
This repository is split into three branches/refs by role — the main (master) branch you are reading now holds only this documentation; the handler scripts live on the Core branch, and versioned source packages are published as GitHub Releases anchored to the Bin branch.
Repository contents
main / master
└── README.md ← This document — no other content
Core
├── ArtifactConfig.cmake ← Artifact metadata (name, version constraints, asset naming)
└── CMakeCMockDefaults.cmake ← CMock integration logic (mock generation, runtime library)
Bin (anchor branch — no tracked binary files)
└── (empty commits only; each release tag points here)
Role in the platform
GitHub (ThrowTheSwitch) GitHub (Embedbits)
────────────────────────────────────── ──────────────────────────────────────────
ThrowTheSwitch/CMock Artifact-cmock
tag "v2.6.0" (source) ──► main / master → README only (this document)
Core → ArtifactConfig.cmake, CMakeCMockDefaults.cmake
Bin → Anchor branch (empty commits)
Releases → cmock-<version>.zip + .hash
tagged Bin/<version>
CMock_Importer.sh clones the upstream repository at each release tag (vX.Y.Z), verifies the checked-out tag, strips .git metadata, adds a plain-text VERSION file, and zips the source tree. CMock is platform independent (Ruby + C source), so releases carry no platform suffix — they are tagged plainly Bin/<version> (the v prefix is dropped).
Upstream's vendor/unity and vendor/c_exception git submodules are not included — they only serve CMock's own self-tests. Unity is pinned independently via the Unity artifact.
Branch structure
| Branch / Ref | Content |
|---|---|
main / master | This README only — no functional content |
Core | CMake handler scripts for consuming the artifact |
Bin | Anchor branch only — no binaries are committed here |
Release tag Bin/<version> | GitHub Release carrying the .zip source package and its .hash checksum file |
Note: On a Git host without a Releases API (Azure DevOps), the same importer commits the
.zip+.hashdirectly to theBinbranch and tags that commitBin/<version>. The CMake handler resolves either form transparently.
Fetching a release
# Core handler scripts
git clone --branch Core --single-branch --depth=1 <repository_url> cmock-core
# Source package + checksum for one specific version (GitHub Release asset)
gh release download Bin/2.6.0 --repo Embedbits/Artifact-cmock --pattern "cmock-2.6.0.*"
Package layout
cmock-<version>.zip
└── cmock/
├── VERSION ← plain-text version, e.g. "2.6.0"
├── lib/ ← Ruby generator (cmock.rb + plugins)
├── config/ ← default generator configuration
├── src/ ← cmock.c, cmock.h, cmock_internals.h
├── vendor/unity/ ← empty (submodule not fetched — use the Unity artifact)
└── ... ← upstream docs, examples, tests
Example mock generation with the Ruby artifact:
ruby cmock/lib/cmock.rb -o<config.yml> path/to/header.h
Versioning
Artifact versions correspond directly to official CMock release tags with the v prefix removed:
2.5.3, 2.6.0, 2.7.0, ...
License
CMock is distributed under the MIT License. For details, see: https://github.com/ThrowTheSwitch/CMock/blob/master/LICENSE.txt
Authors
- Mr.Nobody — embedbits.com
Contributions are welcome! Please open a pull request.