Allow 'includes = ["."]' in the root of the repo Copybara Import from https://github.com/bazelbuild/rules_cc/pull/625 BEGIN_PUBLIC Allow 'includes = ["."]' in the root of the repo (#625) This isn't really something you want to do in a large project, but this is a very common requirement of open source libraries that are part of the BCR. Today they are buildable when pulled in through bzlmod, but not when you're testing changes to them directly. Bazel already adds an `-iquote .` to the root of the repo for all builds, so if something is in your dependency tree, you can include it relatively with the path from the root. If you want to guard against that you can use layering_check to make sure deps are explicitly defined. Fixes https://github.com/bazelbuild/rules_cc/issues/453 Closes #625 END_PUBLIC COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/625 from keith:ks/allow-includes-.-in-the-root-of-the-repo b8d3bf3bcfb725068efb51a4841f355e83347f8e PiperOrigin-RevId: 959633803 Change-Id: Iedd96ea9a3d484ba712db03edb7a9cd3228706b2
diff --git a/cc/common/cc_helper.bzl b/cc/common/cc_helper.bzl index d3ceedb..501ba24 100644 --- a/cc/common/cc_helper.bzl +++ b/cc/common/cc_helper.bzl
@@ -866,10 +866,6 @@ if not sibling_repository_layout and path_contains_up_level_references(includes_path): fail("Path references a path above the execution root.", attr = "includes") - if includes_path == ".": - fail("'" + includes_attr + "' resolves to the workspace root, which would allow this rule and all of its " + - "transitive dependents to include any file in your workspace. Please include only" + - " what you need", attr = "includes") result.append(includes_path) # We don't need to perform the above checks against out_includes_path again since any errors