Repository: kythe/kythe (language: rust)

Issue:
Flag --incompatible_config_setting_private_default_visibility will break Kythe in Bazel 7.0
Incompatible flag `--incompatible_config_setting_private_default_visibility` will be enabled by default in the next major release (Bazel 7.0), thus breaking Kythe. Please migrate to fix this and unblock the flip of this flag.

The flag is documented here: https://github.com/bazelbuild/bazel/issues/12933.

Please check the following CI builds for build and test results:

- [Ubuntu 20.04 LTS (OpenJDK 11, gcc 9.4.0)](https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/1341#0184a207-ed79-470d-aadc-b579189ab285)

Never heard of incompatible flags before? We have [documentation](https://docs.bazel.build/versions/master/backward-compatibility.html) that explains everything.
If you have any questions, please file an issue in https://github.com/bazelbuild/continuous-integration.


Discussion / hints:
It looks like this is a problem with the Go rules:
```
(01:15:45) ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/226b49198bc606791e41a1a39aa77815/external/io_bazel_rules_go/BUILD.bazel:106:10: in go_config rule @io_bazel_rules_go//:go_config: target '@io_bazel_rules_go//go/private:stamp' is not visible from target '@io_bazel_rules_go//:go_config'. Check the visibility declaration of the former target if you think the dependency is legitimate
```
I can't reproduce this with just the flag, does it require a version of Bazel newer than 5.3.2?
Ah, nevermind, needed --incompatible_enforce_config_setting_visibility as well.

Fix patch:
diff --git a/.bazelrc b/.bazelrc
index e78fb01db1..827524e22e 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -6,6 +6,7 @@ build --strategy=TypeScriptCompile=sandboxed,local
 
 # Compatibility flags to avoid regressions.
 common --incompatible_disallow_empty_glob
+build --incompatible_config_setting_private_default_visibility  --incompatible_enforce_config_setting_visibility
 
 build --workspace_status_command tools/buildstamp/get_workspace_status
 
diff --git a/buildenv/java/BUILD b/buildenv/java/BUILD
index c6f39b542a..bb1a1d326e 100644
--- a/buildenv/java/BUILD
+++ b/buildenv/java/BUILD
@@ -5,6 +5,8 @@ load(
     "default_java_toolchain",
 )
 
+package(default_visibility = ["//visibility:public"])
+
 # Bazel does not yet ship with a JDK-19 compatible JDK, so
 # fetch and install our own.
 default_java_toolchain(
diff --git a/setup.bzl b/setup.bzl
index 3c8a3f08d8..8f68dc1bf0 100644
--- a/setup.bzl
+++ b/setup.bzl
@@ -42,10 +42,10 @@ def kythe_rule_repositories():
     maybe(
         http_archive,
         name = "io_bazel_rules_go",
-        sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
+        sha256 = "ae013bf35bd23234d1dea46b079f1e05ba74ac0321423830119d3e787ec73483",
         urls = [
-            "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
-            "https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
+            "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.36.0/rules_go-v0.36.0.zip",
+            "https://github.com/bazelbuild/rules_go/releases/download/v0.36.0/rules_go-v0.36.0.zip",
         ],
     )
 
@@ -79,10 +79,10 @@ def kythe_rule_repositories():
     maybe(
         http_archive,
         name = "bazel_gazelle",
-        sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
+        sha256 = "448e37e0dbf61d6fa8f00aaa12d191745e14f07c31cabfa731f0c8e8a4f41b97",
         urls = [
-            "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
-            "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
+            "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.28.0/bazel-gazelle-v0.28.0.tar.gz",
+            "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.28.0/bazel-gazelle-v0.28.0.tar.gz",
         ],
     )
 


Test patch: