| # 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. |
| |
| """ |
| IMPORTANT: This file is only used when BzlMod is NOT enabled when generating |
| the Bazel workspace used by the Fuchsia platform build. Keep its content in |
| sync with toplevel.MODULE.bazel whenever possible!! |
| """ |
| |
| # LINT.IfChange |
| workspace(name = "main") |
| # LINT.ThenChange(//build/bazel/scripts/bazel_action.py) |
| |
| local_repository( |
| name = "platforms", |
| path = "third_party/bazel_platforms", |
| ) |
| |
| # Note that this is a fake repository that only contains the minimum |
| # amount of declarations required by Bazel to run. The Fuchsia platform |
| # build does not support Java, and will likely never will, and using |
| # this fake repository prevents unexpected downloads and dependencies. |
| local_repository( |
| name = "rules_java", |
| path = "build/bazel/local_repositories/rules_java", |
| ) |
| |
| load( |
| "//:third_party/pigweed/repositories.bzl", |
| "setup_pigweed_repository_dependencies", |
| ) |
| |
| setup_pigweed_repository_dependencies() |
| |
| local_repository( |
| name = "remote_coverage_tools", |
| path = "build/bazel/local_repositories/remote_coverage_tools", |
| ) |
| |
| local_repository( |
| name = "bazel_skylib", |
| path = "third_party/bazel_skylib", |
| ) |
| |
| # NOTE this must appear before bazel_skylib_workspace() call. |
| local_repository( |
| name = "rules_license", |
| path = "third_party/bazel_rules_license", |
| ) |
| |
| local_repository( |
| name = "rules_cc", |
| path = "third_party/bazel_rules_cc", |
| ) |
| |
| local_repository( |
| name = "io_bazel_rules_go", |
| path = "third_party/bazel_rules_go", |
| ) |
| |
| local_repository( |
| name = "rules_rust", |
| path = "third_party/bazel_rules_rust", |
| ) |
| |
| # A dependency of rules_rust |
| new_local_repository( |
| name = "rules_rust_tinyjson", |
| path = "third_party/rust_crates/vendor/tinyjson-2.5.0", |
| build_file = "@rules_rust//util/process_wrapper:BUILD.tinyjson.bazel", |
| ) |
| |
| local_repository( |
| name = "rules_python", |
| path = "third_party/bazel_rules_python", |
| ) |
| |
| local_repository( |
| name = "rules_proto", |
| path = "third_party/bazel_rules_proto", |
| ) |
| |
| local_repository( |
| name = "pigweed", |
| path = "third_party/pigweed/src", |
| ) |
| |
| # This is a @pigweed dependency. |
| local_repository( |
| name = "com_google_emboss", |
| path = "third_party/github.com/google/emboss/src", |
| ) |
| |
| # The repository containing common definitions for the Fuchsia platform build |
| # and the Fuchsia Bazel SDK rules. |
| local_repository( |
| name = "fuchsia_sdk_common", |
| path = "build/bazel_sdk/bazel_rules_fuchsia/common", |
| ) |
| |
| # Create the @fuchsia_build_config repository which contains the defs.bzl file |
| # exporting a `build_config` struct of configuration information specific to |
| # the Fuchsia platform build. |
| # buildifier: disable=load-on-top |
| load( |
| "@fuchsia_sdk_common//:fuchsia_platform_build.bzl", |
| "fuchsia_build_config_repository", |
| ) |
| |
| fuchsia_build_config_repository( |
| name = "fuchsia_build_config", |
| ) |
| |
| # buildifier: disable=load-on-top |
| load("@fuchsia_build_config//:defs.bzl", "build_config") |
| |
| fuchsia_host_tag = build_config.host_tag |
| fuchsia_host_tag_alt = build_config.host_tag_alt |
| fuchsia_host_os = build_config.host_os |
| ninja_output_dir = build_config.ninja_output_dir |
| |
| # Create the @fuchsia_icu_config repository which contains the constants.bzl file |
| # exporting generating configuration constants related to the ICU library flavors |
| # buildifier: disable=load-on-top |
| load( |
| "//:build/bazel/icu/repository_rules.bzl", |
| "fuchsia_icu_config_repository", |
| ) |
| |
| fuchsia_icu_config_repository( |
| name = "fuchsia_icu_config", |
| # LINT.IfChange |
| content_hash_file = "fuchsia_build_generated/fuchsia_icu_config.hash", |
| # LINT.ThenChange(scripts/update_workspace.py) |
| ) |
| |
| # buildifier: disable=load-on-top |
| load( |
| "@bazel_skylib//:workspace.bzl", |
| "bazel_skylib_workspace", |
| ) |
| |
| bazel_skylib_workspace() |
| |
| # buildifier: disable=load-on-top |
| load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies") |
| |
| rules_rust_dependencies() |
| |
| # buildifier: disable=load-on-top |
| load( |
| "//:build/bazel/toolchains/rust/repository_rules.bzl", |
| "generate_prebuilt_rust_toolchain_repository", |
| ) |
| |
| generate_prebuilt_rust_toolchain_repository( |
| name = "fuchsia_prebuilt_rust", |
| rust_install_dir = "prebuilt/third_party/rust/" + fuchsia_host_tag, |
| ) |
| |
| register_toolchains( |
| "@fuchsia_prebuilt_rust//:rust_" + fuchsia_host_tag_alt, |
| "@fuchsia_prebuilt_rust//:rust_fuchsia_x64", |
| "@fuchsia_prebuilt_rust//:rust_fuchsia_arm64", |
| ) |
| |
| # buildifier: disable=load-on-top |
| load( |
| "@io_bazel_rules_go//go:deps.bzl", |
| "go_register_toolchains", |
| "go_rules_dependencies", |
| "go_wrap_sdk", |
| ) |
| |
| go_wrap_sdk( |
| name = "go_sdk", |
| root_file = "//:prebuilt/third_party/go/%s/README.md" % fuchsia_host_tag, |
| ) |
| |
| go_rules_dependencies() |
| go_register_toolchains() |
| |
| # Create @fuchsia_workspace |
| # NOTE: The following repository is only valid for bootstraping other |
| # repositories (eg: cipd, clang, fuchsia sdk). |
| # Once @fuchsia_sdk is initialized, it should be used whenever possible. |
| local_repository( |
| name = "fuchsia_workspace", |
| path = "build/bazel_sdk/bazel_rules_fuchsia", |
| ) |
| |
| # googletest is a dependency from @fuchsia_sdk amd requires a local |
| # patch for now for Fuchsia support, which is handled by a repository rule. |
| # |
| # local_repository( |
| # name = "com_google_googletest", |
| # path = "third_party/googletest/src", |
| # ) |
| # buildifier: disable=load-on-top |
| load( |
| "//:build/bazel/repository_rules.bzl", |
| "bazel_inputs_repository", |
| "boringssl_repository", |
| "fuchsia_build_info_repository", |
| "gn_targets_repository", |
| "googletest_repository", |
| ) |
| |
| # com_google_absl is a dependency of com_google_googletest |
| local_repository( |
| name = "com_google_absl", |
| path = "third_party/abseil-cpp", |
| ) |
| |
| fuchsia_build_info_repository( |
| name = "fuchsia_build_info", |
| # LINT.IfChange |
| args = "//:fuchsia_build_generated/args.json", |
| # LINT.ThenChange(scripts/update_workspace.py) |
| ) |
| |
| googletest_repository( |
| name = "com_google_googletest", |
| # LINT.IfChange |
| content_hash_file = "fuchsia_build_generated/com_google_googletest.hash", |
| # LINT.ThenChange(scripts/update_workspace.py) |
| ) |
| |
| boringssl_repository( |
| name = "boringssl", |
| content_hash_file = "fuchsia_build_generated/boringssl.hash", |
| ) |
| |
| bazel_inputs_repository( |
| name = "legacy_ninja_build_outputs", |
| inputs_manifest = "//:bazel_inputs_manifest.json", |
| ) |
| |
| gn_targets_repository( |
| name = "gn_targets", |
| # LINT.IfChange |
| inputs_manifest = "fuchsia_build_generated/gn_targets_repository_manifest.json", |
| all_licenses_spdx_json = "fuchsia_build_generated/gn_targets_all_licenses_spdx.json", |
| # LINT.ThenChange(//build/bazel/scripts/bazel_action.py) |
| ) |
| |
| # buildifier: disable=load-on-top |
| load( |
| "@fuchsia_workspace//fuchsia:deps.bzl", |
| "fuchsia_sdk_repository", |
| "rules_fuchsia_deps", |
| ) |
| |
| rules_fuchsia_deps() |
| |
| fuchsia_sdk_repository( |
| name = "fuchsia_sdk", |
| local_paths = ["%s/sdk/exported/bazel_fuchsia_sdk_idk" % ninja_output_dir], |
| # LINT.IfChange |
| local_sdk_version_file = "//:fuchsia_build_generated/fuchsia_sdk.hash", |
| # LINT.ThenChange(scripts/update_workspace.py) |
| fuchsia_api_level_override = "HEAD", |
| buildifier = "//:prebuilt/third_party/buildifier/%s/buildifier" % fuchsia_host_tag, |
| ) |
| |
| fuchsia_sdk_repository( |
| name = "internal_sdk", |
| local_paths = ["%s/sdk/exported/platform" % ninja_output_dir], |
| # LINT.IfChange |
| local_sdk_version_file = "//:fuchsia_build_generated/internal_sdk.hash", |
| # LINT.ThenChange(scripts/update_workspace.py) |
| parent_sdk = "@fuchsia_sdk", |
| parent_sdk_local_paths = ["%s/sdk/exported/bazel_fuchsia_sdk_idk" % ninja_output_dir], |
| fuchsia_api_level_override = "HEAD", |
| ) |
| |
| register_toolchains("@fuchsia_sdk//:fuchsia_toolchain_sdk") |
| |
| # buildifier: disable=load-on-top |
| load( |
| "@fuchsia_workspace//fuchsia:clang.bzl", |
| "fuchsia_clang_repository", |
| ) |
| |
| fuchsia_clang_repository( |
| name = "fuchsia_clang", |
| local_path = "prebuilt/third_party/clang/" + fuchsia_host_tag, |
| local_version_file = "//:fuchsia_build_generated/fuchsia_clang.hash", |
| ) |
| |
| # buildifier: disable=load-on-top |
| load( |
| "@fuchsia_clang//:defs.bzl", |
| "register_clang_toolchains", |
| ) |
| |
| register_clang_toolchains() |
| |
| # buildifier: disable=load-on-top |
| load( |
| "//:build/bazel/toolchains/clang/repository_rules.bzl", |
| "generate_prebuilt_clang_toolchain_repository", |
| "generate_prebuilt_llvm_repository", |
| ) |
| |
| generate_prebuilt_llvm_repository( |
| name = "prebuilt_llvm", |
| # NOTE: We don't have Fuchsia variant of LLVM libraries yet, so always use |
| # host_platform's prebuilts for now. Currently, this repository is only used |
| # to expose headers from prebuilt LLVM, so it should make no difference as |
| # headers are the same across different platforms. |
| # |
| # See https://cs.opensource.google/fuchsia/fuchsia/+/main:src/lib/llvm/BUILD.gn;l=51;drc=468d94479b10f5613ca928d782990e5340e943a4 |
| llvm_install_dir = "prebuilt/third_party/llvm/" + fuchsia_host_tag, |
| ) |
| |
| generate_prebuilt_clang_toolchain_repository( |
| name = "prebuilt_clang", |
| clang_install_dir = "prebuilt/third_party/clang/" + fuchsia_host_tag, |
| # LINT.IfChange |
| repository_version_file = "fuchsia_build_generated/prebuilt_clang.hash", |
| # LINT.ThenChange(scripts/update_workspace.py) |
| ) |
| register_toolchains("@prebuilt_clang//:host_clang_%s_x64_cc_toolchain" % fuchsia_host_os) |
| register_toolchains("@prebuilt_clang//:host_clang_%s_arm64_cc_toolchain" % fuchsia_host_os) |
| |
| # buildifier: disable=load-on-top |
| load( |
| "@fuchsia_sdk_common//:toolchains/python/repository_rule.bzl", |
| "compact_python_runtime_repository", |
| ) |
| |
| compact_python_runtime_repository( |
| name = "prebuilt_python", |
| # LINT.IfChange |
| content_hash_file = "fuchsia_build_generated/prebuilt_python.hash", |
| # LINT.ThenChange(scripts/update_workspace.py) |
| ) |
| |
| register_toolchains("@prebuilt_python//:py_toolchain") |