New command: heavenly matrix-deps
An investigation tool. Somewhat similar to bazel query
, this command shows a list of build targets that depend on a set of files.
With it, one can try measure the effects of changing COPY commands in Earthfiles around a repo.
heavenly matrix-deps ./+build-images genproto/api/v1/api.pb.go
Analyzing BUILD commands 100% |████████████████████████████████████████████████████████████████████████████| (52/52, 42 it/s)
Analyzing 52 targets took 1.251641042s
8 targets depend on inputs [genproto/api/v1/api.pb.go]:
————————————————————————————————————————————————————————————————————————————————
./pkg/+build
./backend/pkg/+build
./backend/test/e2e/+build
./backend/cmd/api/+build
./backend/service/api/+build
./backend/service/b/cmd/+build
./backend/service/c/cmd/+build
./backend/service/d/cmd/+build
New command: heavenly gocopies
A development tool. Inspired by Gazelle, this is a rudimentary attempt at dependency resolution specific to the Go language.
It builds the COPY commands necessary for a given Go directory. It mostly gets things right, but not always; but sure to review its output.
$ heavenly gocopies --transitive backend/some/pkg
# Go imports (generated with `heavenly gocopies --include-transitive backend/service/user`)
COPY --dir $TOP/backend/db/+src/sqlclient/* $TOP/backend/db/sqlclient/
COPY --dir $TOP/backend/genproto/+src/service/user/v1/* $TOP/backend/genproto/service/user/v1/
COPY --dir $TOP/backend/pkg/+src/context/userctx/* $TOP/backend/pkg/context/userctx/ # indirect
COPY --dir $TOP/backend/pkg/+src/deferutil/* $TOP/backend/pkg/deferutil/
COPY --dir $TOP/backend/pkg/+src/logger/* $TOP/backend/pkg/logger/ # indirect
# Go test imports (generated with `heavenly gocopies --include-transitive backend/test/pkg`)
COPY --dir $TOP/backend/genmock/+src/genproto/service/user/v1/* $TOP/backend/genmock/genproto/service/user/v1/
COPY --dir $TOP/backend/test/pkg/+src/testdb/* $TOP/backend/test/pkg/testdb/