mirror of
https://github.com/bazelbuild/platforms
synced 2024-11-27 02:43:23 +00:00
1e362cd247
The bazel docs [1] currently recommend users to create an `incompatible` constraint in their own code base. This constraint is useful in expressing more advanced target compatibilities. Currently every project has to create their own definition for this constraint. That is unnecessary proliferation of something that can be easily centralized here. This patch makes it so users will be able to use the following pattern in their BUILD files: cc_library( name = "unixish_lib", srcs = "unixish_lib.cc", target_compatible_with = select({ "@platforms//os:osx": [], "@platforms//os:linux": [], "//conditions:default": ["@platforms//:incompatible"], ], ) [1]: https://docs.bazel.build/versions/master/platforms.html#skipping-incompatible-targets
30 lines
722 B
Python
30 lines
722 B
Python
package(default_visibility = ["//visibility:public"])
|
|
|
|
licenses(["notice"])
|
|
|
|
exports_files(["LICENSE"])
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = [
|
|
"BUILD",
|
|
"WORKSPACE",
|
|
"//cpu:srcs",
|
|
"//os:srcs",
|
|
],
|
|
)
|
|
|
|
# For use in Incompatible Target Skipping:
|
|
# https://docs.bazel.build/versions/master/platforms.html#skipping-incompatible-targets
|
|
#
|
|
# Specifically this lets targets declare incompatibility with some set of
|
|
# platforms. See
|
|
# https://docs.bazel.build/versions/master/platforms.html#more-expressive-constraints
|
|
# for some more details.
|
|
constraint_setting(name = "incompatible_setting")
|
|
|
|
constraint_value(
|
|
name = "incompatible",
|
|
constraint_setting = ":incompatible_setting",
|
|
)
|