Repository navigation
Closed
Labels
P3We're not considering working on this, but happy to review a PR. (No assignee)
Description
Issue: Change where bazelrcs are read from, and make it easier to control which ones are read.
Gerrit: 16.04, macOS
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /var/lib/buildkite-agent/builds/buildkite-worker-ubuntu1604-java8-ggpl-1/bazel-downstream-projects/gerrit/tools/bazel.rc
rules_jsonnet:
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /Users/buildkite/builds/buildkite-imacpro-2-1/bazel-downstream-projects/rules_jsonnet/tools/bazel.rc
rules_go:
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /Users/buildkite/builds/buildkite-imacpro-10-1/bazel-downstream-projects/rules_go/tools/bazel.rc
rules_typescript:
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /var/lib/buildkite-agent/builds/buildkite-worker-ubuntu1604-java8-mhj7-1/bazel-downstream-projects/rules_typescript/tools/bazel.rc
rules_nodejs:
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /Users/buildkite/builds/buildkite-imacpro-2-1/bazel-downstream-projects/rules_nodejs/tools/bazel.rc
rules_sass:
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /Users/buildkite/builds/buildkite-imacpro-9-1/bazel-downstream-projects/rules_sass/tools/bazel.rc
rules_scala:
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /Users/buildkite/builds/buildkite-imacpro-6-1/bazel-downstream-projects/rules_scala/tools/bazel.rc
BUILD_file_generator
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
| /Users/buildkite/builds/buildkite-imacpro-2-1/bazel-downstream-projects/BUILD_file_generator/tools/bazel.rc
Activity
cvcal commentedon Aug 3, 2018
These breakages are intentional, and (as I argued in issue #4502) unavoidable. The change at fault is this: ec83598cb6ee4136166bb562a24dc5dfa58921dbT
Copying over the relevant description from the root cause commit:
This means that the following rc's will be ignored from now on:
The intent is to simplify the list of rc files, and remove the "master" vs "user" grouping that had been confusing. The home and workspace rc are no longer dependent on the --bazelrc flag being present, there are no longer 2 workspace rcs (one gated by --nomaster_bazelrc and one by the presence of an explicit --bazelrc). The binary location was useless to most people, and was legacy from the way that Google's repo is set up, so is excised outright,
cvcal commentedon Aug 3, 2018
This is a breaking change, there's no good way to avoid it, unfortunately.
--home_rc, etc) so layering another startup option on top of this is bad.Instead, this avoids the duality, but has a very easy workaround, which allows simultaneous support of 2 bazel versions. A warning will let you know if any old rc files are not being read, and you can import them to avoid the confusion:
import %workspace%/tools/bazel.rc%binary_dir%/bazel.bazelrcfile.You can also do this in reverse, migrate the contents of the old files, and have them simply "import" the new ones as needed, but this is a bit more brittle, since you might double-import some files, what with the weird legacy userc behavior. Also, in this order, the warning will continue to be printed, since the old rc files still exist, even if they just contain an import statement - this isn't bad, but log spam annoys certain people.
This way, old Bazels will load the old files, and new ones will get the same flags through the new locations. You can stop doing this once you stop supporting versions of Bazel that expect the old locations.
Note that the flag
--[no]master_bazelrcis still accepted - it will be taken into account when creating the warning telling you which old files would have been loaded, but does NOT affect the new files in anyway.cvcal commentedon Aug 3, 2018
A final piece of advice: If you want additional insight into what Bazel is doing, where it's looking for files, and which files it has found, use the client option
--client_debug(bazel --client_debug build): it will give you the full list of potential files (on the log line "Looking for the following rc files:") that it's looking for, and, for each file that it finds and parses, it will also log that.Another useful option to help debug this sort of thing is
--announce_rc, (this is a server option, so it goes after the command,bazel build --announce_rc), and will list all options that are loaded from rc files, along with where they came from. These are output in order that they are parsed by Bazel, which helps find conflicts.Create .bazelrc
Create .bazelrc
Create .bazelrc
Create .bazelrc
Create .bazelrc
Create .bazelrc
Create .bazelrc
davido commentedon Aug 3, 2018
Fix CL for Gerrit: [1].
[1] https://gerrit-review.googlesource.com/c/gerrit/+/191562
Create .bazelrc (#1626)
6 remaining items
davido commentedon Aug 8, 2018
Mentioned gerrit CL was merged, but only on stable-2.14 branch. We still need to merge that change up to master.
Create .bazelrc (#65)
Migrate `tools/bazel.rc` to `.bazelrc`
Merge branch 'master' into feature/check (#1679)
Import tools/bazel.rc in Bazel 0.18's workspace-rc.
amlinux commentedon Nov 20, 2018
I was hit by
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc fileserror message, and it was quite unhelpful. I spent a lot of time trying to find where the standard rc files were supposed to be.Could you please update the message to something referencing the list of standard paths or at least with a link to the doc?
meisterT commentedon May 12, 2020
I assume this is no longer relevant.
Import tools/bazel.rc in Bazel 0.18's workspace-rc.
Import tools/bazel.rc in Bazel 0.18's workspace-rc.