chore: add crate-kit build system and CeCILL license
Introduce the `.crate-kit` infrastructure to standardize build, testing, and release workflows using Jujutsu and Cargo. Add CeCILL-2.1 license files and update all workspace crate manifests with license and repository metadata. - Add `.crate-kit/` directory with `VERSION`, `crate.mk`, `dev-patch.mk`, `jj.mk`, and `org.mk` to define build targets, Jujutsu helpers, and registry configuration for the workspace. - Add 21 shell scripts in `.crate-kit/scripts/` for API tracking, dependency checking, version bumping, publishing, tagging, and wiki generation, including `common.sh` with shared utility functions. - Add `scripts/jj-tag.sh` to support tagging commits with version strings derived from the current crate version. - Add `LICENSE` and `LICENSE.en` files containing the CeCILL-2.1 free software license agreement in French and English. - Update `Makefile` with new targets for building, testing, formatting, CI, and releasing, integrating with `.crate-kit` scripts and updating the wiki directory path to `obiskim`. - Update `.gitignore` to ignore `.cargo/config.toml` files generated by the development patch system. - Add `license = "CECILL-2.1"` and `repository = "https://forge.metabarcoding.org/obi/obiskim"` to all `Cargo.toml` files in the workspace, including `obicompactvec`, `obidebruinj`, `obifastwrite`, `obikalgorithm`, `obikdump`, `obikentropy`, `obikfilter`, `obikidxcache`, `obikindex`, `obikindexer`, `obikmer`, `obikmerge`, `obikphylo`, `obikquery`, `obikrebuild`, `obikrope`, `obikselect`, `obikseq`, `obiksession`, `obikstats`, `obipipeline`, `obiread`, `obiskbuilder`, `obiskio`, `obisys`, and `obitaxonomy`. - Update `src/obikrope/Cargo.toml` to use `criterion2` version 3 with the `cargo_bench_support` feature. - Update `src/obikseq/Cargo.toml` to replace the "OnceLock-based params" feature with a new feature description involving thread-local storage. - Update `src/Cargo.lock` to reflect the version bump of `obikmer` from 1.4.7 to 1.4.8.
This commit is contained in:
1 parent
58e57ceae5
commit
8159137f8b
59 files changed
+3102
-17
No files matched your search
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# Generates .cargo/config.toml (local, ignored by jj) for joint development:
|
||||
# - the definition of the private registry;
|
||||
# - a [patch.<registry>] for each registry dependency that has a neighbouring folder
|
||||
# (../<name>/Cargo.toml), so that the project builds against the neighbouring code without publishing.
|
||||
# Only the dependencies actually declared by this project are patched: no unused patch
|
||||
# (Cargo complains about it), whatever the number of crates coming out of a workspace.
|
||||
#
|
||||
# Run by crate.mk on every make invocation. The file is rewritten only if it changes.
|
||||
# Reads the root Cargo.toml and those of the direct subfolders (workspace members);
|
||||
# only the dependencies on one line `name = { …, registry = "<registry>" }` are seen.
|
||||
# A .cargo/config.toml that was not generated by this script is never overwritten (warning).
|
||||
set -euo pipefail
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
[ -f "$CARGO_TOML" ] || exit 0
|
||||
# Nothing to generate without a registry (no extension) nor for crates.io (cargo's default index and token).
|
||||
[ -n "$REGISTRY" ] && [ "$REGISTRY" != crates-io ] || exit 0
|
||||
|
||||
marker="# Generated by .crate-kit/scripts/dev-patch.sh"
|
||||
config=".cargo/config.toml"
|
||||
|
||||
if [ -f "$config" ] && ! grep -q "^$marker" "$config"; then
|
||||
warn "⚠ $config was not generated by the kit: left as is. If it is tracked by the repository,"
|
||||
warn " delete it and add /.cargo/config.toml to .gitignore (the CI uses an environment variable)."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
self=$(crate_name)
|
||||
manifests=("$CARGO_TOML")
|
||||
# Root of a workspace whose member CARGO_TOML designates (workspace): this is where the shared
|
||||
# dependencies ([workspace.dependencies]) are declared.
|
||||
[ "$CARGO_TOML" != Cargo.toml ] && [ -f Cargo.toml ] && manifests+=(Cargo.toml)
|
||||
for m in */Cargo.toml; do [ -f "$m" ] && manifests+=("$m"); done
|
||||
|
||||
registry_deps() {
|
||||
sed -nE "s/^([A-Za-z0-9_-]+)[[:space:]]*=[[:space:]]*\{[^}]*registry[[:space:]]*=[[:space:]]*\"$REGISTRY\".*/\1/p" "$@"
|
||||
}
|
||||
names=$(registry_deps "${manifests[@]}" | sort -u)
|
||||
# Transitive closure through the neighbours: a dependency of a patched neighbour (a -> a-macros)
|
||||
# must be patched too, otherwise the project builds the neighbour against the published version of its own
|
||||
# dependency and not against the neighbouring code.
|
||||
while :; do
|
||||
more=$(for n in $names; do [ -f "../$n/Cargo.toml" ] && registry_deps "../$n/Cargo.toml"; done | sort -u)
|
||||
merged=$(printf '%s\n%s\n' "$names" "$more" | sed '/^$/d' | sort -u)
|
||||
[ "$merged" = "$names" ] && break
|
||||
names=$merged
|
||||
done
|
||||
|
||||
patches=""
|
||||
for n in $names; do
|
||||
[ "$n" = "$self" ] && continue
|
||||
[ -f "../$n/Cargo.toml" ] && patches+="$n = { path = \"../$n\" }"$'\n'
|
||||
done
|
||||
|
||||
new="$marker on every \`make\`: do not edit, do not commit (ignored by the repository).
|
||||
# Private registry and, for joint development, dependencies resolved to the neighbouring folders.
|
||||
[registries.$REGISTRY]
|
||||
index = \"$REGISTRY_INDEX\"
|
||||
"
|
||||
[ -n "$patches" ] && new+="
|
||||
[patch.$REGISTRY]
|
||||
$patches"
|
||||
|
||||
if [ ! -f "$config" ] || [ "$(cat "$config")" != "${new%$'\n'}" ]; then
|
||||
mkdir -p .cargo
|
||||
printf '%s' "$new" >"$config"
|
||||
list=$(printf '%s' "$patches" | sed 's/ = .*//' | paste -sd' ' -)
|
||||
info " $config updated (local patches: ${list:-none})"
|
||||
fi
|
||||
Reference in new issue
Block a user