From 8c6a3171d73c4cc7d89402942d821806efeb3938 Mon Sep 17 00:00:00 2001 From: PJ Date: Sat, 18 Apr 2026 00:06:30 +0700 Subject: [PATCH] feat(cli): doctor check that surfaces placeholder sidecar JAR Doctor flags a shipped binary that's still carrying the build-time placeholder so `uatu test` won't silently fail trying to launch a nonexistent sidecar. Makefile uatu target now copies the freshly built fat JAR into the embed directory before `go build`. --- Makefile | 2 ++ cmd/uatu/doctor.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/Makefile b/Makefile index 289f858..b82d28d 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ BUF := buf GO_PACKAGES := ./... SIDECAR_JAR := sidecar/build/libs/sidecar-all.jar +SIDECAR_EMBED := internal/sidecar/assets/sidecar-all.jar SDK_AAR := sdk/android/build/outputs/aar/sdk-android-release.aar UATU_BIN := bin/uatu @@ -35,6 +36,7 @@ uatu: $(UATU_BIN) $(UATU_BIN): $(SIDECAR_JAR) mkdir -p bin + cp $(SIDECAR_JAR) $(SIDECAR_EMBED) $(GO) build -o $(UATU_BIN) ./cmd/uatu $(SIDECAR_JAR): diff --git a/cmd/uatu/doctor.go b/cmd/uatu/doctor.go index db626f8..5e9d095 100644 --- a/cmd/uatu/doctor.go +++ b/cmd/uatu/doctor.go @@ -10,6 +10,8 @@ import ( "regexp" "strconv" "time" + + "github.com/priyanshujain/uatu/internal/sidecar" ) type doctorCheck struct { @@ -22,9 +24,20 @@ func defaultDoctorChecks() []doctorCheck { {Name: "adb on PATH", Run: checkExecutableOnPath("adb")}, {Name: "emulator on PATH or under ANDROID_HOME", Run: checkEmulator}, {Name: "java 17+ on PATH", Run: checkJavaVersion}, + {Name: "sidecar JAR is real (not placeholder)", Run: checkSidecarJAR}, } } +func checkSidecarJAR(_ context.Context) error { + if sidecar.IsPlaceholder() { + return fmt.Errorf("placeholder JAR embedded — run `make sidecar && make uatu` to embed the real fat JAR") + } + if sidecar.EmbeddedSize() == 0 { + return fmt.Errorf("embedded JAR is empty") + } + return nil +} + func runDoctorChecks(ctx context.Context, checks []doctorCheck, stdout io.Writer) error { failures := 0 for _, check := range checks {