From 8f41c415898bf5252f22adc088729582b7b9b07e Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Tue, 24 Mar 2026 14:14:08 -0700 Subject: [PATCH] Add Makefile with build, test, run, and devrun targets Makefile wraps Gradle commands and adds emulator/device launch targets: - run: builds, starts DC-1 emulator if needed, installs and launches - devrun: builds, installs and launches on connected USB device - Updated CLAUDE.md and DESIGN.md source trees Co-Authored-By: Claude Opus 4.6 (1M context) --- CLAUDE.md | 17 +++++++++++------ DESIGN.md | 7 ++++--- Makefile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 Makefile diff --git a/CLAUDE.md b/CLAUDE.md index 773a56d..e413dfe 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,13 +9,17 @@ eng-pad is an Android note-taking app built around notebooks with an EMR pen as ## Build Commands ```bash -./gradlew build # Compile everything -./gradlew test # Run unit tests -./gradlew lint # Run Android Lint -./gradlew installDebug # Install debug APK to connected device +make all # lint → test → build +make build # Compile debug + release APKs +make test # Run unit tests +make lint # Run Android Lint +make clean # Clean build artifacts +make run # Build, install, and launch on emulator (starts emulator if needed) +make devrun # Build, install, and launch on connected USB device +make run AVD=Medium_Phone_API_36.0 # Use a specific AVD # Run a single test class: -./gradlew test --tests "net.metacircular.engpad.data.StrokeBlobTest" +make test-one CLASS=net.metacircular.engpad.data.StrokeBlobTest ``` ## Architecture @@ -62,9 +66,10 @@ eng-pad/ │ │ └── res/ │ └── test/ -- Unit tests ├── build.gradle.kts -- Root build config -├── settings.gradle.kts +├── settings.gradle.kts -- Project settings (foojay JDK resolver) ├── gradle.properties ├── gradle/libs.versions.toml -- Version catalog +├── Makefile -- Build targets (build, test, lint, run, devrun) ├── CLAUDE.md -- This file ├── README.md ├── DESIGN.md -- Technical design diff --git a/DESIGN.md b/DESIGN.md index c70ba66..dd31726 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -190,7 +190,7 @@ The editor toolbar controls the active mode: redrawn only when strokes change (add, delete, move). 2. **In-progress stroke** (pen is down) is drawn directly to the canvas on each `onDraw` call, on top of the backing bitmap. -3. **Grid** is drawn as a separate pass — thin gray lines at 14.4pt intervals. +3. **Grid** is drawn as a separate pass — thin gray lines at 60pt intervals. 4. The view `Matrix` transforms everything from canonical to screen space. This approach means `onDraw` is fast for the common case (pen moving): @@ -317,14 +317,15 @@ eng-pad/ │ └── kotlin/net/metacircular/engpad/ │ ├── data/ │ │ ├── StrokeBlobTest.kt -- Float array ↔ blob roundtrip -│ │ └── RepositoryTest.kt -- CRUD + cascade delete +│ │ └── PageSizeTest.kt -- Page size enum tests │ └── undo/ │ └── UndoManagerTest.kt -- Undo/redo logic ├── build.gradle.kts -- Root build config -├── settings.gradle.kts -- Project settings +├── settings.gradle.kts -- Project settings (foojay JDK resolver) ├── gradle.properties -- Gradle properties ├── gradle/ │ └── libs.versions.toml -- Version catalog +├── Makefile -- Build targets (build, test, lint, run, devrun) ├── .gitignore ├── CLAUDE.md ├── README.md diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3a9a3e4 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +ANDROID_HOME ?= $(HOME)/Library/Android/sdk +ADB := $(ANDROID_HOME)/platform-tools/adb +EMULATOR := $(ANDROID_HOME)/emulator/emulator +AVD ?= DC-1 +PACKAGE := net.metacircular.engpad +ACTIVITY := $(PACKAGE).MainActivity + +.PHONY: build test lint clean run devrun all + +# Build everything (compile + test + lint) +all: lint test build + +# Compile debug and release APKs +build: + ./gradlew build + +# Run unit tests +test: + ./gradlew test + +# Run a single test class: make test-one CLASS=net.metacircular.engpad.data.StrokeBlobTest +test-one: + ./gradlew test --tests "$(CLASS)" + +# Run Android lint +lint: + ./gradlew lint + +# Clean build artifacts +clean: + ./gradlew clean + +# Install and launch on the Android emulator. +# Starts the emulator if it isn't already running. +run: build + @if ! $(ADB) devices | grep -q emulator; then \ + echo "Starting emulator ($(AVD))..."; \ + $(EMULATOR) -avd $(AVD) -no-snapshot-load &>/dev/null & \ + $(ADB) wait-for-device; \ + echo "Emulator ready."; \ + fi + ./gradlew installDebug + $(ADB) -e shell am start -n $(PACKAGE)/$(ACTIVITY) + +# Install and launch on a connected USB device. +devrun: build + ./gradlew installDebug + $(ADB) -d shell am start -n $(PACKAGE)/$(ACTIVITY)