Update WORKSPACE to use a prebuilt host toolchain Change-Id: Iefc7ae6f02bf5ce22351da9cc1717f68ab2ae9ca Reviewed-on: https://fuchsia-review.googlesource.com/c/template/driver/+/907969 Reviewed-by: Jiaming Li <lijiaming@google.com>
diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..1228d5d --- /dev/null +++ b/.bazelrc
@@ -0,0 +1,7 @@ +# Copyright 2023 The Fuchsia Authors. All rights reserved +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file + +# Leave this line at the top of this file. It will pull in various useful defaults +# Any changes after this line will take precedence +try-import %workspace%/third_party/fuchsia-infra-bazel-rules/config/common_config.bazelrc
diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 5c77d00..52a983b 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel
@@ -4,6 +4,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +# Set up bazel skylib and its dependencies http_archive( name = "bazel_skylib", sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", @@ -17,6 +18,8 @@ bazel_skylib_workspace() +# The fuchsia_infra repository provides rules which allow us to work inside of +# fuchsia's infrastructure. local_repository( name = "fuchsia_infra", path = "third_party/fuchsia-infra-bazel-rules", @@ -27,10 +30,15 @@ fuchsia_infra_workspace() +# Create a common cipd binary which will be used to download prebuilts cipd_tool_repository( name = "cipd_tool", ) +# Fetch the Fuchsia SDK and register it as a repostiory. The version that is +# used is stored in the manifests/bazel_sdk.ensure file so it can be updated by +# our autoroller infrastructure. When the version changes bazel will fetch the +# new prebuilts. cipd_repository( name = "fuchsia_sdk", cipd_bin = "@cipd_tool//:cipd", @@ -44,6 +52,7 @@ rules_fuchsia_deps() +# The fuchsia toolchain contains tools like ffx and fidlc. register_toolchains("@fuchsia_sdk//:fuchsia_toolchain_sdk") load( @@ -51,6 +60,7 @@ "fuchsia_clang_repository", ) +# Set up our clang repository. fuchsia_clang_repository( name = "fuchsia_clang", cipd_bin = "@cipd_tool//:cipd", @@ -60,8 +70,17 @@ load("@fuchsia_clang//:defs.bzl", "register_clang_toolchains") +# Register a clang toolchain which will be used to compile fuchsia targets register_clang_toolchains() +load("@fuchsia_infra//infra:host_toolchains.bzl", "configure_fuchsia_clang_host_toolchain") + +# Configure a host toolchain for local execution. This is not used to compile +# fuchsia targets but is made available so we don't try to access the host gcc +# which is not available in infrastructure builds. This call must happen after +# you create a fuchsia_clang repository. +configure_fuchsia_clang_host_toolchain(name = "host_clang_toolchain") + # gTest. local_repository( name = "com_google_googletest",
diff --git a/manifests/bazel_sdk.ensure b/manifests/bazel_sdk.ensure index 62840d3..7a7cb18 100644 --- a/manifests/bazel_sdk.ensure +++ b/manifests/bazel_sdk.ensure
@@ -1,4 +1,4 @@ $ResolvedVersions bazel_sdk.resolved $VerifiedPlatform linux-amd64 mac-amd64 -fuchsia/sdk/core/fuchsia-bazel-rules/${os=linux}-${arch} version:14.20230811.1.1 -fuchsia/sdk/core/fuchsia-bazel-rules/${os=mac}-amd64 version:14.20230811.1.1 +fuchsia/sdk/core/fuchsia-bazel-rules/${os=linux}-${arch} version:14.20230825.3.1 +fuchsia/sdk/core/fuchsia-bazel-rules/${os=mac}-amd64 version:14.20230825.3.1
diff --git a/manifests/bazel_sdk.resolved b/manifests/bazel_sdk.resolved index 933918a..c1ae053 100644 --- a/manifests/bazel_sdk.resolved +++ b/manifests/bazel_sdk.resolved
@@ -2,9 +2,9 @@ # Do not modify manually. All changes will be overwritten. fuchsia/sdk/core/fuchsia-bazel-rules/linux-amd64 - version:14.20230811.1.1 - FMoDn9X0Ni9ZVynt7XfRFRkD5i1sEFrFLMwu0D6tUpoC + version:14.20230825.3.1 + -8e0YUn0dXZzKSPmEJLVtzk2lijh1zC9A1kny0WwWEsC fuchsia/sdk/core/fuchsia-bazel-rules/mac-amd64 - version:14.20230811.1.1 - ZE9Fp0kusiHYaCzkDnTTO4ydWEodKlMdpbhSUbTfpLIC + version:14.20230825.3.1 + d16iCfvEDT919buOe054wlxk0gATLK_GescQCMhrlaEC
diff --git a/platform_mappings b/platform_mappings new file mode 120000 index 0000000..d4586be --- /dev/null +++ b/platform_mappings
@@ -0,0 +1 @@ +third_party/fuchsia-infra-bazel-rules/config/fuchsia_platform_mappings \ No newline at end of file
diff --git a/third_party/fuchsia-infra-bazel-rules b/third_party/fuchsia-infra-bazel-rules index cee346b..d2a04e2 160000 --- a/third_party/fuchsia-infra-bazel-rules +++ b/third_party/fuchsia-infra-bazel-rules
@@ -1 +1 @@ -Subproject commit cee346b317bea2a1f51cb1fc07894b2af3e5ca53 +Subproject commit d2a04e20e4ad6ece319720bf2f9016227c7a36fe