From 09e8a79fa4c3a91b937b31f3f497028efbc7146d Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Sat, 14 Feb 2026 13:22:04 +0100 Subject: [PATCH] Use make native file caching (#583) To force redo cached tasks (reinstall tools), a user can run `make -B install-tools`. --- CONTRIBUTING.md | 6 +++++ Makefile | 68 ++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b04cf6179..146aa47ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,12 @@ To contribute you will need Rust, cargo, cross, trunk, wasm-bindgen, and cargo-s make install-tools ``` +To force a reinstall of tooling or updating to the latest version, you can run: + +```bash +make -B install-tools +``` + ### Steps to Contribute 1. **Fork the Repository**: Start by forking the Tuliprox repository to your GitHub account. diff --git a/Makefile b/Makefile index a0b49b43e..a7956435f 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,18 @@ -# --- Setup and OS Detection --- -OS := $(shell uname -s) +# OS Detection +OS := $(shell uname -s) ARCH := $(shell uname -m) +# Paths +CARGO_BIN_DIR := $(HOME)/.cargo/bin + # Tool Commands -CARGO := cargo -RUSTUP := rustup +RUSTUP := $(CARGO_BIN_DIR)/rustup +CARGO := $(CARGO_BIN_DIR)/cargo +CROSS := $(CARGO_BIN_DIR)/cross +TRUNK := $(CARGO_BIN_DIR)/trunk +WASM_BINDGEN := $(CARGO_BIN_DIR)/wasm-bindgen +CARGO_SET_VERSION := $(CARGO_BIN_DIR)/cargo-set-version + # Explicitly force stable/nightly to avoid system-wide overrides CARGO_STABLE := $(CARGO) +stable CARGO_NIGHTLY := $(CARGO) +nightly @@ -25,17 +33,7 @@ help: ## Display this help ##@ Prerequisites: .PHONY: install-tools -install-tools: check-rustup install-nightly-fmt ## Install all required development tools - @echo "📦 Checking and installing CLI tools..." - @command -v cross >/dev/null || $(CARGO_STABLE) install cross - @command -v trunk >/dev/null || $(CARGO_STABLE) install trunk - @command -v wasm-bindgen >/dev/null || $(CARGO_STABLE) install wasm-bindgen-cli - @command -v cargo-set-version >/dev/null || $(CARGO_STABLE) install cargo-edit - @echo "✅ All tools installed" - -.PHONY: check-rustup -check-rustup: ## Ensure rustup is installed - @command -v $(RUSTUP) >/dev/null || (echo "❌ rustup not found. Please install it from https://rustup.rs"; exit 1) +install-tools: rustup install-nightly-fmt cross trunk wasm-bindgen cargo-set-version ## Install required development tools .PHONY: install-nightly-fmt install-nightly-fmt: ## Install nightly toolchain specifically for formatting @@ -43,6 +41,46 @@ install-nightly-fmt: ## Install nightly toolchain specifically for formatting @$(RUSTUP) toolchain install nightly --component rustfmt --profile minimal @echo "✅ Nightly rustfmt ready" +.PHONY: rustup +rustup: $(RUSTUP) ## Install Rust toolchain and cargo + +$(RUSTUP): + @echo "📦 Installing cargo" + @curl -sL https://sh.rustup.rs | sh -s -- -y + @echo "✅ Cargo installed" + +.PHONY: cross +cross: $(CROSS) ## Install cross (multi-platform build tool) + +$(CROSS): + @echo "📦 Installing cross" + @$(CARGO) install cross + @echo "✅ Cross installed" + +.PHONY: trunk +trunk: $(TRUNK) ## Install trunk (frontend build tool) + +$(TRUNK): + @echo "📦 Installing trunk" + @$(CARGO) install trunk + @echo "✅ Trunk installed" + +.PHONY: wasm-bindgen +wasm-bindgen: $(WASM_BINDGEN) ## Install wasm-bindgen CLI (for frontend builds) + +$(WASM_BINDGEN): + @echo "📦 Installing wasm-bindgen CLI" + @$(CARGO) install wasm-bindgen-cli + @echo "✅ wasm-bindgen CLI installed" + +.PHONY: cargo-set-version +cargo-set-version: $(CARGO_SET_VERSION) ## Install cargo-set-version (for version management) + +$(CARGO_SET_VERSION): + @echo "📦 Installing $@" + @$(CARGO) install cargo-edit + @echo "✅ $@ installed" + ##@ Development: .PHONY: test