blob: a0fbd3c432b4f3d7df64b72a76f06c8c9c772364 [file] [log] [blame] [edit]
# Copyright 2022 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.
workspace(name = "sdk-integration")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Location of Fuchsia source directory, relative to this workspace.
fuchsia_source_dir = "../../.."
local_repository(
name = "platforms",
path = "%s/third_party/bazel_platforms" % fuchsia_source_dir,
)
local_repository(
name = "bazel_skylib",
path = "%s/third_party/bazel_skylib" % fuchsia_source_dir,
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
# rules_python is a dependency of both rules_fuchsia and rules_licenses.
# and requires py_repositories() to be called from the workspace file.
local_repository(
name = "rules_python",
path = "%s/third_party/bazel_rules_python" % fuchsia_source_dir,
)
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
# Setup fuchsia rules
local_repository(
name = "rules_fuchsia",
path = "../bazel_rules_fuchsia",
)
load(
"@rules_fuchsia//fuchsia:deps.bzl",
"fuchsia_sdk_repository",
"rules_fuchsia_deps",
)
rules_fuchsia_deps()
fuchsia_sdk_repository(
name = "fuchsia_sdk",
)
# Register the fuchsia_sdk toolchain
load("@rules_fuchsia//fuchsia:deps.bzl", "register_fuchsia_sdk_toolchain")
register_fuchsia_sdk_toolchain()
register_toolchains("//:fuchsia_sdk_devicetree_toolchain")
# Create the @fuchsia_build_config information to get host_tag information.
load("@rules_fuchsia//common:fuchsia_platform_build.bzl", "fuchsia_build_config_repository")
fuchsia_build_config_repository(
name = "fuchsia_build_config",
fuchsia_source_dir = fuchsia_source_dir,
)
load("@fuchsia_build_config//:defs.bzl", "build_config")
load(
"@rules_fuchsia//fuchsia:clang.bzl",
"fuchsia_clang_repository",
)
fuchsia_clang_repository(
name = "fuchsia_clang",
local_path = "%s/prebuilt/third_party/clang/%s" % (
fuchsia_source_dir,
build_config.host_tag,
),
)
load("@fuchsia_clang//:defs.bzl", "register_clang_toolchains")
register_clang_toolchains()
# Register compact python runtime toolchain. This picks up the host
# python3 interpreter in the current PATH, and packages it in a way
# that allows sandboxes and remote builders to access / use it.
load(
"@rules_fuchsia//common:toolchains/python/repository_rule.bzl",
"compact_python_runtime_repository",
)
compact_python_runtime_repository(
name = "prebuilt_python",
)
register_toolchains("@prebuilt_python//:py_toolchain")
# Register an empty C++ host toolchain, because thiss test suite
# needs to run on CI bots without GCC or Clang installed.
load(
"@rules_fuchsia//common:toolchains/clang/repository_utils.bzl",
"empty_host_cpp_toolchain_repository",
)
empty_host_cpp_toolchain_repository(
name = "host_no_cpp",
)
register_toolchains("@host_no_cpp//:empty_cpp_toolchain")
fuchsia_sdk_repository(
name = "fuchsia_sdk_x64_only",
local_paths = [
"sdk_generation/goldens/simple_idk_x64",
],
)
fuchsia_sdk_repository(
name = "fuchsia_sdk_arm64_only",
local_paths = [
"sdk_generation/goldens/simple_idk_arm64",
],
)
fuchsia_sdk_repository(
name = "fuchsia_sdk_both",
local_paths = [
"sdk_generation/goldens/simple_idk_both",
],
)
# The @fuchsia_in_tree_idk repository is ignored, except when running the
# test suite for the Fuchsia platform build. In this case it will
# be overridden explicitly on the command-line with
# `--override-repository=fuchsia_in_tree_idk=<realpath>`, but a
# declaration must appear in this file for it.
new_local_repository(
name = "fuchsia_in_tree_idk",
build_file_content = "",
path = "scripts",
repo_mapping = {},
)
local_repository(
name = "fuchsia-infra-bazel-rules",
path = "%s/third_party/fuchsia-infra-bazel-rules/src" % fuchsia_source_dir,
)
new_local_repository(
name = "bazel",
build_file_content = """
# Copyright 2024 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.
filegroup(
name = "all_files",
srcs = glob(["**/*"]),
visibility = ["//visibility:public"],
)
""",
path = "%s/prebuilt/third_party/bazel/%s" % (
fuchsia_source_dir,
build_config.host_tag,
),
)
# gTest.
local_repository(
name = "com_google_googletest",
path = "%s/third_party/googletest/src" % fuchsia_source_dir,
)