From 70e64be8d6e0b402357a6653fdaf19dd52517491 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Mon, 6 Apr 2020 20:01:20 -0700 Subject: [PATCH] Remove old cross compile starlark rules (#5329) * Add buildbuddy BES (#5325) * Add buildbuddy BES * Merge branch 'master' of github.com:prysmaticlabs/prysm * remove old cross compile rules --- BUILD.bazel | 27 ---------------------- beacon-chain/BUILD.bazel | 14 +---------- tools/{binary_targets.bzl => go_image.bzl} | 26 --------------------- validator/BUILD.bazel | 14 +---------- 4 files changed, 2 insertions(+), 79 deletions(-) rename tools/{binary_targets.bzl => go_image.bzl} (69%) diff --git a/BUILD.bazel b/BUILD.bazel index 1dadc5314..e98e16e68 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,7 +4,6 @@ load("@com_github_atlassian_bazel_tools//goimports:def.bzl", "goimports") load("@io_kubernetes_build//defs:run_in_workspace.bzl", "workspace_binary") load("@io_bazel_rules_go//go:def.bzl", "nogo") load("@graknlabs_bazel_distribution//common:rules.bzl", "assemble_targz", "assemble_versioned") -load("//tools:binary_targets.bzl", "binary_targets", "determine_targets") prefix = "github.com/prysmaticlabs/prysm" @@ -108,37 +107,11 @@ nogo( ], ) -assemble_versioned( - name = "assemble-versioned-all", - tags = ["manual"], - targets = [ - ":assemble-{}-{}-targz".format( - pair[0], - pair[1], - ) - for pair in binary_targets - ], - version_file = "//:VERSION", -) - common_files = { "//:LICENSE.md": "LICENSE.md", "//:README.md": "README.md", } -[assemble_targz( - name = "assemble-{}-{}-targz".format( - pair[0], - pair[1], - ), - additional_files = determine_targets(pair, common_files), - output_filename = "prysm-{}-{}".format( - pair[0], - pair[1], - ), - tags = ["manual"], -) for pair in binary_targets] - toolchain( name = "built_cmake_toolchain", toolchain = "@rules_foreign_cc//tools/build_defs/native_tools:built_cmake", diff --git a/beacon-chain/BUILD.bazel b/beacon-chain/BUILD.bazel index fe67fa6f4..0cba3ee44 100644 --- a/beacon-chain/BUILD.bazel +++ b/beacon-chain/BUILD.bazel @@ -1,7 +1,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") load("@io_bazel_rules_docker//go:image.bzl", "go_image") load("@io_bazel_rules_docker//container:container.bzl", "container_bundle") -load("//tools:binary_targets.bzl", "binary_targets", "go_image_alpine", "go_image_debug") +load("//tools:go_image.bzl", "go_image_alpine", "go_image_debug") load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push") go_library( @@ -144,15 +144,3 @@ go_test( "@in_gopkg_urfave_cli_v2//:go_default_library", ], ) - -[go_binary( - name = "beacon-chain-{}-{}".format( - pair[0], - pair[1], - ), - embed = [":go_default_library"], - goarch = pair[1], - goos = pair[0], - tags = ["manual"], - visibility = ["//visibility:public"], -) for pair in binary_targets] diff --git a/tools/binary_targets.bzl b/tools/go_image.bzl similarity index 69% rename from tools/binary_targets.bzl rename to tools/go_image.bzl index 0baae467e..a457f394d 100644 --- a/tools/binary_targets.bzl +++ b/tools/go_image.bzl @@ -1,31 +1,5 @@ load("@io_bazel_rules_docker//container:providers.bzl", "ImageInfo") -# Supported pairs of system and architecture. (GOOS, GOARCH). -binary_targets = [ - ("linux", "amd64"), - ("linux", "arm64"), - # TODO(2849): Enable after cross OS compilation is supported. - # https://github.com/prysmaticlabs/prysm/issues/2849 - # ("darwin", "amd64"), - # ("windows", "amd64"), -] - -# Determine binary targets from a supported pair. These targets are part of the -# distributable bundle. -def determine_targets(pair, common_files): - targets = { - "//beacon-chain:beacon-chain-{}-{}".format( - pair[0], - pair[1], - ): "beacon-chain", - "//validator:validator-{}-{}".format( - pair[0], - pair[1], - ): "validator", - } - targets.update(common_files) - return targets - # Defines the debug transition implementation to enforce dbg mode. def _debug_transition_impl(settings, attr): return { diff --git a/validator/BUILD.bazel b/validator/BUILD.bazel index a095f9b4a..88cda1bbd 100644 --- a/validator/BUILD.bazel +++ b/validator/BUILD.bazel @@ -1,7 +1,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") load("@io_bazel_rules_docker//go:image.bzl", "go_image") load("@io_bazel_rules_docker//container:container.bzl", "container_bundle") -load("//tools:binary_targets.bzl", "binary_targets", "go_image_alpine", "go_image_debug") +load("//tools:go_image.bzl", "go_image_alpine", "go_image_debug") load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push") go_library( @@ -135,18 +135,6 @@ go_binary( ], ) -[go_binary( - name = "validator-{}-{}".format( - pair[0], - pair[1], - ), - embed = [":go_default_library"], - goarch = pair[1], - goos = pair[0], - tags = ["manual"], - visibility = ["//visibility:public"], -) for pair in binary_targets] - go_test( name = "go_default_test", srcs = ["usage_test.go"],