mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
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`.
This commit is contained in:
1 parent
6a9fac7ec0
commit
8c6a3171d7
2 files changed
+15
No files matched your search
@@ -7,6 +7,7 @@ BUF := buf
|
|||||||
|
|
||||||
GO_PACKAGES := ./...
|
GO_PACKAGES := ./...
|
||||||
SIDECAR_JAR := sidecar/build/libs/sidecar-all.jar
|
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
|
SDK_AAR := sdk/android/build/outputs/aar/sdk-android-release.aar
|
||||||
UATU_BIN := bin/uatu
|
UATU_BIN := bin/uatu
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ uatu: $(UATU_BIN)
|
|||||||
|
|
||||||
$(UATU_BIN): $(SIDECAR_JAR)
|
$(UATU_BIN): $(SIDECAR_JAR)
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
|
cp $(SIDECAR_JAR) $(SIDECAR_EMBED)
|
||||||
$(GO) build -o $(UATU_BIN) ./cmd/uatu
|
$(GO) build -o $(UATU_BIN) ./cmd/uatu
|
||||||
|
|
||||||
$(SIDECAR_JAR):
|
$(SIDECAR_JAR):
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/priyanshujain/uatu/internal/sidecar"
|
||||||
)
|
)
|
||||||
|
|
||||||
type doctorCheck struct {
|
type doctorCheck struct {
|
||||||
@@ -22,9 +24,20 @@ func defaultDoctorChecks() []doctorCheck {
|
|||||||
{Name: "adb on PATH", Run: checkExecutableOnPath("adb")},
|
{Name: "adb on PATH", Run: checkExecutableOnPath("adb")},
|
||||||
{Name: "emulator on PATH or under ANDROID_HOME", Run: checkEmulator},
|
{Name: "emulator on PATH or under ANDROID_HOME", Run: checkEmulator},
|
||||||
{Name: "java 17+ on PATH", Run: checkJavaVersion},
|
{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 {
|
func runDoctorChecks(ctx context.Context, checks []doctorCheck, stdout io.Writer) error {
|
||||||
failures := 0
|
failures := 0
|
||||||
for _, check := range checks {
|
for _, check := range checks {
|
||||||
|
|||||||
Reference in new issue
Block a user