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) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 14:14:08 -07:00
parent 0b53023a25
commit 8f41c41589
3 changed files with 63 additions and 9 deletions

View File

@@ -9,13 +9,17 @@ eng-pad is an Android note-taking app built around notebooks with an EMR pen as
## Build Commands ## Build Commands
```bash ```bash
./gradlew build # Compile everything make all # lint → test → build
./gradlew test # Run unit tests make build # Compile debug + release APKs
./gradlew lint # Run Android Lint make test # Run unit tests
./gradlew installDebug # Install debug APK to connected device 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: # Run a single test class:
./gradlew test --tests "net.metacircular.engpad.data.StrokeBlobTest" make test-one CLASS=net.metacircular.engpad.data.StrokeBlobTest
``` ```
## Architecture ## Architecture
@@ -62,9 +66,10 @@ eng-pad/
│ │ └── res/ │ │ └── res/
│ └── test/ -- Unit tests │ └── test/ -- Unit tests
├── build.gradle.kts -- Root build config ├── build.gradle.kts -- Root build config
├── settings.gradle.kts ├── settings.gradle.kts -- Project settings (foojay JDK resolver)
├── gradle.properties ├── gradle.properties
├── gradle/libs.versions.toml -- Version catalog ├── gradle/libs.versions.toml -- Version catalog
├── Makefile -- Build targets (build, test, lint, run, devrun)
├── CLAUDE.md -- This file ├── CLAUDE.md -- This file
├── README.md ├── README.md
├── DESIGN.md -- Technical design ├── DESIGN.md -- Technical design

View File

@@ -190,7 +190,7 @@ The editor toolbar controls the active mode:
redrawn only when strokes change (add, delete, move). redrawn only when strokes change (add, delete, move).
2. **In-progress stroke** (pen is down) is drawn directly to the canvas on 2. **In-progress stroke** (pen is down) is drawn directly to the canvas on
each `onDraw` call, on top of the backing bitmap. 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. 4. The view `Matrix` transforms everything from canonical to screen space.
This approach means `onDraw` is fast for the common case (pen moving): This approach means `onDraw` is fast for the common case (pen moving):
@@ -317,14 +317,15 @@ eng-pad/
│ └── kotlin/net/metacircular/engpad/ │ └── kotlin/net/metacircular/engpad/
│ ├── data/ │ ├── data/
│ │ ├── StrokeBlobTest.kt -- Float array ↔ blob roundtrip │ │ ├── StrokeBlobTest.kt -- Float array ↔ blob roundtrip
│ │ └── RepositoryTest.kt -- CRUD + cascade delete │ │ └── PageSizeTest.kt -- Page size enum tests
│ └── undo/ │ └── undo/
│ └── UndoManagerTest.kt -- Undo/redo logic │ └── UndoManagerTest.kt -- Undo/redo logic
├── build.gradle.kts -- Root build config ├── build.gradle.kts -- Root build config
├── settings.gradle.kts -- Project settings ├── settings.gradle.kts -- Project settings (foojay JDK resolver)
├── gradle.properties -- Gradle properties ├── gradle.properties -- Gradle properties
├── gradle/ ├── gradle/
│ └── libs.versions.toml -- Version catalog │ └── libs.versions.toml -- Version catalog
├── Makefile -- Build targets (build, test, lint, run, devrun)
├── .gitignore ├── .gitignore
├── CLAUDE.md ├── CLAUDE.md
├── README.md ├── README.md

48
Makefile Normal file
View File

@@ -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)