Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce "ignore_recursive" directive. #1566

Open
felberj opened this issue Jun 30, 2023 · 1 comment · May be fixed by #1573
Open

Introduce "ignore_recursive" directive. #1566

felberj opened this issue Jun 30, 2023 · 1 comment · May be fixed by #1573

Comments

@felberj
Copy link

felberj commented Jun 30, 2023

What version of gazelle are you using?

built from head

What version of rules_go are you using?

n/a

What version of Bazel are you using?

 % bazel version
Build label: 6.2.0-homebrew
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jan 1 00:00:00 1980 (315532800)
Build timestamp: 315532800
Build timestamp as int: 315532800

Does this issue reproduce with the latest releases of all the above?

yes

What operating system and processor architecture are you using?

macOS 13.3.1 (22E261), arm

What did you do?

I am experimenting with a C++ gazelle extension. I am working on resolving to external repositories:

# WORKSPACE
http_archive(
  name = "com_google_absl",
  urls = ["https://github.com/abseil/abseil-cpp/archive/e85868cbef04e8e8ff518e09b6af3970bbe5d2eb.zip"],
  strip_prefix = "abseil-cpp-e85868cbef04e8e8ff518e09b6af3970bbe5d2eb",
)

Gazelle finds this under the external/com_google_absl directory. I rewrite all Imports under the external directory similar to this logic

//external/bar/foo:test -> @bar//foo:test

The problem is, that gazelle reformats all the build files in that directory, and this breaks bazel (because the external files are supposed to be "readonly"). We cant use gazelle:ignore directive, because we dont "control" the build files that are not properly formatted.

So my idea was to introduce a directive that allows to ignore a subtree of directories: In the root BUILD file, you could add this to not format files under external or other directories.

example usage

# BUILD
# gazelle:ignore_recursive external

Will not update anything under external but still process them.

I am happy to try to contribute a feature like this.

@felberj felberj linked a pull request Jul 5, 2023 that will close this issue
@dkrieger
Copy link

@felberj any out-of-band discussions w/ maintainers on this? was looking for this feature and surprised to see it didn't already exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants