Skip to content

Commit

Permalink
Ensure the bootstrap repos are configured
Browse files Browse the repository at this point in the history
  • Loading branch information
restingbull committed Dec 8, 2023
1 parent e6444aa commit c3928ac
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
26 changes: 24 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ bazel_dep(
name = "platforms",
version = "0.0.6",
)

bazel_dep(
name = "bazel_skylib",
version = "1.4.2",
)

bazel_dep(
name = "rules_java",
version = "6.4.0",
)

bazel_dep(
name = "rules_python",
version = "0.23.1",
)

bazel_dep(
name = "rules_cc",
version = "0.0.8",
Expand All @@ -29,24 +33,38 @@ rules_kotlin_extensions = use_extension(
"//src/main/starlark/core/repositories:bzlmod_setup.bzl",
"rules_kotlin_extensions",
)

use_repo(
rules_kotlin_extensions,
"buildkite_config",
"com_github_google_ksp",
"com_github_jetbrains_kotlin",
"com_github_pinterest_ktlint",
"kt_java_stub_template",
"released_rules_kotlin",
"rules_android",
)

# Register toolchain for bootstrapping the current rules.
# Once the released rules_koltin is defined, configure it.
rules_kotlin_bootstrap_extensions = use_extension(
"//src/main/starlark/core/repositories:bzlmod_bootstrap.bzl",
"rules_kotlin_bootstrap_extensions",
)

use_repo(
rules_kotlin_bootstrap_extensions,
"released_com_github_jetbrains_kotlin",
"released_com_github_google_ksp",
"kt_java_stub_template",
)

register_toolchains("@released_rules_kotlin//kotlin/internal:default_toolchain")

# Back to the regularly scheduled configuration.
register_toolchains("//kotlin/internal:default_toolchain")

# TODO(bencodes) We should be able to remove this once rules_android has rolled out official Bzlmod support
remote_android_extensions = use_extension("@bazel_tools//tools/android:android_extensions.bzl", "remote_android_tools_extensions")

use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

# Development dependencies
Expand All @@ -62,6 +80,7 @@ maven = use_extension(
"@rules_jvm_external//:extensions.bzl",
"maven",
)

maven.install(
name = "kotlin_rules_maven",
artifacts = [
Expand Down Expand Up @@ -91,17 +110,20 @@ maven.install(
"https://repo1.maven.org/maven2",
],
)

use_repo(maven, "kotlin_rules_maven")

bazel_dep(
name = "rules_pkg",
version = "0.7.0",
)

bazel_dep(
name = "stardoc",
version = "0.5.6",
repo_name = "io_bazel_stardoc",
)

bazel_dep(
name = "rules_proto",
version = "5.3.0-21.7",
Expand Down
13 changes: 13 additions & 0 deletions src/main/starlark/core/repositories/bzlmod_bootstrap.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@released_rules_kotlin//src/main/starlark/core/repositories:initialize.bzl", "kotlin_repositories")

def _rules_kotlin_bootstrap_extensions_impl(mctx):
kotlin_repositories(
is_bzlmod = True,
compiler_repository_name = "released_com_github_jetbrains_kotlin",
ksp_repository_name = "released_com_github_google_ksp",
)

rules_kotlin_bootstrap_extensions = module_extension(
implementation = _rules_kotlin_bootstrap_extensions_impl,
tag_classes = {},
)

0 comments on commit c3928ac

Please sign in to comment.