- Zig 100%
|
|
||
|---|---|---|
| src | Put "git" in front | |
| .gitignore | Ignore testing submodule pEpForiOS.XCFrameworks/ | |
| .submodules.json | Update submodules | |
| build.zig | Rename to "submodules" | |
| build.zig.zon | Rename to "submodules" | |
| LICENSE | Initial commit | |
| README.md | Build/Install | |
submodules
Handle project dependencies stored in external git repositories.
It's all git for now, but there's no reason not to extend this to other version control systems.
It expects a local file .submodules.json to read submodule info from, and updates this file with certain commands.
Example .submodules.json:
[
{
"url": "https://github.com/randombit/botan.git",
"path": "botan",
"commit": "3a4ae17b0d48da54f380d47bdc33779340e6e3e7"
},
{
"url": "ssh://git@codeberg.org/pEp/vks-client.git",
"path": "vks-client",
"commit": "088abdd6b94003f60eb8d139f781874cdbffcd08aeccf53b451fbebc059eb337"
},
{
"url": "ssh://git@codeberg.org/pEp/libetpan.git",
"path": "libetpan",
"commit": "960de72c05e61611c0ba55332e9799dce7b605c3"
},
{
"url": "ssh://git@codeberg.org/pEp/pEpForiOS.XCFrameworks.git",
"path": "pEpForiOS.XCFrameworks"
}
]
Build/Install
zig fetch --save https://github.com/Hejsil/zig-clap/archive/refs/tags/0.11.0.tar.gz
zig build --prefix $HOME/.local
Make sure $HOME/.local/bin is in your PATH.
Commands
Commands are run via zig build run -- <command>, or submodules <command> if you installed this tool.
clone- recursively clones all submodules from their respective repository.status- executesgit statusfor all submodules.branch- outputs the current branch name of every submodule, if available, otherwise the current commit.fixate- (not recursively) write the current commit hash of every direct submodule to the local.submodules.json.checkout- recursively checks out the previously written commit of every submodule (viafixate).
Build and run directly
For development:
zig build run -- <command>
Motivation
Git submodules can be great if they match your use case, but they break apart spectacularly when you want to mix SHA-1 and SHA-256 repositories.
There are clusters of projects that use something like known_good.json to handle such dependencies/subrepositories manually, with scripting involved. Each repo with its own rules and scripts.
Submodules is my attempt to solve this "once and for all" in one place for my personal use cases, without ever again getting broken by hash algorithm transitions, or getting pinned to one particular VCS.