Skip to content

Commit

Permalink
Fix stardoc breakage in bazel @ HEAD (#1190)
Browse files Browse the repository at this point in the history
bazel @ head has an added dependency @rule_java_builtin java_common that is not satisfiable via import the built-in bazel srcs.

Fixing this requires:
* Bump `rules_java` version to one with the toolchain_utils
* Import toolchain_utils from rules_java, not `bazeltools`

Still a potential problem in third_party, as it will pick up toolchain_utils from `bazel_tools` -- unfortunately, the `filegroup` that won't pull in the toolchain_utils is private. :/
  • Loading branch information
restingbull authored Jul 5, 2024
1 parent 289e716 commit 4062c35
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
validate_config: 1
bazel: 7.1.1
bazel: 880c17c67a9b4e17e9753a5c6e2a759bff5a2cfe
buildifier:
version: 7.1.1
# no lint warnings for the moment. They are basically a smoke alarm in hell.
Expand Down
1 change: 1 addition & 0 deletions kotlin/internal/jvm/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ bzl_library(
deps = [
"//third_party:bzl",
"@bazel_skylib//rules:common_settings",
"@rules_java//java:rules",
],
)
16 changes: 11 additions & 5 deletions kotlin/internal/jvm/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load(
"@bazel_tools//tools/jdk:toolchain_utils.bzl",
"find_java_runtime_toolchain",
"find_java_toolchain",
)
load(
"@rules_java//java:defs.bzl",
"JavaInfo",
"java_common",
)
load(
"//kotlin/internal:defs.bzl",
_JAVA_RUNTIME_TOOLCHAIN_TYPE = "JAVA_RUNTIME_TOOLCHAIN_TYPE",
_JAVA_TOOLCHAIN_TYPE = "JAVA_TOOLCHAIN_TYPE",
_KtCompilerPluginInfo = "KtCompilerPluginInfo",
_KtJvmInfo = "KtJvmInfo",
_KtPluginConfiguration = "KtPluginConfiguration",
Expand Down Expand Up @@ -54,6 +51,15 @@ load(
)

# UTILITY ##############################################################################################################
def find_java_toolchain(ctx, target):
if _JAVA_TOOLCHAIN_TYPE in ctx.toolchains:
return ctx.toolchains[_JAVA_TOOLCHAIN_TYPE].java
return target[java_common.JavaToolchainInfo]

def find_java_runtime_toolchain(ctx, target):
if _JAVA_RUNTIME_TOOLCHAIN_TYPE in ctx.toolchains:
return ctx.toolchains[_JAVA_RUNTIME_TOOLCHAIN_TYPE].java_runtime
return target[java_common.JavaRuntimeInfo]

def _java_info(target):
return target[JavaInfo] if JavaInfo in target else None
Expand Down

0 comments on commit 4062c35

Please sign in to comment.