Giter Club home page Giter Club logo

bz-platforms's Introduction

Set Up

  • bazelisk installed to ~/.local/bin/bazel.
  • buildifer and buildozer installed to ~/.local/bin/buildifier and ~/local/bin/buildozer.
  • IntelliJ Ultimate with Bazel plugin. File > Import Bazel Project.

References

Derived from https://github.com/hlopko/bazel_platforms_examples.

What?

Figure out how to define several execution platforms that will be used to generate artifacts that target those same platforms.

I.e. generate an artifact on debian for debian, on fedora for fedora, regardless of the host.

Why?

This is of particular value to anyone trying to generate an RPM, as the 'specification' of an RPM's compatibility with a target system is "defined" as whatever rpmbuild produces on those systems; glances at bootstrap paradox.

How?

BUILD.bazel defines a set of platforms and a set of toolchains.

The platforms are targeted with --platforms in .bazelrc for the various configs we build with.

Just run ./test.sh and see it work.

Target Compatibility vs. Execution Compatibility

As per Platforms:

Bazel recognizes three roles that a platform may serve:

  • Host - the platform on which Bazel itself runs.
  • Execution - a platform on which build tools execute build actions to produce intermediate and final outputs.
  • Target - a platform on which a final output resides and executes.

For trivial projects these will all be the same platform: @local_config_platform//:host.

We have several platforms, one for each //dist:*, we need an executor for each of these: otherwise targets will be built once for the first platform and cached for the subsequent platforms. Each platform specifies the docker image that the docker strategy must use as the executor. We've built these images with ./images.sh.

Our host is actually capable of executing all of these with the docker strategy, otherwise we'd need a remote executor host for each execution platform. We indicate this in WORKSPACE by registering all our execution platforms.

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.