Skip to content

incompatible_use_platforms_repo_for_constraints: Don't use constraints from @bazel_tools, use @platforms instead #8622

@hlopko

Description

@hlopko

Available since: 0.28
Tracking issue: #6516

Motivation

Bazel currently provides common constraints for platforms and toolchains in @bazel_tools//platforms. We are migrating these out of the Bazel binary to a principled, standalone repository over at https://github.com/bazelbuild/platforms which can be released independently from the Bazel binary and which defines a process for adding more constraints.

Migration

Ideally, declare an explicit dependency on https://github.com/bazelbuild/platforms, name the repository as @platforms, and use constraints from this repository. In cases where you cannot depend on https://github.com/bazelbuild/platforms (please tell us the reason in the comment), you can use the snapshot of https://github.com/bazelbuild/platforms in Bazel - Bazel implicitly provides this repository for Bazel's needs.

The actual migration in BUILD files is simple - use @platforms//setting:value instead of @bazel_tools//platforms:value:

sed 's$@bazel_tools//platforms:(linux|osx|windows|android|freebsd|ios|os)$@platforms//os:\1$' -E -i **/*
sed 's$@bazel_tools//platforms:(cpu|x86_32|x86_64|ppc|arm|aarch64|s390x)$@platforms//cpu:\1$' -i -E **/*

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)breaking-change-6.0Incompatible flags to be flipped in Bazel 6.0incompatible-changeIncompatible/breaking changemigration-readyIncompatible flag is ready for migration with Bazel rolling releases or Bazel@last_greenteam-Configurabilityplatforms, toolchains, cquery, select(), config transitionstype: process

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions