# Private registry and local Cargo configuration (joint development). # Fragment included by crate.mk and by the Makefiles that are not crates (workspace): # include .crate-kit/dev-patch.mk DEVPATCH_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) CARGO_TOML ?= Cargo.toml # Values specific to the organization (REGISTRY, REGISTRY_INDEX, FORGE_URL…): org.mk, provided by the # extension that the crate declares (KIT_OVERLAY, tools/kit-assemble.sh). REGISTRY = crates-io: crates.io, without # index or [patch]. Without org.mk, no registry: publish and deps-check fail saying so. -include $(DEVPATCH_DIR)/org.mk REGISTRY ?= REGISTRY_INDEX ?= export CARGO_TOML REGISTRY REGISTRY_INDEX FORGE_TOKEN_FILE # Private registry: the index comes from the environment, never from a file tracked by the repository (CI, # Docker and a repository cloned alone therefore work without configuration). ifneq ($(filter-out crates-io,$(strip $(REGISTRY))),) REGISTRY_UP := $(shell echo '$(REGISTRY)' | tr 'a-z-' 'A-Z_') CARGO_REGISTRIES_$(REGISTRY_UP)_INDEX := $(REGISTRY_INDEX) export CARGO_REGISTRIES_$(REGISTRY_UP)_INDEX endif # Joint development: .cargo/config.toml (local, ignored) is regenerated at EVERY invocation of # make, whatever the target, from the project's actual dependencies. Nothing to remember. DEV_PATCH_RUN := $(shell CARGO_TOML='$(CARGO_TOML)' REGISTRY='$(REGISTRY)' REGISTRY_INDEX='$(REGISTRY_INDEX)' $(DEVPATCH_DIR)/scripts/dev-patch.sh) .PHONY: dev-patch ## dev-patch: Regenerates .cargo/config.toml (registry + local patches); already done at every make dev-patch: @$(DEVPATCH_DIR)/scripts/dev-patch.sh @echo "ok: .cargo/config.toml up to date" .PHONY: deps-check deps-bump ## deps-check: Dependencies up to date? from the private registry (requirement, lock, neighbour, duplicates) and external (requirement, minor, lock) deps-check: @rc=0; $(DEVPATCH_DIR)/scripts/deps-check.sh || rc=1; $(DEVPATCH_DIR)/scripts/deps-check-external.sh || rc=1; exit $$rc ## deps-bump: Raises the outdated requirements (private registry and external) to the latest version, then cargo update -p deps-bump: @$(DEVPATCH_DIR)/scripts/deps-check.sh bump @$(DEVPATCH_DIR)/scripts/deps-check-external.sh bump