Giter Site home page Giter Site logo

bazel-federation's Introduction

Bazel Federation

Experimental: do not depend on it.

The Bazel Federation is a set of rules at versions that have been tested together to ensure interoperability.

Goals

This repository will contain examples and tests for the most important Bazel rules. This allows us to ensure that all recommended rules work well together.

At the same time, it provides information to users. If a project uses both Scala and Haskell rules, it can know which versions of the rules were tested together and work well with a specific version of Bazel. We hope this will help users update their dependencies when they upgrade Bazel.

This repository is also a way for the Bazel team to monitor incompatible changes to recommended rules. If changes are needed to keep the examples working, we may push back and suggest a change to the rule; or the diff will serve as an example for anyone updating their code.

Example WORKSPACE

Load the federation first

workspace(name = "my_project")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "bazel_federation",
    url = "https://github.com/bazelbuild/bazel-federation/archive/130c84ec6d60f31b711400e8445a8d0d4a2b5de8.zip",
    sha256 = "9d4fdf7cc533af0b50f7dd8e58bea85df3b4454b7ae00056d7090eb98e3515cc",
    strip_prefix = "bazel-federation-130c84ec6d60f31b711400e8445a8d0d4a2b5de8",
    type = "zip",
)

If you want to pin specific versions of some rule sets, you may do that here. For example, we are using a specific commit of skylib.

http_archive(
    name = "bazel_skylib",
    url = "https://github.com/bazelbuild/bazel-skylib/archive/f130d7c388e6beeb77309ba4e421c8f783b91739.zip",
    sha256 = "8eb5bce85cddd2f4e5232c94e57799de62b1671ce4f79f0f83e10e2d3b2e7986",
    strip_prefix = "bazel-skylib-f130d7c388e6beeb77309ba4e421c8f783b91739",
    type = "zip",
)

Now load the initializer methods for all the rules you want to use.

load("@bazel_federation//:repositories.bzl",
     "bazel_stardoc",
     "rules_cc",
     "rules_java",
     "rules_pkg",
     "rules_python",
)

For each rule set, follow this pattern

  • rule name()
  • load("@bazel_federation//setup:rule_name.bzl", "rule_name_setup")
  • rule_name_setup()

The setup method will bring in any dependencies needed for the rules and do any toolchain setup

rules_cc()
load("@bazel_federation//setup:rules_cc.bzl", "rules_cc_setup")
rules_cc_setup()

rules_java()
load("@bazel_federation//setup:rules_java.bzl", "rules_java_setup")
rules_java_setup()

rules_python()
load("@bazel_federation//setup:rules_python.bzl", "rules_python_setup")
rules_python_setup()

rules_pkg()
load("@bazel_federation//setup:rules_pkg.bzl", "rules_pkg_setup")
rules_pkg_setup()

bazel_stardoc()
load("@bazel_federation//setup:bazel_stardoc.bzl", "bazel_stardoc_setup")
bazel_stardoc_setup()

Federation testing on Bazel CI

Build status

We test pull requests on Bazel CI: A CI build runs all tests for each member project and builds several example projects from this repository. Moreover, the federation gets tested with upcoming incompatible Bazel flags as part of the downstream pipeline.

The CI configuration for each member project is based on their regular presubmit CI configuration, but we had to disable some targets that could not be tested remotely. Please see the individual CI configuration files in the .bazelci directory for details.

More information

Documentation

bazel-federation's People

Contributors

aiuto avatar brandjon avatar dslomov avatar fweikert avatar laurentlb 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.