|
| 1 | +commit 6c0a2c8eb9f0bc522787c4bfaa5794ad0e3bdb07 |
| 2 | +Author: Yun Peng < [email protected]> |
| 3 | +Date: Wed Oct 6 18:09:19 2021 +0200 |
| 4 | + |
| 5 | + Modularize rules_cc |
| 6 | + |
| 7 | +diff --git a/MODULE.bazel b/MODULE.bazel |
| 8 | +new file mode 100644 |
| 9 | +index 0000000..be5b13d |
| 10 | +--- /dev/null |
| 11 | ++++ b/MODULE.bazel |
| 12 | +@@ -0,0 +1,12 @@ |
| 13 | ++module( |
| 14 | ++ name = "rules_cc", |
| 15 | ++ version = "0.0.1", |
| 16 | ++ compatibility_level = 1, |
| 17 | ++ toolchains_to_register = ["@local_config_cc_toolchains//:all"], |
| 18 | ++) |
| 19 | ++ |
| 20 | ++bazel_dep(name = "bazel_skylib", version = "1.0.3") |
| 21 | ++bazel_dep(name = "platforms", version = "0.0.4") |
| 22 | ++ |
| 23 | ++cc_configure = use_extension("@rules_cc//bzlmod:extensions.bzl", "cc_configure") |
| 24 | ++use_repo(cc_configure, "local_config_cc_toolchains") |
| 25 | +diff --git a/bzlmod/BUILD b/bzlmod/BUILD |
| 26 | +new file mode 100644 |
| 27 | +index 0000000..8b13789 |
| 28 | +--- /dev/null |
| 29 | ++++ b/bzlmod/BUILD |
| 30 | +@@ -0,0 +1 @@ |
| 31 | ++ |
| 32 | +diff --git a/bzlmod/extensions.bzl b/bzlmod/extensions.bzl |
| 33 | +new file mode 100644 |
| 34 | +index 0000000..3fdbe87 |
| 35 | +--- /dev/null |
| 36 | ++++ b/bzlmod/extensions.bzl |
| 37 | +@@ -0,0 +1,22 @@ |
| 38 | ++# Copyright 2018 The Bazel Authors. All rights reserved. |
| 39 | ++# |
| 40 | ++# Licensed under the Apache License, Version 2.0 (the "License"); |
| 41 | ++# you may not use this file except in compliance with the License. |
| 42 | ++# You may obtain a copy of the License at |
| 43 | ++# |
| 44 | ++# http://www.apache.org/licenses/LICENSE-2.0 |
| 45 | ++# |
| 46 | ++# Unless required by applicable law or agreed to in writing, software |
| 47 | ++# distributed under the License is distributed on an "AS IS" BASIS, |
| 48 | ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 49 | ++# See the License for the specific language governing permissions and |
| 50 | ++# limitations under the License. |
| 51 | ++"""Module extension for cc auto configuration.""" |
| 52 | ++ |
| 53 | ++load("//cc/private/toolchain:cc_configure.bzl", "cc_autoconf_toolchains", "cc_autoconf") |
| 54 | ++ |
| 55 | ++def _cc_configure_impl(ctx): |
| 56 | ++ cc_autoconf_toolchains(name = "local_config_cc_toolchains") |
| 57 | ++ cc_autoconf(name = "local_config_cc") |
| 58 | ++ |
| 59 | ++cc_configure = module_extension(implementation = _cc_configure_impl) |
0 commit comments