Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool for generating BUILD files from Cargo.toml #13

Closed
davidzchen opened this issue Jun 17, 2016 · 5 comments
Closed

Tool for generating BUILD files from Cargo.toml #13

davidzchen opened this issue Jun 17, 2016 · 5 comments

Comments

@davidzchen
Copy link
Member

Creating a tool for generating BUILD/WORKSPACE files from Cargo.toml+Cargo.lock would be very useful and would greatly lower the barrier for Rust developers who are used to Cargo to use Bazel to build Rust projects.

This would be similar in concept to the glaze tool for generating BUILD files for Go projects (bazelbuild/rules_go#15).

One possible fun name for this tool: raze

@yugui
Copy link
Member

yugui commented Jun 23, 2016

Now I'm trying to implement a BUILD file generator for Go, called gazel.

In this effort, I realized that there are some language-independent features required by such BUILD file generator. So it might be better if we can share implementation of such features.

The features are, for example,

  1. Locate existing WORKSPACE files in the target repository.
  2. Reconcile existing manually-configured rules with the automatically generated ones.
    e.g. sometimes users need to manually add data, license or args attributes into automatically generated rules.
    In this case, BUILD file generator needs to respect such attributes when it runs next time.

davidzchen referenced this issue in kythe/kythe Jun 29, 2016
Summary:
Prepping for the implementation of the rust indexer,
this commit sets up bazel builds for rust. Currently it only
builds a hello world program but the project is split into
two different components a library and an executable.

Test Plan:
Run bazel build //kythe/rust/indexer:release. If rust is
present it will build, and //kythe/rust/indexer:test will run the
tests. If rust is not present both will fail and display an error
message.

Reviewers: zarko, schroederc

Reviewed By: schroederc

Projects: #rust

Differential Revision: https://phabricator-dot-kythe-repo.appspot.com/D931
@davidzchen
Copy link
Member Author

davidzchen commented Jul 12, 2016

+cc @kchodorow, @damienmg

Those are some good ideas, @yugui. Ideally, it would be great to have a generic tool for generating BUILD/WORKSPACE with extensions that are specific to different languages and different build systems (e.g. Cargo for Rust, go build for Go, Dub for D, etc.). Ideally, this should also make it possible to bring in the generate_workspace for Java projects as an extension as well.

I am thinking perhaps the language-specific extension can be something like a separate command line tool that outputs data in a common format such as JSON (since most likely, most languages should have a JSON library) that would specify what should be added to the WORKSPACE file, the BUILD files to generate, etc.

WDYT?

As for naming, have you considered keeping the name of the tool as glaze or maybe even gaze? I'm thinking that the name gazel might be a bit obscure since it doesn't sound like another word (as opposed to Bazel sounding like "basil") and the original pun around the name would be lost. :)

@damienmg
Copy link
Collaborator

+cc @laurentlb has proposed making the skylark/build file parser from bazel an independent library.

@lilianmoraru
Copy link

Update: a similar tool was created and it seems to do the job pretty ok: https://github.com/acmcarther/cargo-raze

@mfarrugi
Copy link
Collaborator

Raze now lives at https://github.com/google/cargo-raze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants