-
Notifications
You must be signed in to change notification settings - Fork 171
Bazel Rules for Cuelang #163
Comments
Can you give a more concrete example of how things look like for what you had in mind? |
@mpvl most languages contain some form of Jsonnet, for example, has a rules_jsonnet which supplies some common functionality that you might want to do:
Something that might work for cuelang would likely be:
Some of these might be better to implement outside of a |
Gotcha. This would have to be build int the bazelbuild Github repo. Also, I'm quite unfamiliar with bazel and this should ideally be build by someone that is using this in practice. I am happy to help or guide the person doing this, though. |
Though I'm not familiar with this bazel rules either, a step in this direction may be to support builds using tinyGo. I may be mistaken but I believe some of the same limitations around go modules are shared between a bazelbuild and a tinyGo build. A tinyGo build would also likely reduce the overhead of running cue and make the WASM target much lighter (relate wasm/npm ticket) |
@mpvl I'm a Bazel contributor and the original author of bazelbuild/rules_rust, bazelbuild/rules_jsonnet, and bazelbuild/rules_d. I'm interested in writing Bazel rules for Cue. Since Bazel Cue rules will depend on the cue executable, my understanding is that we would need to add BUILD files for building Cue (using bazelbuild/rules_go). I think bazelbuild/bazel-gazelle will be helpful for generating and updating BUILD files. I think the rules that @gravypod listed is a good start. For data validation, I am thinking we can have I will have to do more reading on Cue's other use cases, but if aren't objections, I can write a short proposal and start working on a proof of concept of building Cue with Bazel and an initial prototype with WDYT? |
If you didn't feel like arranging for building cue in these rules, you could instead download built executable files using |
@seh would be an option but http_archive and other workspace rules are a little cumbersome. If build files and rules were in repo you could vendor this project in your company's third_party very easily. You could also use git_repository to refer to any commit. |
I use |
bazelbuild/bazel-gazelle can be used to automatically generate BUILD files, and it also adds all the I was able to generate I still need to verify that all the tests run successfully, but I think I can send a PR for this soon. |
FYI the changes are in the |
Some remaining issues to resolve from this first pass:
|
Sorry for the delay. I’ve been busy, but I have resumed working on this. There are some issues with getting some of the tests run by Bazel to correctly find the testdata files. Hoping to get the PR out within the next week. |
I think it's perhaps better to just download the cue binaries maybe? That's would remove the dependency to rules_go.
Also, I'm not sure adding bazel files in this repo is the way to go unless Cue maintainers actively use them. Worst would be for those build files to be unmaintained. |
I've created an initial set of Bazel rules for cue: https://github.com/tnarg/rules_cue. I'd love to get your feedback on them. They include a |
@tnarg super nice! saw a few things but overall really nice! |
@tnarg opened a few issues! very impressed overall! I would have opened PRs but I'm busy on something else at the moment. Great job. |
This issue has been migrated to cue-lang/cue#163. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
I was wondering if there was a canonical set of rules for using cuelang in a bazel build environment. For my usecase this would be helpful for reducing the tooling a new engineer will need to learn and allow for better integration with things like tilt
bazel run //deployments:development
would be very nice.I think this also makes sense to mainline in cuelang as, from the README.md, code generation from CUE is a planned feature. The ability to have a
cue_library
and automatically link generated code into projects of different languages would be very helpful.The text was updated successfully, but these errors were encountered: