85eaa3ea37
Critical: - Replace DISPATCH_TIME_FOREVER with 120s/30s timeouts in ObjC - Log failed asset IDs and error messages in cmdExport/backupTree - Show failed count in export summaries Cleanup: - Remove legacy Bridge methods (ExportAlbumPreviews, ExportAlbumOriginals, BackupAll) - Remove legacy ObjC functions and C stub equivalents - Remove photos.go delegates (package-level pass-throughs) - Remove InterpretExportResult (only used by legacy methods) - Clean up mockBridge fields (rename Fn2 -> Fn) - Fix rc race condition in main_main.go (atomic.Int32) - Remove unused variables (_ = grandTotal, _ = sig) Design: - Fix resolveAlbumID: ListAlbums first (cheap), then direct ID - Unify Cloud type: Asset.Cloud string (was bool) - Extract shared export logic into exportAssets/exportOne - Add worker pool for parallel exports (3 workers when assets >= 4) - Fix backupTree progress bar counter and directory prefix Robustness: - Add nil checks for stringWithUTF8String: in ObjC - Log directory creation errors in ensure_directory (ObjC) Quality: - Add go vet and -race flag to Makefile test target - Add ADR for performSelector cloudIdentifier decision - Add sync comments between Go/ObjC sanitizePathComponent - Add package-level doc comment - Add tests: partial failure, skipped album, album-not-found message
59 lines
1.9 KiB
Makefile
59 lines
1.9 KiB
Makefile
BINARY := ./bin/photoscli
|
|
MODULE := gitea.k3s.k0.nu/tools/photocli
|
|
VERSION := 0.2.0
|
|
BRIDGE_DIR := bridge
|
|
LDFLAGS := -X main.version=$(VERSION)
|
|
OBJ := $(BRIDGE_DIR)/photokit_bridge.o
|
|
LIB := $(BRIDGE_DIR)/libphotokit_bridge.a
|
|
STUB_OBJ := $(BRIDGE_DIR)/photokit_bridge_stub.o
|
|
STUB_LIB := $(BRIDGE_DIR)/libphotokit_bridge_stub.a
|
|
GITEA_HOST := gitea-1.tail82444.ts.net
|
|
GITEA_REPO := tools/photocli
|
|
|
|
.PHONY: all build clean test coverage tag release pipeline
|
|
|
|
all: build
|
|
|
|
$(LIB): $(OBJ)
|
|
ar rcs $@ $<
|
|
|
|
$(OBJ): $(BRIDGE_DIR)/photokit_bridge.m $(BRIDGE_DIR)/photokit_bridge.h
|
|
cc -c -x objective-c -fobjc-arc -framework Photos -framework Foundation -o $@ $<
|
|
|
|
$(STUB_LIB): $(STUB_OBJ)
|
|
ar rcs $@ $<
|
|
|
|
$(STUB_OBJ): $(BRIDGE_DIR)/photokit_bridge_stub.c $(BRIDGE_DIR)/photokit_bridge.h
|
|
cc -c -o $@ $<
|
|
|
|
build: $(LIB)
|
|
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(MODULE)/cmd/photoscli
|
|
|
|
test: $(STUB_LIB)
|
|
go vet -tags=test ./...
|
|
go test -tags=test -race -coverprofile=coverage.out -covermode=atomic -coverpkg=./... ./...
|
|
@grep -v 'main_main.go' coverage.out > coverage_filtered.out 2>/dev/null || true
|
|
@mv coverage_filtered.out coverage.out 2>/dev/null || true
|
|
@go tool cover -func=coverage.out | tail -1
|
|
|
|
coverage: $(STUB_LIB)
|
|
go test -tags=test -coverprofile=coverage.out -covermode=atomic -coverpkg=./... ./...
|
|
@grep -v 'main_main.go' coverage.out > coverage_filtered.out 2>/dev/null || true
|
|
@mv coverage_filtered.out coverage.out 2>/dev/null || true
|
|
go tool cover -func=coverage.out
|
|
|
|
clean:
|
|
rm -f $(BINARY) $(OBJ) $(LIB) $(STUB_OBJ) $(STUB_LIB) coverage.out
|
|
|
|
tag:
|
|
git tag v$(VERSION)
|
|
git push origin v$(VERSION)
|
|
|
|
release:
|
|
tea releases create --repo $(GITEA_REPO) --tag v$(VERSION) --title "v$(VERSION)" --asset $(BINARY)
|
|
|
|
pipeline: clean test build
|
|
@echo "--- verifying version ---"
|
|
$(BINARY) version
|
|
@echo "--- all checks passed, ready to release ---"
|
|
@echo "run: make release"
|