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 {