Skip to content

Commit

Permalink
Migrate rules_rust for incompatible_use_platforms_repo_for_constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Hlopko committed Nov 1, 2019
1 parent 1920386 commit c2ca4b7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,10 @@ rust_proto_toolchain(
toolchain(
name="rust_proto",
exec_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
target_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
toolchain = ":rust_proto_impl",
)
Expand Down Expand Up @@ -1125,10 +1125,10 @@ rust_toolchain(
toolchain(
name = "rust_cpuX",
exec_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
target_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
toolchain = ":rust_cpuX_impl",
)
Expand Down
4 changes: 2 additions & 2 deletions proto/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ rust_proto_toolchain(
toolchain(
name="rust_proto",
exec_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
target_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
toolchain = ":rust_proto_impl",
)
Expand Down
4 changes: 2 additions & 2 deletions rust/platform/platform.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ _SUPPORTED_T1_PLATFORM_TRIPLES = [
"x86_64-pc-windows-gnu",
"x86_64-unknown-linux-gnu",
# N.B. These "alternative" envs are not supported, as bazel cannot distinguish between them
# and others using existing @bazel_tools//platforms config_values
# and others using existing @platforms// config_values
#
#"i686-pc-windows-msvc",
#"x86_64-pc-windows-msvc",
]

# Some T2 Platforms are supported, provided we have mappings to @bazel_tools//platforms entries.
# Some T2 Platforms are supported, provided we have mappings to @platforms// entries.
# See @io_bazel_rules_rust//rust/platform:triple_mappings.bzl for the complete list.
_SUPPORTED_T2_PLATFORM_TRIPLES = [
"aarch64-apple-ios",
Expand Down
8 changes: 4 additions & 4 deletions rust/platform/triple_mappings.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CPUs that map to a "@bazel_tools//platforms entry
# CPUs that map to a "@platforms//cpu entry
_CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = {
"x86_64": "x86_64",
"powerpc": "ppc",
Expand All @@ -19,7 +19,7 @@ _CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = {
"mipsel": None,
}

# Systems that map to a "@bazel_tools//platforms entry
# Systems that map to a "@platforms//os entry
_SYSTEM_TO_BUILTIN_SYS_SUFFIX = {
"freebsd": "freebsd",
"linux": "linux",
Expand Down Expand Up @@ -72,7 +72,7 @@ def cpu_arch_to_constraints(cpu_arch):
if not plat_suffix:
fail("CPU architecture \"{}\" is not supported by rules_rust".format(cpu_arch))

return ["@bazel_tools//platforms:{}".format(plat_suffix)]
return ["@platforms//cpu:{}".format(plat_suffix)]

def vendor_to_constraints(vendor):
# TODO(acmcarther): Review:
Expand All @@ -87,7 +87,7 @@ def system_to_constraints(system):
if not sys_suffix:
fail("System \"{}\" is not supported by rules_rust".format(sys_suffix))

return ["@bazel_tools//platforms:{}".format(sys_suffix)]
return ["@platforms//os:{}".format(sys_suffix)]

def abi_to_constraints(abi):
# TODO(acmcarther): Implement when C++ toolchain is more mature and we
Expand Down
4 changes: 2 additions & 2 deletions rust/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ rust_toolchain(
toolchain(
name = "rust_cpuX",
exec_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
target_compatible_with = [
"@bazel_tools//platforms:cpuX",
"@platforms//cpu:cpuX",
],
toolchain = ":rust_cpuX_impl",
)
Expand Down

0 comments on commit c2ca4b7

Please sign in to comment.