Files
eng-pad/Makefile
Kyle Isom bedd3977b8 Fix protobuf setup: canonical proto, buf lint, Makefile proto target
- Restored canonical proto from eng-pad-server (PageData, StrokeData
  message names, not Notebook/Page/Stroke)
- Added java_package + java_multiple_files options
- Renamed service to EngPadSyncService (buf STANDARD lint compliance)
- Simplified build.gradle.kts: removed broken custom GenerateProtoTask,
  proto stubs generated via Makefile `make proto` and checked into git
- Generated stubs in app/src/main/java/gen/
- Fixed SyncClient/SyncManager to match canonical proto schema
- Updated dependency versions: protobuf 4.34.1, grpc 1.80.0, grpcKotlin 1.5.0
- Added buf.yaml with STANDARD lint rules and FILE breaking detection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:24:45 -07:00

78 lines
2.1 KiB
Makefile

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
# Proto generation output directory (checked into git)
PROTO_GEN := app/src/main/java/gen
PROTO_SRC := app/src/main/proto
.PHONY: build test lint clean run devrun apk proto proto-lint 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
# Build release APK
apk:
./gradlew assembleRelease
@echo "APK: app/build/outputs/apk/release/app-release-unsigned.apk"
# Generate Kotlin/gRPC stubs from .proto files
proto:
@rm -rf $(PROTO_GEN)
@mkdir -p $(PROTO_GEN)
protoc \
--proto_path=$(PROTO_SRC) \
--proto_path=$$(protoc --print-proto-path 2>/dev/null || echo /usr/local/include) \
--java_out=lite:$(PROTO_GEN) \
--kotlin_out=lite:$(PROTO_GEN) \
--plugin=protoc-gen-grpc=$$(which protoc-gen-grpc-java 2>/dev/null || echo $(HOME)/bin/protoc-gen-grpc-java) \
--grpc_out=lite:$(PROTO_GEN) \
--plugin=protoc-gen-grpckt=$(HOME)/bin/protoc-gen-grpckt \
--grpckt_out=lite:$(PROTO_GEN) \
$$(find $(PROTO_SRC) -name '*.proto')
# Lint proto files with buf
proto-lint:
buf lint
buf breaking --against '.git#branch=master,subdir=$(PROTO_SRC)'
# 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)