Skip to content

Commit

Permalink
Pull in platform fixes from bazelbuild#1205
Browse files Browse the repository at this point in the history
  • Loading branch information
smukherj1 committed Oct 11, 2019
1 parent 279155a commit 20b767f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 106 deletions.
2 changes: 2 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ platforms:
# For tests/container:set_env_make_vars_test
- "--define=ENV_KEY=my_key"
- "--define=ENV_VALUE=my_value"
- "--extra_execution_platforms=@local_config_platform//:host,@io_bazel_rules_docker//platforms:local_container_platform"
test_targets:
- "--"
- "//tests/container:alpine_custom_attr_digest_test"
Expand Down Expand Up @@ -111,6 +112,7 @@ platforms:
- "--define=ENV_KEY=my_key"
- "--define=ENV_VALUE=my_value"
- "--test_output=errors"
- "--extra_execution_platforms=@local_config_platform//:host,@io_bazel_rules_docker//platforms:local_container_platform"
rbe_ubuntu1604:
build_targets:
- "--"
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ register_toolchains(
"@container_py_toolchain//:container_cc_toolchain",
)

register_execution_platforms("@local_config_platform//:host", "//platforms:local_container_platform")
register_execution_platforms("//platforms:local_container_platform")

http_archive(
name = "bazel_toolchains",
Expand Down Expand Up @@ -442,4 +442,4 @@ rbe_autoconfig(
use_legacy_platform_definition = False,
)

# gazelle:repo bazel_gazelle
# gazelle:repo bazel_gazelle
15 changes: 6 additions & 9 deletions python/image.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ load(
"//repositories:go_repositories.bzl",
_go_deps = "go_deps",
)
load(
"//toolchains:py_toolchains.bzl",
_py_toolchains = "py_toolchains",
)

# Load the resolved digests.
load(":python.bzl", "DIGESTS")
Expand All @@ -46,13 +42,14 @@ def repositories():
_go_deps()

# Register the default py_toolchain / platform for containerized execution
if "container_py_toolchain" not in native.existing_rules().keys():
_py_toolchains(name = "container_py_toolchain")
native.register_toolchains(
"@io_bazel_rules_docker//toolchains:container_py_toolchain",
"@container_py_toolchain//:container_cc_toolchain",
"@bazel_tools//tools/python:autodetecting_toolchain",
)
native.register_execution_platforms(
"@local_config_platform//:host",
"@io_bazel_rules_docker//platforms:local_container_platform",
)
native.register_execution_platforms("@io_bazel_rules_docker//platforms:local_container_platform")

excludes = native.existing_rules().keys()
if "py_image_base" not in excludes:
Expand Down Expand Up @@ -132,4 +129,4 @@ def py_image(name, base = None, deps = [], layers = [], **kwargs):
# workspace directory to ensure the symlinks are valid. See
# https://github.com/bazelbuild/rules_docker/issues/161 for details.
create_empty_workspace_dir = True,
)
)
15 changes: 6 additions & 9 deletions python3/image.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ load(
"//repositories:go_repositories.bzl",
_go_deps = "go_deps",
)
load(
"//toolchains:py_toolchains.bzl",
_py_toolchains = "py_toolchains",
)

# Load the resolved digests.
load(":python3.bzl", "DIGESTS")
Expand All @@ -45,13 +41,14 @@ def repositories():
_go_deps()

# Register the default py_toolchain / platform for containerized execution
if "container_py_toolchain" not in native.existing_rules().keys():
_py_toolchains(name = "container_py_toolchain")
native.register_toolchains(
"@io_bazel_rules_docker//toolchains:container_py_toolchain",
"@container_py_toolchain//:container_cc_toolchain",
"@bazel_tools//tools/python:autodetecting_toolchain",
)
native.register_execution_platforms(
"@local_config_platform//:host",
"@io_bazel_rules_docker//platforms:local_container_platform",
)
native.register_execution_platforms("@local_config_platform//:host", "@io_bazel_rules_docker//platforms:local_container_platform")

excludes = native.existing_rules().keys()
if "py3_image_base" not in excludes:
Expand Down Expand Up @@ -122,4 +119,4 @@ def py3_image(name, base = None, deps = [], layers = [], **kwargs):
args = kwargs.get("args"),
data = kwargs.get("data"),
testonly = kwargs.get("testonly"),
)
)
86 changes: 0 additions & 86 deletions toolchains/py_toolchains.bzl

This file was deleted.

0 comments on commit 20b767f

Please sign in to comment.