Use gazelle to generate bzl_library targets (#1127)

This commit is contained in:
James Sharpe 2023-12-21 10:42:09 +00:00 committed by GitHub
parent d4d22b75d7
commit 18dcce582f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 514 additions and 95 deletions

View File

@ -6,30 +6,18 @@ tasks:
- "//..." - "//..."
test_targets: test_targets:
- "//..." - "//..."
build_flags:
- "--noenable_bzlmod"
test_flags:
- "--noenable_bzlmod"
rbe_ubuntu1604: rbe_ubuntu1604:
platform: rbe_ubuntu1604 platform: rbe_ubuntu1604
build_targets: build_targets:
- "//..." - "//..."
test_targets: test_targets:
- "//..." - "//..."
build_flags:
- "--noenable_bzlmod"
test_flags:
- "--noenable_bzlmod"
macos: macos:
platform: macos platform: macos
build_targets: build_targets:
- "//..." - "//..."
test_targets: test_targets:
- "//..." - "//..."
build_flags:
- "--noenable_bzlmod"
test_flags:
- "--noenable_bzlmod"
windows: windows:
platform: windows platform: windows
build_targets: build_targets:
@ -108,6 +96,7 @@ tasks:
macos_targets: &macos_targets_standalone macos_targets: &macos_targets_standalone
- "//..." - "//..."
- "//:third_party_examples_macos_tests" - "//:third_party_examples_macos_tests"
- "-//cmake_android/..."
# Remove tests that depend on shared libraries, which currently doesn't work on MacOS - https://github.com/bazelbuild/bazel/issues/10254 # Remove tests that depend on shared libraries, which currently doesn't work on MacOS - https://github.com/bazelbuild/bazel/issues/10254
- "-@rules_foreign_cc_examples_third_party//curl:curl_test" - "-@rules_foreign_cc_examples_third_party//curl:curl_test"
- "-@rules_foreign_cc_examples_third_party//openssl:openssl_test" - "-@rules_foreign_cc_examples_third_party//openssl:openssl_test"
@ -116,14 +105,15 @@ tasks:
- "-c" - "-c"
- "dbg" - "dbg"
- "--spawn_strategy=standalone" - "--spawn_strategy=standalone"
- "-k"
- "--noincompatible_enable_cc_toolchain_resolution" - "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
test_targets: *macos_targets_standalone test_targets: *macos_targets_standalone
test_flags: test_flags:
- "-c" - "-c"
- "dbg" - "dbg"
- "--spawn_strategy=standalone" - "--spawn_strategy=standalone"
- "--noincompatible_enable_cc_toolchain_resolution" - "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
macos_examples: macos_examples:
name: Examples name: Examples
platform: macos platform: macos
@ -131,15 +121,18 @@ tasks:
macos_targets: &macos_targets macos_targets: &macos_targets
- "//..." - "//..."
- "//:third_party_examples_macos_tests" - "//:third_party_examples_macos_tests"
- "-//cmake_android/..."
# Remove tests that depend on shared libraries, which currently doesn't work on MacOS - https://github.com/bazelbuild/bazel/issues/10254 # Remove tests that depend on shared libraries, which currently doesn't work on MacOS - https://github.com/bazelbuild/bazel/issues/10254
- "-@rules_foreign_cc_examples_third_party//curl:curl_test" - "-@rules_foreign_cc_examples_third_party//curl:curl_test"
- "-@rules_foreign_cc_examples_third_party//openssl:openssl_test" - "-@rules_foreign_cc_examples_third_party//openssl:openssl_test"
build_targets: *macos_targets build_targets: *macos_targets
build_flags: build_flags:
- "--noincompatible_enable_cc_toolchain_resolution" - "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
test_targets: *macos_targets test_targets: *macos_targets
test_flags: test_flags:
- "--noincompatible_enable_cc_toolchain_resolution" - "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
windows_examples: windows_examples:
name: Examples name: Examples
platform: windows platform: windows

View File

@ -17,6 +17,7 @@ jobs:
# Create a job for release # Create a job for release
include: include:
- ref: main - ref: main
- ref: "0.10.1"
- ref: "0.9.0" - ref: "0.9.0"
- ref: "0.8.0" - ref: "0.8.0"
- ref: "0.7.1" - ref: "0.7.1"

View File

@ -1,20 +1,20 @@
load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
# "@bazel_tools//tools:bzl_srcs" is a filegroup. Convert define a `bzl_library` for it gazelle(
bzl_library( name = "gazelle",
name = "bazel_tools_bzl_srcs", gazelle = ":gazelle_bin",
srcs = ["@bazel_tools//tools:bzl_srcs"], )
gazelle_binary(
name = "gazelle_bin",
languages = DEFAULT_LANGUAGES + [
"@bazel_skylib_gazelle_plugin//bzl",
],
) )
bzl_library( bzl_library(
name = "bzl_srcs", name = "version",
srcs = glob(["**/*.bzl"]) + [ srcs = ["version.bzl"],
"@bazel_tools//tools:bzl_srcs",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [
":bazel_tools_bzl_srcs",
"//foreign_cc:bzl_srcs",
"//toolchains:bzl_srcs",
],
) )

View File

@ -8,13 +8,21 @@ module(
bazel_dep(name = "bazel_skylib", version = "1.1.1") bazel_dep(name = "bazel_skylib", version = "1.1.1")
bazel_dep(name = "platforms", version = "0.0.5") bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "rules_python", version = "0.20.0") bazel_dep(name = "rules_python", version = "0.23.0")
bazel_dep(name = "gazelle", version = "0.34.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.5.6", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True)
tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools")
use_repo( use_repo(
tools, tools,
"cmake_3.23.2_toolchains", "cmake_3.23.2_toolchains",
"cmake_src", "cmake_src",
"gettext_runtime",
"glib_dev",
"glib_src",
"gnumake_src", "gnumake_src",
"meson_src", "meson_src",
"ninja_1.11.1_toolchains", "ninja_1.11.1_toolchains",

View File

@ -17,8 +17,8 @@ bazel_skylib_workspace()
load("@rules_python//python:repositories.bzl", "python_register_toolchains") load("@rules_python//python:repositories.bzl", "python_register_toolchains")
python_register_toolchains( python_register_toolchains(
name = "python3_9", name = "python3_10",
python_version = "3.9", python_version = "3.10",
) )
load("//:docs/stardoc_repository.bzl", "stardoc_repository") load("//:docs/stardoc_repository.bzl", "stardoc_repository")
@ -41,3 +41,34 @@ rbe_preconfig(
name = "buildkite_config", name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11", toolchain = "ubuntu1804-bazel-java11",
) )
# Gazelle dependencies
http_archive(
name = "bazel_gazelle",
sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
],
)
http_archive(
name = "bazel_skylib_gazelle_plugin",
sha256 = "747addf3f508186234f6232674dd7786743efb8c68619aece5fb0cac97b8f415",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz",
],
)
load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace")
bazel_skylib_gazelle_plugin_workspace()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup")
bazel_skylib_gazelle_plugin_setup()
gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel")

View File

@ -1,3 +1,7 @@
# Bazel configuration flags for rules_foregin_cc_docs # Bazel configuration flags for rules_foreign_cc_docs
# https://github.com/bazelbuild/stardoc/issues/112
common --incompatible_allow_tags_propagation
common --noenable_bzlmod
build --workspace_status_command=tools/workspace_status.sh build --workspace_status_command=tools/workspace_status.sh

View File

@ -14,14 +14,25 @@ genrule(
# Note that the stardoc `out` files are prefixed with `stardoc_` so the # Note that the stardoc `out` files are prefixed with `stardoc_` so the
# `diff_test` targets which ensure documentation is up to date can access the # `diff_test` targets which ensure documentation is up to date can access the
# committed markdown files instead ouf the `out` targets from the stardoc rules # committed markdown files instead of the `out` targets from the stardoc rules
stardoc( stardoc(
name = "flatten_docs", name = "flatten_docs",
out = "stardoc_flatten.md", out = "stardoc_flatten.md",
header_template = ":flatten_header_vm", header_template = ":flatten_header_vm",
input = "docs.bzl", input = "docs.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"], tags = ["no-sandbox"], # https://github.com/bazelbuild/stardoc/issues/112
deps = [
"@rules_foreign_cc//foreign_cc:defs",
"@rules_foreign_cc//foreign_cc:repositories",
] + [
"@rules_foreign_cc//foreign_cc:cmake",
"@rules_foreign_cc//foreign_cc:configure",
"@rules_foreign_cc//foreign_cc:make",
"@rules_foreign_cc//foreign_cc:meson",
"@rules_foreign_cc//foreign_cc:ninja",
"@rules_foreign_cc//foreign_cc:providers",
],
) )
stardoc( stardoc(
@ -29,7 +40,7 @@ stardoc(
out = "stardoc_cmake.md", out = "stardoc_cmake.md",
header_template = "common_header.vm", header_template = "common_header.vm",
input = "@rules_foreign_cc//foreign_cc:cmake.bzl", input = "@rules_foreign_cc//foreign_cc:cmake.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"], deps = ["@rules_foreign_cc//foreign_cc:cmake"],
) )
stardoc( stardoc(
@ -37,7 +48,7 @@ stardoc(
out = "stardoc_make.md", out = "stardoc_make.md",
header_template = "common_header.vm", header_template = "common_header.vm",
input = "@rules_foreign_cc//foreign_cc:make.bzl", input = "@rules_foreign_cc//foreign_cc:make.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"], deps = ["@rules_foreign_cc//foreign_cc:make"],
) )
stardoc( stardoc(
@ -45,7 +56,7 @@ stardoc(
out = "stardoc_ninja.md", out = "stardoc_ninja.md",
header_template = "common_header.vm", header_template = "common_header.vm",
input = "@rules_foreign_cc//foreign_cc:ninja.bzl", input = "@rules_foreign_cc//foreign_cc:ninja.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"], deps = ["@rules_foreign_cc//foreign_cc:ninja"],
) )
stardoc( stardoc(
@ -53,7 +64,7 @@ stardoc(
out = "stardoc_configure_make.md", out = "stardoc_configure_make.md",
header_template = "common_header.vm", header_template = "common_header.vm",
input = "@rules_foreign_cc//foreign_cc:configure.bzl", input = "@rules_foreign_cc//foreign_cc:configure.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"], deps = ["@rules_foreign_cc//foreign_cc:configure"],
) )
stardoc( stardoc(
@ -61,7 +72,7 @@ stardoc(
out = "stardoc_meson.md", out = "stardoc_meson.md",
header_template = "common_header.vm", header_template = "common_header.vm",
input = "@rules_foreign_cc//foreign_cc:meson.bzl", input = "@rules_foreign_cc//foreign_cc:meson.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"], deps = ["@rules_foreign_cc//foreign_cc:meson"],
) )
stardoc( stardoc(
@ -69,7 +80,7 @@ stardoc(
out = "stardoc_providers.md", out = "stardoc_providers.md",
header_template = "common_header.vm", header_template = "common_header.vm",
input = "@rules_foreign_cc//foreign_cc:providers.bzl", input = "@rules_foreign_cc//foreign_cc:providers.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"], deps = ["@rules_foreign_cc//foreign_cc:providers"],
) )
DOCS_TARGETS = [ DOCS_TARGETS = [
@ -110,7 +121,7 @@ release="$${RELEASE}"
release_archive="$${RELEASE}" release_archive="$${RELEASE}"
# TODO: If a release is set, we assume it's set to a branch name. # TODO: If a release is set, we assume it's set to a branch name.
# thus we defautl the archive value to a commit. This is likely # thus we default the archive value to a commit. This is likely
# only appropriate when publishing on the branch in specified # only appropriate when publishing on the branch in specified
# and a smarter solution should be found to avoid unexpected behavior. # and a smarter solution should be found to avoid unexpected behavior.
if [[ -n "\\$${RELEASE:-}" ]]; then if [[ -n "\\$${RELEASE:-}" ]]; then
@ -123,9 +134,10 @@ cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:flatten_docs) > \\$${BUILD_WOR
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:cmake_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/cmake.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:cmake_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/cmake.md
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:ninja_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/ninja.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:ninja_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/ninja.md
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/make.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/make.md
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:meson_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/meson.md
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:configure_make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/configure_make.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:configure_make_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/configure_make.md
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:providers_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/providers.md cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:providers_docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/src/providers.md
# Non generated sourrces # Non generated sources
cp \\$${BUILD_WORKSPACE_DIRECTORY}/$(rootpath rules.md) \\$${BUILD_WORKSPACE_DIRECTORY}/src/rules.md cp \\$${BUILD_WORKSPACE_DIRECTORY}/$(rootpath rules.md) \\$${BUILD_WORKSPACE_DIRECTORY}/src/rules.md
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(rootpath index.md) \ cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(rootpath index.md) \
| sed "s/{short_commit}/\\$${short_commit}/" \ | sed "s/{short_commit}/\\$${short_commit}/" \

View File

@ -16,3 +16,36 @@ stardoc_repository()
load("//:stardoc_deps.bzl", "stardoc_deps") load("//:stardoc_deps.bzl", "stardoc_deps")
stardoc_deps() stardoc_deps()
# Gazelle dependencies
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_gazelle",
sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
],
)
http_archive(
name = "bazel_skylib_gazelle_plugin",
sha256 = "747addf3f508186234f6232674dd7786743efb8c68619aece5fb0cac97b8f415",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz",
],
)
load("@bazel_skylib_gazelle_plugin//:workspace.bzl", "bazel_skylib_gazelle_plugin_workspace")
bazel_skylib_gazelle_plugin_workspace()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_setup")
bazel_skylib_gazelle_plugin_setup()
gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel")

View File

@ -5,6 +5,7 @@ Rules for building C/C++ projects using foreign build systems (non Bazel) inside
## Versions ## Versions
- [main](main/index.md) - [main](main/index.md)
- [0.10.1](0.10.1/index.md)
- [0.9.0](0.9.0/index.md) - [0.9.0](0.9.0/index.md)
- [0.8.0](0.8.0/index.md) - [0.8.0](0.8.0/index.md)
- [0.7.1](0.7.1/index.md) - [0.7.1](0.7.1/index.md)

View File

@ -16,31 +16,19 @@ bazel_dep(name = "platforms", version = "0.0.6")
bazel_dep(name = "rules_swift", version = "1.6.0", repo_name = "build_bazel_rules_swift") bazel_dep(name = "rules_swift", version = "1.6.0", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_apple", version = "3.0.0-rc1", repo_name = "build_bazel_rules_apple") bazel_dep(name = "rules_apple", version = "3.0.0-rc1", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "apple_support", version = "1.4.1", repo_name = "build_bazel_apple_support") bazel_dep(name = "apple_support", version = "1.4.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_python", version = "0.22.0") bazel_dep(name = "rules_python", version = "0.23.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python") python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain( python.toolchain(
name = "python3_9", configure_coverage_tool = True,
python_version = "3.9", # Only set when you have mulitple toolchain versions.
is_default = True,
python_version = "3.10",
) )
use_repo(python, "python3_9")
use_repo(python, "python3_9_toolchains")
register_toolchains(
"@python3_9_toolchains//:all",
)
interpreter = use_extension("@rules_python//python/extensions:interpreter.bzl", "interpreter")
interpreter.install(
name = "interpreter_python3_9",
python_name = "python3_9",
)
use_repo(interpreter, "interpreter_python3_9")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse( pip.parse(
name = "pip", name = "pip",
python_interpreter_target = "@interpreter_python3_9//:python",
requirements_lock = "//:requirements_lock.txt", requirements_lock = "//:requirements_lock.txt",
requirements_windows = "//:requirements_windows.txt", requirements_windows = "//:requirements_windows.txt",
) )

View File

@ -38,11 +38,11 @@ deps_jvm_external()
load("@rules_python//python:repositories.bzl", "python_register_toolchains") load("@rules_python//python:repositories.bzl", "python_register_toolchains")
python_register_toolchains( python_register_toolchains(
name = "python3_9", name = "python3_10",
python_version = "3.9", python_version = "3.10",
) )
load("@python3_9//:defs.bzl", py3_interpreter = "interpreter") load("@python3_10//:defs.bzl", py3_interpreter = "interpreter")
load("@rules_python//python:pip.bzl", "pip_parse") load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse( pip_parse(

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with Python 3.9 # This file is autogenerated by pip-compile with Python 3.10
# by the following command: # by the following command:
# #
# bazel run //:requirements.update # bazel run //:requirements.update

View File

@ -6,15 +6,130 @@ exports_files(
) )
bzl_library( bzl_library(
name = "bzl_srcs", name = "boost_build",
srcs = glob(["**/*.bzl"]), srcs = ["boost_build.bzl"],
visibility = ["//:__subpackages__"], visibility = ["//visibility:public"],
deps = [ deps = [
"//foreign_cc/built_tools:bzl_srcs", "//foreign_cc/private:detect_root",
"//foreign_cc/private:bzl_srcs", "//foreign_cc/private:framework",
"@bazel_skylib//lib:collections",
"@bazel_skylib//lib:paths",
"@bazel_skylib//lib:versions",
"@rules_python//docs:defs",
], ],
) )
bzl_library(
name = "cmake",
srcs = ["cmake.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/private:cc_toolchain_util",
"//foreign_cc/private:cmake_script",
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//foreign_cc/private:transitions",
"//foreign_cc/private/framework:platform",
"//toolchains/native_tools:tool_access",
],
)
bzl_library(
name = "configure",
srcs = ["configure.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/private:cc_toolchain_util",
"//foreign_cc/private:configure_script",
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//foreign_cc/private:transitions",
"//toolchains/native_tools:tool_access",
],
)
bzl_library(
name = "defs",
srcs = ["defs.bzl"],
visibility = ["//visibility:public"],
deps = [
":boost_build",
":cmake",
":configure",
":make",
":meson",
":ninja",
":utils",
],
)
bzl_library(
name = "extensions",
srcs = ["extensions.bzl"],
visibility = ["//visibility:public"],
deps = [
":repositories",
"//toolchains:prebuilt_toolchains",
],
)
bzl_library(
name = "make",
srcs = ["make.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/private:cc_toolchain_util",
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//foreign_cc/private:make_script",
"//foreign_cc/private:transitions",
"//toolchains/native_tools:tool_access",
],
)
bzl_library(
name = "meson",
srcs = ["meson.bzl"],
visibility = ["//visibility:public"],
deps = [
":utils",
"//foreign_cc/built_tools:meson_build",
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//foreign_cc/private:make_script",
"//foreign_cc/private:transitions",
"//toolchains/native_tools:native_tools_toolchain",
"//toolchains/native_tools:tool_access",
],
)
bzl_library(
name = "ninja",
srcs = ["ninja.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//toolchains/native_tools:tool_access",
],
)
bzl_library(
name = "repositories",
srcs = ["repositories.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/private/framework:toolchain",
"//toolchains",
"@bazel_tools//tools/build_defs/repo:http.bzl",
"@bazel_tools//tools/build_defs/repo:utils.bzl",
],
)
bzl_library(
name = "providers",
srcs = ["providers.bzl"],
visibility = ["//visibility:public"],
)
bzl_library(
name = "utils",
srcs = ["utils.bzl"],
visibility = ["//visibility:public"],
)

View File

@ -1,10 +1,48 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
bzl_library( bzl_library(
name = "bzl_srcs", name = "cmake_build",
srcs = glob(["**/*.bzl"]), srcs = ["cmake_build.bzl"],
visibility = ["//:__subpackages__"], visibility = ["//visibility:public"],
deps = ["//foreign_cc:defs"],
)
bzl_library(
name = "make_build",
srcs = ["make_build.bzl"],
visibility = ["//visibility:public"],
deps = [ deps = [
"//foreign_cc/built_tools/private:bzl_srcs", "//foreign_cc/built_tools/private:built_tools_framework",
"//foreign_cc/private:cc_toolchain_util",
"//foreign_cc/private/framework:platform",
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
],
)
bzl_library(
name = "meson_build",
srcs = ["meson_build.bzl"],
visibility = ["//visibility:public"],
deps = ["@rules_python//python:defs_bzl"],
)
bzl_library(
name = "ninja_build",
srcs = ["ninja_build.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc/built_tools/private:built_tools_framework",
"//foreign_cc/private/framework:platform",
],
)
bzl_library(
name = "pkgconfig_build",
srcs = ["pkgconfig_build.bzl"],
visibility = ["//visibility:public"],
deps = [
"//foreign_cc:defs",
"//foreign_cc/built_tools/private:built_tools_framework",
"//toolchains/native_tools:tool_access",
], ],
) )

View File

@ -1,7 +1,14 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
bzl_library( bzl_library(
name = "bzl_srcs", name = "built_tools_framework",
srcs = glob(["**/*.bzl"]), srcs = ["built_tools_framework.bzl"],
visibility = ["//:__subpackages__"], visibility = ["//foreign_cc/built_tools:__subpackages__"],
deps = [
"//foreign_cc/private:cc_toolchain_util",
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//foreign_cc/private/framework:helpers",
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
],
) )

View File

@ -5,10 +5,84 @@ exports_files([
]) ])
bzl_library( bzl_library(
name = "bzl_srcs", name = "cc_toolchain_util",
srcs = glob(["**/*.bzl"]), srcs = ["cc_toolchain_util.bzl"],
visibility = ["//:__subpackages__"], visibility = ["//foreign_cc:__subpackages__"],
deps = [ deps = [
"//foreign_cc/private/framework:bzl_srcs", "@bazel_skylib//lib:collections",
"@bazel_tools//tools/build_defs/cc:action_names.bzl",
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
], ],
) )
bzl_library(
name = "cmake_script",
srcs = ["cmake_script.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [":cc_toolchain_util"],
)
bzl_library(
name = "configure_script",
srcs = ["configure_script.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [
":make_env_vars",
":make_script",
],
)
bzl_library(
name = "framework",
srcs = ["framework.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [
":cc_toolchain_util",
":detect_root",
":run_shell_file_utils",
"//foreign_cc:providers",
"//foreign_cc/private/framework:helpers",
"@bazel_skylib//lib:collections",
"@bazel_skylib//lib:paths",
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
],
)
bzl_library(
name = "make_env_vars",
srcs = ["make_env_vars.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [
":cc_toolchain_util",
":framework",
],
)
bzl_library(
name = "make_script",
srcs = ["make_script.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [":make_env_vars"],
)
bzl_library(
name = "transitions",
srcs = ["transitions.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = ["//foreign_cc:providers"],
)
bzl_library(
name = "detect_root",
srcs = ["detect_root.bzl"],
visibility = [
"//foreign_cc:__subpackages__",
"//test:__subpackages__",
],
)
bzl_library(
name = "run_shell_file_utils",
srcs = ["run_shell_file_utils.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
)

View File

@ -6,11 +6,30 @@ toolchain_type(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
framework_platform_info()
bzl_library( bzl_library(
name = "bzl_srcs", name = "helpers",
srcs = glob(["**/*.bzl"]), srcs = ["helpers.bzl"],
visibility = ["//:__subpackages__"], visibility = [
deps = ["//foreign_cc/private/framework/toolchains:bzl_srcs"], "//foreign_cc:__subpackages__",
"//test:__subpackages__",
],
deps = [
"//foreign_cc/private/framework/toolchains:access",
"//foreign_cc/private/framework/toolchains:commands",
],
) )
framework_platform_info() bzl_library(
name = "toolchain",
srcs = ["toolchain.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = ["//foreign_cc/private/framework/toolchains:mappings"],
)
bzl_library(
name = "platform",
srcs = ["platform.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
)

View File

@ -1,7 +1,48 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
bzl_library( bzl_library(
name = "bzl_srcs", name = "access",
srcs = glob(["**/*.bzl"]), srcs = ["access.bzl"],
visibility = ["//:__subpackages__"], visibility = ["//foreign_cc:__subpackages__"],
deps = [":commands"],
)
bzl_library(
name = "freebsd_commands",
srcs = ["freebsd_commands.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [":commands"],
)
bzl_library(
name = "linux_commands",
srcs = ["linux_commands.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [":commands"],
)
bzl_library(
name = "macos_commands",
srcs = ["macos_commands.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [":commands"],
)
bzl_library(
name = "windows_commands",
srcs = ["windows_commands.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = [":commands"],
)
bzl_library(
name = "commands",
srcs = ["commands.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
)
bzl_library(
name = "mappings",
srcs = ["mappings.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
) )

View File

@ -1,3 +1,4 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test") load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load(":cmake_text_tests.bzl", "cmake_script_test_suite") load(":cmake_text_tests.bzl", "cmake_script_test_suite")
load(":convert_shell_script_test.bzl", "shell_script_conversion_suite") load(":convert_shell_script_test.bzl", "shell_script_conversion_suite")
@ -71,3 +72,20 @@ diff_test(
}), }),
file2 = ":symlink_dirs", file2 = ":symlink_dirs",
) )
bzl_library(
name = "shell_script_helper_test_rule",
srcs = ["shell_script_helper_test_rule.bzl"],
visibility = ["//visibility:public"],
deps = ["//foreign_cc/private/framework:helpers"],
)
bzl_library(
name = "symlink_contents_to_dir_test_rule",
srcs = ["symlink_contents_to_dir_test_rule.bzl"],
visibility = ["//visibility:public"],
deps = [
"@rules_foreign_cc//foreign_cc/private:detect_root",
"@rules_foreign_cc//foreign_cc/private/framework:helpers",
],
)

View File

@ -334,10 +334,40 @@ native_tool_toolchain(
) )
bzl_library( bzl_library(
name = "bzl_srcs", name = "built_toolchains",
srcs = glob(["**/*.bzl"]), srcs = ["built_toolchains.bzl"],
visibility = ["//:__subpackages__"],
deps = [ deps = [
"//toolchains/native_tools:bzl_srcs", "@bazel_tools//tools/build_defs/repo:http.bzl",
"@bazel_tools//tools/build_defs/repo:utils.bzl",
"@rules_foreign_cc//toolchains:cmake_versions",
], ],
) )
bzl_library(
name = "prebuilt_toolchains",
srcs = ["prebuilt_toolchains.bzl"],
deps = [
"@bazel_tools//tools/build_defs/repo:http.bzl",
"@bazel_tools//tools/build_defs/repo:utils.bzl",
"@rules_foreign_cc//toolchains:prebuilt_toolchains_repository",
],
)
bzl_library(
name = "toolchains",
srcs = ["toolchains.bzl"],
deps = [
":built_toolchains",
":prebuilt_toolchains",
],
)
bzl_library(
name = "cmake_versions",
srcs = ["cmake_versions.bzl"],
)
bzl_library(
name = "prebuilt_toolchains_repository",
srcs = ["prebuilt_toolchains_repository.bzl"],
)

View File

@ -1,7 +1,13 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
bzl_library( bzl_library(
name = "bzl_srcs", name = "native_tools_toolchain",
srcs = glob(["**/*.bzl"]), srcs = ["native_tools_toolchain.bzl"],
visibility = ["//visibility:public"],
)
bzl_library(
name = "tool_access",
srcs = ["tool_access.bzl"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )