bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
764 stars 304 forks source link

doc: Make it clearer what should be gitignored #3250

Open dfabulich opened 2 years ago

dfabulich commented 2 years ago

https://ij.bazel.build/docs/project-views.html

Source control

*.bazelproject files can be checked into source control. By convention, they live next to the BUILD file people import. While many teams name the file simply .bazelproject, we recommend adding a prefix like myteam.bazelproject since Piper treats dotfiles differently (most importantly, it won’t automatically add them to your CLs).

If your project has multiple different views, you may check in multiple files with the .bazelproject extension into the same directory. The user can choose to import any one of these.

The documentation should make it clarify whether the .ijwb directory should be checked in.

(I believe it shouldn't? But it can be, and if you do, you should copy https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore and commit it as .ijwb/.gitignore …?)

beala-stripe commented 2 years ago

I found some guidance in this blog post: https://blog.bazel.build/2019/09/29/intellij-bazel-sync.html#portability-of-the-ijwb-directory

Portability of the .ijwb directory

The .ijwb directory is not completely portable. Files like .bazelproject and codeStyleConfig.xml can be shared project-wide, but workspace.xml and .workspace.iml should be user-specific.

In general, extract .bazelproject file out of .ijwb/ to version control it, and follow JetBrains' recommendations on checking in specific files in the .idea directory.

tpasternak commented 1 year ago

@mai93 @blorente I don't have an opinion on it, but intuitively I'd be rather against it. Should we recommend users to check in anything in .ijwb directory?

blorente commented 1 year ago

I think the project view files are designed to encapsulate everything you'd need from the .ijwb directory. In particular, run configurations are shareable.

It feels like the .ijwb directory contains state that is already either in the Bazel graph, or the project view itself. I'd be more in favour of allowlisting what to save via the project view, because that way multiple projects can coexist in the same repo with just one file for each.

tpasternak commented 1 year ago

Ok, so we should recommend to add .ijwb to .gitignore. Honestly I don't know how to edit ij.bazel.build page cc @mai93