aspect-cli icon indicating copy to clipboard operation
aspect-cli copied to clipboard

[DOC]: document how to produce a runnable dev binary

Open oncilla opened this issue 2 years ago • 3 comments

While working on the auto completion of aspect, I wanted to build a binary such that I can invoke it with tab completion. I have not found a straight-forward way to do so.

After running bazel build //:aspect, there is a binary in bazel-bin/cmd/aspect/aspect_/aspect as expected. However, the binary is not functional:

$ aspect --help
Error: could not resolve the version '5.1.1-3-gb951e36' to an actual version number: Invalid version '5.1.1-3-gb951e36'

To work around this, I had to create a wrapper script that invokes aspect through bazel run:

#!/bin/bash

bazel run //:aspect -- $@

I'm sure there must be a better way with setting some flags, or have a special .bazelrc config. But I did not find it (without looking too far).

I think the "supported" way of doing this should be documented in the contribution guide

oncilla avatar Jan 15 '23 18:01 oncilla

Thanks for the issue. I'll fix this workflow up asap.

gregmagolan avatar Feb 07 '23 15:02 gregmagolan

Hmm. I'm not able to reproduce this locally off at HEAD.

$ bazel-bin/cmd/aspect/aspect_/aspect --version
aspect 5.1.4-7-g2d480a0
$ bazel-bin/cmd/aspect/aspect_/aspect --help
Aspect CLI is a better frontend for running bazel

I tried going back to a commit just past 5.1.1.

The error itself is coming from vendored Bazelisk code, https://github.com/aspect-build/aspect-cli/blob/8351b40ac6c626b16817a80aa7420536eb1d25a8/pkg/bazel/bazelisk.go#L130. However, I can't see how the stamped version of the binary could make it there. Could you please try to reproduce at HEAD?

gregmagolan avatar Feb 27 '23 07:02 gregmagolan

Seem to still be the case for me:

$ ./bazel-bin/cmd/aspect/aspect_/aspect --version
Error: could not resolve the version '5.8.5-4-g7289b1d' to an actual version number: Invalid version '5.8.5-4-g7289b1d'

oncilla avatar Oct 31 '23 20:10 oncilla