bazelbuild / bazelbuild/rules_rust

crate_universe: Rewrite generator in starlark

Open
#1,287 10 comments 1 reaction 0 assignees View on GitHub
crate-universe enhancement needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

This is just an idea, I'd really appreciate some feedback and ideas.

Is it conceivably possible to rewrite the generator in pure starlark? This would remove the bootstrapping problem of distributing generator binaries or hackily building the generator with the native cargo toolchain.

https://github.com/bazelbuild/rules_rust/blob/59fab4e79f62bfa13551ac851a40696c24c0c3a4/crate_universe/deps_bootstrap.bzl#L9

We're using a custom generator to work around some issues, but this makes the analysis phase almost a minute slower as repository rules are not remotely cacheable.

```
Finished release [optimized] target(s) in 38.77s
```

Failing a full rewrite, some more ideas:
- Rewrite only some functionality in starlark.
- Move some functionality out of the repository rule and into just a normal rule. This could be achieved with a macro. The normal rule could then check if repinning is required, whilst allowing the repository rule to generate the build files it needs.

Thanks for taking the time to read this :) Please don't hesitate to ask any questions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.