Giter Site home page Giter Site logo

abitofhelp / bazel_monorepo_go_rust Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 166 KB

This repository contains a monorepo, polyglot project consisting of a library for Go and Rust.

License: MIT License

Starlark 49.09% Makefile 39.12% Go 5.08% Rust 6.72%
bazel cargo go golang monorepo polyglot rust

bazel_monorepo_go_rust's Introduction

bazel_monorepo_go_rust

This repository contains a monorepo, polyglot project consisting of a library for Go and Rust.
These libraries can be built using the appropriate native tool -- go build or Cargo -- and Bazel.
The source of truth for dependencies are the go.mod/vendors and Cargo files.
The Makefile contains many queries and commands for using the native tools for Go and Rust within Bazel as well as Bazel commands.

Valid Bazel Labels

  • //pkg/golang:srcs
  • //pkg/golang/src/grpc_client_lib:grpc_client_lib
  • //pkg/golang/src/grpc_client_lib:grpc_client_lib_test
  • //pkg/rust/src:srcs
  • //pkg/rust/src/grpc_client_lib:grpc_client_lib
  • //pkg/rust/src/grpc_client_lib:grpc_client_lib_test

To Change Go's and Rust's Versions

  • Execute the set_golang_version command in the Makefile.
  • Execute the set_rust_version command in the Makefile.

To Add A New Go Project

  • Create a directory in /pkg/golang/src for the new Go project.
  • Clone the files from grpc_client_lib to the new project's directory.
  • Amend the files for the new project's needs.
  • Add the relative path to the new project to the use() in go.work.
    • i.e. /pkg/golang/src/mynewproject
  • You may want to clone the build_grpc_golang_client_lib command in the Makefile for directly building the new project.
  • Verify that you can build the Go projects by executing the go_build_all (go build used) command in the Makefile.
  • Verify that you can build the Go projects by executing the build_all (bazel used) command in the Makefile.

To Add A New Rust Project

  • Create a directory in /pkg/rust/src for the new Rust project.
  • Clone the files from grpc_client_lib to the new project's directory.
  • Amend the files for the new project's needs.
  • Add the bazel target to the new project to the crates_repository.manifests block in the WORKSPACE file.

crates_repository( name = "crate_index", cargo_lockfile = "//:Cargo.lock", lockfile = "//:cargo-bazel-lock.json", manifests = [ "//:Cargo.toml", "//:pkg/rust/src/grpc_client_lib/Cargo.toml", "//:pkg/rust/src/mynewproject/Cargo.toml", ], )

  • You may want to clone the build_grpc_rust_client_lib command in the Makefile for directly building the new project.
  • Add the relative path to the new project to the workspace.members block in Cargo.toml file.

[workspace] resolver = "2" members = [ "pkg/rust/src/grpc_client_lib", "pkg/rust/src/mynewproject", ]

  • Verify that you can build the Rust projects by executing the rust_build_all (Cargo used) command in the Makefile.
  • Verify that you can build the Rust projects by executing the build_all (bazel used) command in the Makefile.

bazel_monorepo_go_rust's People

Contributors

abitofhelp avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.