From 12e6f03e70e9ad15bc3a1714c0838b41a1e10d77 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Fri, 8 Sep 2023 16:10:41 -0700 Subject: [PATCH 01/27] Init --- .bazelci/presubmit.yml | 15 +++++ .bazelrc | 2 + MODULE.bazel | 61 +++++++++++++++++ WORKSPACE.bzlmod | 0 examples/trivial/MODULE.bazel | 34 ++++++++++ examples/trivial/WORKSPACE.bzlmod | 0 .../core/repositories/bzlmod_setup.bzl | 66 +++++++++++++++++++ 7 files changed, 178 insertions(+) create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bzlmod create mode 100644 examples/trivial/MODULE.bazel create mode 100644 examples/trivial/WORKSPACE.bzlmod create mode 100644 src/main/starlark/core/repositories/bzlmod_setup.bzl diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 446efb6b4..1c1dccd43 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -8,6 +8,21 @@ buildifier: warnings: "-confusing-name,-constant-glob,-duplicated-name,-function-docstring,-function-docstring-args,-function-docstring-header,-module-docstring,-name-conventions,-no-effect,-constant-glob,-provider-params,-print,-rule-impl-return,-bzl-visibility,-unnamed-macro,-uninitialized,-unreachable" tasks: ubuntu1804: + build_flags: + - "--enable_bzlmod=false" + test_targets: + - "//:all_tests" + build_targets: + - "//:rules_kotlin_release" + macos: + test_flags: + - "--enable_bzlmod=false" + test_targets: + - "//:all_tests" + ubuntu2004_bzlmod: + platform: ubuntu2004 + build_flags: + - "--enable_bzlmod" test_targets: - "//:all_tests" build_targets: diff --git a/.bazelrc b/.bazelrc index 6858b6449..c1d9ef968 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,5 @@ +common --enable_bzlmod=true + build --strategy=KotlinCompile=worker build --test_output=all build --verbose_failures diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..5a6a0385b --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,61 @@ +module( + name = "rules_kotlin", + version = "1.8.0", + compatibility_level = 1, + repo_name = "io_bazel_rules_kotlin", +) + +bazel_dep(name = "platforms", version = "0.0.6") +bazel_dep(name = "bazel_skylib", version = "1.3.0") +bazel_dep(name = "rules_java", version = "6.4.0") +bazel_dep(name = "rules_android", version = "0.1.1", repo_name = "build_bazel_rules_android") +bazel_dep(name = "rules_python", version = "0.24.0") + +kt = use_extension("//src/main/starlark/core/repositories:bzlmod_setup.bzl", "kt_bzlmod_ext") +use_repo(kt, "com_github_google_ksp", "com_github_jetbrains_kotlin", "com_github_pinterest_ktlint", "kt_java_stub_template", "buildkite_config") + +register_toolchains("//kotlin/internal:default_toolchain") + +# Development depenencies + +bazel_dep(name = "rules_jvm_external", version = "4.4.2") + +maven = use_extension( + "@rules_jvm_external//:extensions.bzl", + "maven", + dev_dependency = True, +) +maven.install( + name = "kotlin_rules_maven", + artifacts = [ + "com.google.code.findbugs:jsr305:3.0.2", + "junit:junit:4.13-beta-3", + "com.google.protobuf:protobuf-java:3.6.0", + "com.google.protobuf:protobuf-java-util:3.6.0", + "com.google.guava:guava:27.1-jre", + "com.google.truth:truth:0.45", + "com.google.auto.service:auto-service:1.0-rc5", + "com.google.auto.service:auto-service-annotations:1.0-rc5", + "com.google.auto.value:auto-value:1.6.5", + "com.google.auto.value:auto-value-annotations:1.6.5", + "com.google.dagger:dagger:2.43.2", + "com.google.dagger:dagger-compiler:2.43.2", + "com.google.dagger:dagger-producers:2.43.2", + "javax.annotation:javax.annotation-api:1.3.2", + "javax.inject:javax.inject:1", + "org.pantsbuild:jarjar:1.7.2", + "org.jetbrains.kotlinx:atomicfu-js:0.15.2", + "org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc", + ], + fetch_sources = True, + repositories = [ + "https://maven-central.storage.googleapis.com/repos/central/data/", + "https://maven.google.com", + "https://repo1.maven.org/maven2", + ], +) +use_repo(maven, "kotlin_rules_maven") + +bazel_dep(name = "rules_pkg", version = "0.7.0", dev_dependency = True) +bazel_dep(name = "stardoc", version = "0.5.3", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "rules_proto", version = "5.3.0-21.7", dev_dependency = True) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 000000000..e69de29bb diff --git a/examples/trivial/MODULE.bazel b/examples/trivial/MODULE.bazel new file mode 100644 index 000000000..d746f1032 --- /dev/null +++ b/examples/trivial/MODULE.bazel @@ -0,0 +1,34 @@ +module( + name = "trival-example", +) + +bazel_dep(name = "rules_java", version = "6.4.0") +bazel_dep(name = "rules_kotlin", repo_name = "io_bazel_rules_kotlin") +archive_override( + module_name = "rules_kotlin", + urls = ["file:../../bazel-bin/rules_kotlin_release.tgz"], +) +#local_path_override(module_name = "rules_kotlin", path = "../..") + +bazel_dep(name = "rules_jvm_external", version = "4.4.2") + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +maven.install( + artifacts = [ + "com.expedia:graphql-kotlin:1.0.0-RC5", + "com.expedia:graphql-kotlin-schema-generator:1.0.0-RC5", + "com.expedia:graphql-kotlin-federation:1.0.0-RC5", + "com.graphql-java:graphql-java:13.0", + "org.opentest4j:opentest4j:1.1.1", + "org.apiguardian:apiguardian-api:1.0.0", + "org.junit.platform:junit-platform-commons:1.4.2", + "org.junit.jupiter:junit-jupiter-api:5.4.2", + "org.junit.jupiter:junit-jupiter-params:5.4.2", + "org.apache.logging.log4j:log4j-core:2.16.0", + ], + repositories = [ + "https://maven-central.storage.googleapis.com/repos/central/data/", + "https://repo1.maven.org/maven2", + ], +) +use_repo(maven, "maven") diff --git a/examples/trivial/WORKSPACE.bzlmod b/examples/trivial/WORKSPACE.bzlmod new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/starlark/core/repositories/bzlmod_setup.bzl b/src/main/starlark/core/repositories/bzlmod_setup.bzl new file mode 100644 index 000000000..2b8902f80 --- /dev/null +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -0,0 +1,66 @@ +# Copyright 2022 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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(":compiler.bzl", "kotlin_compiler_repository") +load(":ksp.bzl", "ksp_compiler_plugin_repository") +load(":versions.bzl", "versions") +load("//kotlin/internal:defs.bzl", _KSP_COMPILER_PLUGIN_REPO = "KSP_COMPILER_PLUGIN_REPO", _KT_COMPILER_REPO = "KT_COMPILER_REPO") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") + +def _kt_configure_impl(_module_ctx): + # TODO: release compiler repository on bazel-central-registry and remove it from here + compiler_repository_name = _KT_COMPILER_REPO + compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE + kotlin_compiler_repository( + name = compiler_repository_name, + urls = [url.format(version = compiler_release.version) for url in compiler_release.url_templates], + sha256 = compiler_release.sha256, + compiler_version = compiler_release.version, + ) + + ksp_repository_name = _KSP_COMPILER_PLUGIN_REPO + ksp_compiler_release = versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE + ksp_compiler_plugin_repository( + name = ksp_repository_name, + urls = [url.format(version = ksp_compiler_release.version) for url in ksp_compiler_release.url_templates], + sha256 = ksp_compiler_release.sha256, + strip_version = ksp_compiler_release.version, + ) + + http_file( + name = "kt_java_stub_template", + urls = [("https://raw.githubusercontent.com/bazelbuild/bazel/" + + versions.BAZEL_JAVA_LAUNCHER_VERSION + + "/src/main/java/com/google/devtools/build/lib/bazel/rules/java/" + + "java_stub_template.txt")], + sha256 = "ab1370fd990a8bff61a83c7bd94746a3401a6d5d2299e54b1b6bc02db4f87f68", + ) + + http_file( + name = "com_github_pinterest_ktlint", + sha256 = versions.PINTEREST_KTLINT.sha256, + urls = [url.format(version = versions.PINTEREST_KTLINT.version) for url in versions.PINTEREST_KTLINT.url_templates], + executable = True, + ) + + # This tarball intentionally does not have a SHA256 because the upstream URL can change without notice + # For more context: https://github.com/bazelbuild/bazel-toolchains/blob/0c1f7c3c5f9e63f1e0ee91738b964937eea2d3e0/WORKSPACE#L28-L32 + http_file( + name = "buildkite_config", + urls = versions.RBE.URLS, + ) + +kt_bzlmod_ext = module_extension( + implementation = _kt_configure_impl, +) From 02ad06e7ca16f661c29d6cde69429a073b805ac4 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Fri, 8 Sep 2023 16:30:41 -0700 Subject: [PATCH 02/27] More bzlmod --- MODULE.bazel | 44 +++--- examples/trivial/MODULE.bazel | 8 +- .../core/repositories/bzlmod_setup.bzl | 129 ++++++++++-------- .../starlark/core/repositories/initialize.bzl | 7 +- .../core/repositories/initialize.release.bzl | 6 +- .../starlark/core/repositories/versions.bzl | 3 +- 6 files changed, 114 insertions(+), 83 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 5a6a0385b..6921e3243 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,6 @@ module( - name = "rules_kotlin", - version = "1.8.0", + name = "io_bazel_rules_kotlin", + version = "1.8.1", compatibility_level = 1, repo_name = "io_bazel_rules_kotlin", ) @@ -11,20 +11,28 @@ bazel_dep(name = "rules_java", version = "6.4.0") bazel_dep(name = "rules_android", version = "0.1.1", repo_name = "build_bazel_rules_android") bazel_dep(name = "rules_python", version = "0.24.0") -kt = use_extension("//src/main/starlark/core/repositories:bzlmod_setup.bzl", "kt_bzlmod_ext") -use_repo(kt, "com_github_google_ksp", "com_github_jetbrains_kotlin", "com_github_pinterest_ktlint", "kt_java_stub_template", "buildkite_config") +rules_kotlin_extensions = use_extension("//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions") +rules_kotlin_extensions.kotlinc_version( + version = "1.8.21", + url_templates = [ + "https://github.com/JetBrains/kotlin/releases/download/v{version}/kotlin-compiler-{version}.zip", + ], + sha256 = "6e43c5569ad067492d04d92c28cdf8095673699d81ce460bd7270443297e8fd7", +) +use_repo( + rules_kotlin_extensions, + "com_github_google_ksp", + "com_github_jetbrains_kotlin", + "com_github_pinterest_ktlint", + "kt_java_stub_template", +) register_toolchains("//kotlin/internal:default_toolchain") # Development depenencies bazel_dep(name = "rules_jvm_external", version = "4.4.2") - -maven = use_extension( - "@rules_jvm_external//:extensions.bzl", - "maven", - dev_dependency = True, -) +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") maven.install( name = "kotlin_rules_maven", artifacts = [ @@ -34,10 +42,10 @@ maven.install( "com.google.protobuf:protobuf-java-util:3.6.0", "com.google.guava:guava:27.1-jre", "com.google.truth:truth:0.45", - "com.google.auto.service:auto-service:1.0-rc5", - "com.google.auto.service:auto-service-annotations:1.0-rc5", - "com.google.auto.value:auto-value:1.6.5", - "com.google.auto.value:auto-value-annotations:1.6.5", + "com.google.auto.service:auto-service:1.0.1", + "com.google.auto.service:auto-service-annotations:1.0.1", + "com.google.auto.value:auto-value:1.10.1", + "com.google.auto.value:auto-value-annotations:1.10.1", "com.google.dagger:dagger:2.43.2", "com.google.dagger:dagger-compiler:2.43.2", "com.google.dagger:dagger-producers:2.43.2", @@ -56,6 +64,8 @@ maven.install( ) use_repo(maven, "kotlin_rules_maven") -bazel_dep(name = "rules_pkg", version = "0.7.0", dev_dependency = True) -bazel_dep(name = "stardoc", version = "0.5.3", dev_dependency = True, repo_name = "io_bazel_stardoc") -bazel_dep(name = "rules_proto", version = "5.3.0-21.7", dev_dependency = True) +bazel_dep(name = "rules_pkg", version = "0.7.0") +bazel_dep(name = "stardoc", version = "0.5.3", repo_name = "io_bazel_stardoc") +bazel_dep(name = "rules_proto", version = "5.3.0-21.7") + +register_toolchains("@io_bazel_rules_kotlin//kotlin/internal:default_toolchain") diff --git a/examples/trivial/MODULE.bazel b/examples/trivial/MODULE.bazel index d746f1032..849400c29 100644 --- a/examples/trivial/MODULE.bazel +++ b/examples/trivial/MODULE.bazel @@ -3,12 +3,8 @@ module( ) bazel_dep(name = "rules_java", version = "6.4.0") -bazel_dep(name = "rules_kotlin", repo_name = "io_bazel_rules_kotlin") -archive_override( - module_name = "rules_kotlin", - urls = ["file:../../bazel-bin/rules_kotlin_release.tgz"], -) -#local_path_override(module_name = "rules_kotlin", path = "../..") +bazel_dep(name = "io_bazel_rules_kotlin") +local_path_override(module_name = "io_bazel_rules_kotlin", path = "../..") bazel_dep(name = "rules_jvm_external", version = "4.4.2") diff --git a/src/main/starlark/core/repositories/bzlmod_setup.bzl b/src/main/starlark/core/repositories/bzlmod_setup.bzl index 2b8902f80..c0730d908 100644 --- a/src/main/starlark/core/repositories/bzlmod_setup.bzl +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -1,66 +1,81 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. +"""Definitions for bzlmod module extensions.""" -load(":compiler.bzl", "kotlin_compiler_repository") -load(":ksp.bzl", "ksp_compiler_plugin_repository") -load(":versions.bzl", "versions") -load("//kotlin/internal:defs.bzl", _KSP_COMPILER_PLUGIN_REPO = "KSP_COMPILER_PLUGIN_REPO", _KT_COMPILER_REPO = "KT_COMPILER_REPO") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") +load( + "//src/main/starlark/core/repositories:initialize.bzl", + _kotlin_repositories = "kotlin_repositories", + _kotlinc_version_impl = "kotlinc_version", + _ksp_version_impl = "ksp_version", +) -def _kt_configure_impl(_module_ctx): - # TODO: release compiler repository on bazel-central-registry and remove it from here - compiler_repository_name = _KT_COMPILER_REPO - compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE - kotlin_compiler_repository( - name = compiler_repository_name, - urls = [url.format(version = compiler_release.version) for url in compiler_release.url_templates], - sha256 = compiler_release.sha256, - compiler_version = compiler_release.version, - ) +_kotlinc_version = tag_class( + attrs = { + "version": attr.string( + mandatory = True, + default = "1.8.21", + ), + "url_templates": attr.string_list( + mandatory = True, + default = [ + "https://github.com/JetBrains/kotlin/releases/download/v{version}/kotlin-compiler-{version}.zip", + ], + ), + "sha256": attr.string( + mandatory = True, + default = "6e43c5569ad067492d04d92c28cdf8095673699d81ce460bd7270443297e8fd7", + ), + }, +) - ksp_repository_name = _KSP_COMPILER_PLUGIN_REPO - ksp_compiler_release = versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE - ksp_compiler_plugin_repository( - name = ksp_repository_name, - urls = [url.format(version = ksp_compiler_release.version) for url in ksp_compiler_release.url_templates], - sha256 = ksp_compiler_release.sha256, - strip_version = ksp_compiler_release.version, - ) +_ksp_version = tag_class( + attrs = { + "version": attr.string( + mandatory = True, + default = "1.8.21-1.0.11", + ), + "url_templates": attr.string_list( + mandatory = True, + default = [ + "https://github.com/google/ksp/releases/download/{version}/artifacts.zip", + ], + ), + "sha256": attr.string( + mandatory = True, + default = "81a609b48fddd4431bac2abe3570e36f79b1266672be30b581a0595c3fb2e615", + ), + }, +) - http_file( - name = "kt_java_stub_template", - urls = [("https://raw.githubusercontent.com/bazelbuild/bazel/" + - versions.BAZEL_JAVA_LAUNCHER_VERSION + - "/src/main/java/com/google/devtools/build/lib/bazel/rules/java/" + - "java_stub_template.txt")], - sha256 = "ab1370fd990a8bff61a83c7bd94746a3401a6d5d2299e54b1b6bc02db4f87f68", - ) +def _rules_kotlin_extensions_impl(mctx): + kotlinc_version = {} + ksp_version = {} + for mod in mctx.modules: + for override in mod.tags.kotlinc_version: + if kotlinc_version: + fail("Nope!") + kotlinc_version["version"] = override.version + kotlinc_version["url_templates"] = override.url_templates + kotlinc_version["sha256"] = override.sha256 + for override in mod.tags.ksp_version: + if ksp_version: + fail("Nope!") + ksp_version["version"] = override.version + ksp_version["url_templates"] = override.url_templates + ksp_version["sha256"] = override.sha256 - http_file( - name = "com_github_pinterest_ktlint", - sha256 = versions.PINTEREST_KTLINT.sha256, - urls = [url.format(version = versions.PINTEREST_KTLINT.version) for url in versions.PINTEREST_KTLINT.url_templates], - executable = True, + _kotlin_repositories( + bzlmod = True, + compiler_release = _kotlinc_version_impl( + release = kotlinc_version["version"], + sha256 = kotlinc_version["sha256"], + ), ) - # This tarball intentionally does not have a SHA256 because the upstream URL can change without notice - # For more context: https://github.com/bazelbuild/bazel-toolchains/blob/0c1f7c3c5f9e63f1e0ee91738b964937eea2d3e0/WORKSPACE#L28-L32 - http_file( - name = "buildkite_config", - urls = versions.RBE.URLS, - ) + pass -kt_bzlmod_ext = module_extension( - implementation = _kt_configure_impl, +rules_kotlin_extensions = module_extension( + implementation = _rules_kotlin_extensions_impl, + tag_classes = { + "kotlinc_version": _kotlinc_version, + "ksp_version": _ksp_version, + }, ) diff --git a/src/main/starlark/core/repositories/initialize.bzl b/src/main/starlark/core/repositories/initialize.bzl index 902d6004e..fb5de9912 100644 --- a/src/main/starlark/core/repositories/initialize.bzl +++ b/src/main/starlark/core/repositories/initialize.bzl @@ -29,6 +29,7 @@ kotlinc_version = _kotlinc_version ksp_version = _ksp_version def kotlin_repositories( + bzlmod = False, compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE, ksp_compiler_release = versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE): """Call this in the WORKSPACE file to setup the Kotlin rules. @@ -37,5 +38,9 @@ def kotlin_repositories( compiler_release: (internal) version provider from versions.bzl. ksp_compiler_release: (internal) version provider from versions.bzl. """ - _release_kotlin_repositories(compiler_release = compiler_release, ksp_compiler_release = ksp_compiler_release) + _release_kotlin_repositories(bzlmod = bzlmod, compiler_release = compiler_release, ksp_compiler_release = ksp_compiler_release) + + # When Bzlmod is enabled skip over the toolchain setup entirely + if bzlmod: + return kt_configure() diff --git a/src/main/starlark/core/repositories/initialize.release.bzl b/src/main/starlark/core/repositories/initialize.release.bzl index d32caccc4..7f3036a42 100644 --- a/src/main/starlark/core/repositories/initialize.release.bzl +++ b/src/main/starlark/core/repositories/initialize.release.bzl @@ -34,6 +34,7 @@ versions = _versions RULES_KOTLIN = Label("//:all") def kotlin_repositories( + bzlmod = False, compiler_repository_name = _KT_COMPILER_REPO, ksp_repository_name = _KSP_COMPILER_PLUGIN_REPO, compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE, @@ -68,7 +69,7 @@ def kotlin_repositories( versions.BAZEL_JAVA_LAUNCHER_VERSION + "/src/main/java/com/google/devtools/build/lib/bazel/rules/java/" + "java_stub_template.txt")], - sha256 = "78e29525872594ffc783c825f428b3e61d4f3e632f46eaa64f004b2814c4a612", + sha256 = versions.BAZEL_JAVA_LAUNCHER_SHA, ) maybe( @@ -79,6 +80,9 @@ def kotlin_repositories( executable = True, ) + if bzlmod: + return + maybe( http_archive, name = "build_bazel_rules_android", diff --git a/src/main/starlark/core/repositories/versions.bzl b/src/main/starlark/core/repositories/versions.bzl index 809854ef0..998a8b30e 100644 --- a/src/main/starlark/core/repositories/versions.bzl +++ b/src/main/starlark/core/repositories/versions.bzl @@ -53,7 +53,8 @@ versions = struct( "https://github.com/bazelbuild/stardoc/releases/download/{version}/stardoc-{version}.tar.gz", ], ), - BAZEL_JAVA_LAUNCHER_VERSION = "6.2.1", + BAZEL_JAVA_LAUNCHER_VERSION = "6.3.2", + BAZEL_JAVA_LAUNCHER_SHA = "78e29525872594ffc783c825f428b3e61d4f3e632f46eaa64f004b2814c4a612", PINTEREST_KTLINT = version( version = "0.49.1", url_templates = [ From d6e5d19c681b8e3477fe6e112a03187357cc71b1 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 19:29:00 -0700 Subject: [PATCH 03/27] Add rules_android --- MODULE.bazel | 2 +- examples/trivial/MODULE.bazel | 5 +---- .../starlark/core/repositories/bzlmod_setup.bzl | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 6921e3243..09a17c690 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,7 +8,6 @@ module( bazel_dep(name = "platforms", version = "0.0.6") bazel_dep(name = "bazel_skylib", version = "1.3.0") bazel_dep(name = "rules_java", version = "6.4.0") -bazel_dep(name = "rules_android", version = "0.1.1", repo_name = "build_bazel_rules_android") bazel_dep(name = "rules_python", version = "0.24.0") rules_kotlin_extensions = use_extension("//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions") @@ -25,6 +24,7 @@ use_repo( "com_github_jetbrains_kotlin", "com_github_pinterest_ktlint", "kt_java_stub_template", + "build_bazel_rules_android", ) register_toolchains("//kotlin/internal:default_toolchain") diff --git a/examples/trivial/MODULE.bazel b/examples/trivial/MODULE.bazel index 849400c29..e4e3fc5bc 100644 --- a/examples/trivial/MODULE.bazel +++ b/examples/trivial/MODULE.bazel @@ -1,13 +1,10 @@ -module( - name = "trival-example", -) +module(name = "trival-example") bazel_dep(name = "rules_java", version = "6.4.0") bazel_dep(name = "io_bazel_rules_kotlin") local_path_override(module_name = "io_bazel_rules_kotlin", path = "../..") bazel_dep(name = "rules_jvm_external", version = "4.4.2") - maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") maven.install( artifacts = [ diff --git a/src/main/starlark/core/repositories/bzlmod_setup.bzl b/src/main/starlark/core/repositories/bzlmod_setup.bzl index c0730d908..dc2f22c24 100644 --- a/src/main/starlark/core/repositories/bzlmod_setup.bzl +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -1,11 +1,19 @@ """Definitions for bzlmod module extensions.""" +load( + "@bazel_tools//tools/build_defs/repo:http.bzl", + "http_archive", +) load( "//src/main/starlark/core/repositories:initialize.bzl", _kotlin_repositories = "kotlin_repositories", _kotlinc_version_impl = "kotlinc_version", _ksp_version_impl = "ksp_version", ) +load( + "//src/main/starlark/core/repositories:versions.bzl", + _versions = "versions", +) _kotlinc_version = tag_class( attrs = { @@ -70,6 +78,13 @@ def _rules_kotlin_extensions_impl(mctx): ), ) + http_archive( + name = "build_bazel_rules_android", + sha256 = _versions.ANDROID.SHA, + strip_prefix = "rules_android-%s" % _versions.ANDROID.VERSION, + urls = _versions.ANDROID.URLS, + ) + pass rules_kotlin_extensions = module_extension( From 781359ef3effb5d891999a78534f62cefbe32ee3 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 20:35:29 -0700 Subject: [PATCH 04/27] Download buildkite_config --- MODULE.bazel | 1 + src/main/starlark/core/repositories/bzlmod_setup.bzl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/MODULE.bazel b/MODULE.bazel index 09a17c690..df9d1bd80 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -25,6 +25,7 @@ use_repo( "com_github_pinterest_ktlint", "kt_java_stub_template", "build_bazel_rules_android", + "buildkite_config", ) register_toolchains("//kotlin/internal:default_toolchain") diff --git a/src/main/starlark/core/repositories/bzlmod_setup.bzl b/src/main/starlark/core/repositories/bzlmod_setup.bzl index dc2f22c24..241afafe1 100644 --- a/src/main/starlark/core/repositories/bzlmod_setup.bzl +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -85,6 +85,11 @@ def _rules_kotlin_extensions_impl(mctx): urls = _versions.ANDROID.URLS, ) + http_archive( + name = "buildkite_config", + urls = _versions.RBE.URLS, + ) + pass rules_kotlin_extensions = module_extension( From 455015afb9acbc7577383dbb5635c191e9c87dae Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 21:06:43 -0700 Subject: [PATCH 05/27] Update skylib --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index df9d1bd80..9ff173c4b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -66,7 +66,7 @@ maven.install( use_repo(maven, "kotlin_rules_maven") bazel_dep(name = "rules_pkg", version = "0.7.0") -bazel_dep(name = "stardoc", version = "0.5.3", repo_name = "io_bazel_stardoc") +bazel_dep(name = "stardoc", version = "0.5.6", repo_name = "io_bazel_stardoc") bazel_dep(name = "rules_proto", version = "5.3.0-21.7") register_toolchains("@io_bazel_rules_kotlin//kotlin/internal:default_toolchain") From 70cf62c11a79dd491f29b4363bab49c049d5ba5f Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 21:08:42 -0700 Subject: [PATCH 06/27] Fix stardoc --- kotlin/internal/jvm/BUILD | 1 - src/main/starlark/core/repositories/BUILD | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/kotlin/internal/jvm/BUILD b/kotlin/internal/jvm/BUILD index e0a3215af..ea20fb8ef 100644 --- a/kotlin/internal/jvm/BUILD +++ b/kotlin/internal/jvm/BUILD @@ -31,6 +31,5 @@ bzl_library( deps = [ "//third_party:bzl", "@bazel_skylib//rules:common_settings", - "@build_bazel_rules_android//android", ], ) diff --git a/src/main/starlark/core/repositories/BUILD b/src/main/starlark/core/repositories/BUILD index 09d8a2c6f..f0974a6f0 100644 --- a/src/main/starlark/core/repositories/BUILD +++ b/src/main/starlark/core/repositories/BUILD @@ -37,7 +37,6 @@ bzl_library( srcs = glob(["*.bzl"]), visibility = ["//:__subpackages__"], deps = [ - "@rules_proto//proto", - "@rules_proto//proto/private", + "@rules_proto//proto:defs", ], ) From dfb546462b27b9622b1bb81261ef4a0b3ad2c716 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 21:45:43 -0700 Subject: [PATCH 07/27] More testing --- MODULE.bazel | 7 -- .../core/repositories/bzlmod_setup.bzl | 84 +++++++------------ .../core/repositories/initialize.release.bzl | 6 +- 3 files changed, 35 insertions(+), 62 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 9ff173c4b..4e43bbecc 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -11,13 +11,6 @@ bazel_dep(name = "rules_java", version = "6.4.0") bazel_dep(name = "rules_python", version = "0.24.0") rules_kotlin_extensions = use_extension("//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions") -rules_kotlin_extensions.kotlinc_version( - version = "1.8.21", - url_templates = [ - "https://github.com/JetBrains/kotlin/releases/download/v{version}/kotlin-compiler-{version}.zip", - ], - sha256 = "6e43c5569ad067492d04d92c28cdf8095673699d81ce460bd7270443297e8fd7", -) use_repo( rules_kotlin_extensions, "com_github_google_ksp", diff --git a/src/main/starlark/core/repositories/bzlmod_setup.bzl b/src/main/starlark/core/repositories/bzlmod_setup.bzl index 241afafe1..232623582 100644 --- a/src/main/starlark/core/repositories/bzlmod_setup.bzl +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -7,95 +7,75 @@ load( load( "//src/main/starlark/core/repositories:initialize.bzl", _kotlin_repositories = "kotlin_repositories", - _kotlinc_version_impl = "kotlinc_version", - _ksp_version_impl = "ksp_version", + _kotlinc_version = "kotlinc_version", + _ksp_version = "ksp_version", ) load( "//src/main/starlark/core/repositories:versions.bzl", _versions = "versions", ) -_kotlinc_version = tag_class( +_kotlinc_version_tag = tag_class( attrs = { "version": attr.string( mandatory = True, - default = "1.8.21", - ), - "url_templates": attr.string_list( - mandatory = True, - default = [ - "https://github.com/JetBrains/kotlin/releases/download/v{version}/kotlin-compiler-{version}.zip", - ], + default = _versions.KOTLIN_CURRENT_COMPILER_RELEASE.version, ), "sha256": attr.string( mandatory = True, - default = "6e43c5569ad067492d04d92c28cdf8095673699d81ce460bd7270443297e8fd7", + default = _versions.KOTLIN_CURRENT_COMPILER_RELEASE.sha256, ), }, ) -_ksp_version = tag_class( +_ksp_version_tag = tag_class( attrs = { "version": attr.string( mandatory = True, - default = "1.8.21-1.0.11", - ), - "url_templates": attr.string_list( - mandatory = True, - default = [ - "https://github.com/google/ksp/releases/download/{version}/artifacts.zip", - ], + default = _versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE.version, ), "sha256": attr.string( mandatory = True, - default = "81a609b48fddd4431bac2abe3570e36f79b1266672be30b581a0595c3fb2e615", + default = _versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE.sha256, ), }, ) +def _extra_repositories(): + # TODO(bencodes) This really needs to be a development dependency + # This tarball intentionally does not have a SHA256 because the upstream URL can change without notice + # For more context: https://github.com/bazelbuild/bazel-toolchains/blob/0c1f7c3c5f9e63f1e0ee91738b964937eea2d3e0/WORKSPACE#L28-L32 + http_archive( + name = "buildkite_config", + urls = _versions.RBE.URLS, + ) + def _rules_kotlin_extensions_impl(mctx): - kotlinc_version = {} - ksp_version = {} + kotlinc_version = None + ksp_version = None for mod in mctx.modules: for override in mod.tags.kotlinc_version: if kotlinc_version: - fail("Nope!") - kotlinc_version["version"] = override.version - kotlinc_version["url_templates"] = override.url_templates - kotlinc_version["sha256"] = override.sha256 + fail("Only one kotlinc_version is supported right now!") + kotlinc_version = _kotlinc_version(release = override.version, sha256 = override.sha256) for override in mod.tags.ksp_version: if ksp_version: - fail("Nope!") - ksp_version["version"] = override.version - ksp_version["url_templates"] = override.url_templates - ksp_version["sha256"] = override.sha256 + fail("Only one ksp_version is supported right now!") + ksp_version = _ksp_version(release = override.version, sha256 = override.sha256) - _kotlin_repositories( - bzlmod = True, - compiler_release = _kotlinc_version_impl( - release = kotlinc_version["version"], - sha256 = kotlinc_version["sha256"], - ), - ) - - http_archive( - name = "build_bazel_rules_android", - sha256 = _versions.ANDROID.SHA, - strip_prefix = "rules_android-%s" % _versions.ANDROID.VERSION, - urls = _versions.ANDROID.URLS, - ) - - http_archive( - name = "buildkite_config", - urls = _versions.RBE.URLS, - ) + _kotlin_repositories_args = dict(bzlmod = True) + if kotlinc_version: + _kotlin_repositories_args["compiler_release"] = kotlinc_version + if ksp_version: + _kotlin_repositories_args["ksp_compiler_release"] = ksp_version + _kotlin_repositories(**_kotlin_repositories_args) - pass + _extra_repositories() rules_kotlin_extensions = module_extension( implementation = _rules_kotlin_extensions_impl, tag_classes = { - "kotlinc_version": _kotlinc_version, - "ksp_version": _ksp_version, + "kotlinc_version": _kotlinc_version_tag, + "ksp_version": _ksp_version_tag, }, ) diff --git a/src/main/starlark/core/repositories/initialize.release.bzl b/src/main/starlark/core/repositories/initialize.release.bzl index 7f3036a42..5c9ab2456 100644 --- a/src/main/starlark/core/repositories/initialize.release.bzl +++ b/src/main/starlark/core/repositories/initialize.release.bzl @@ -80,9 +80,6 @@ def kotlin_repositories( executable = True, ) - if bzlmod: - return - maybe( http_archive, name = "build_bazel_rules_android", @@ -91,6 +88,9 @@ def kotlin_repositories( urls = versions.ANDROID.URLS, ) + if bzlmod: + return + versions.use_repository( name = "rules_python", rule = http_archive, From ea7ad7d9b424d24d2b1b0cddf47e5b0bb7356d54 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 21:51:24 -0700 Subject: [PATCH 08/27] Update docs --- docs/kotlin.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/kotlin.md b/docs/kotlin.md index 26720f7a1..9762924e6 100755 --- a/docs/kotlin.md +++ b/docs/kotlin.md @@ -529,7 +529,7 @@ This macro registers the kotlin toolchain. ## kotlin_repositories
-kotlin_repositories(compiler_repository_name, ksp_repository_name, compiler_release,
+kotlin_repositories(bzlmod, compiler_repository_name, ksp_repository_name, compiler_release,
                     ksp_compiler_release)
 
@@ -540,6 +540,7 @@ Call this in the WORKSPACE file to setup the Kotlin rules. | Name | Description | Default Value | | :------------- | :------------- | :------------- | +| bzlmod |

-

| False | | compiler_repository_name | for the kotlinc compiler repository. | "com_github_jetbrains_kotlin" | | ksp_repository_name |

-

| "com_github_google_ksp" | | compiler_release | version provider from versions.bzl. | struct() | From 2d07f245316f84393b9ea0b9985ec7f7b1d12fb8 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 21:55:08 -0700 Subject: [PATCH 09/27] Formatting --- MODULE.bazel | 5 +++-- examples/trivial/MODULE.bazel | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 4e43bbecc..38f77c235 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -13,12 +13,12 @@ bazel_dep(name = "rules_python", version = "0.24.0") rules_kotlin_extensions = use_extension("//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions") use_repo( rules_kotlin_extensions, + "build_bazel_rules_android", + "buildkite_config", "com_github_google_ksp", "com_github_jetbrains_kotlin", "com_github_pinterest_ktlint", "kt_java_stub_template", - "build_bazel_rules_android", - "buildkite_config", ) register_toolchains("//kotlin/internal:default_toolchain") @@ -26,6 +26,7 @@ register_toolchains("//kotlin/internal:default_toolchain") # Development depenencies bazel_dep(name = "rules_jvm_external", version = "4.4.2") + maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") maven.install( name = "kotlin_rules_maven", diff --git a/examples/trivial/MODULE.bazel b/examples/trivial/MODULE.bazel index e4e3fc5bc..d2f55a335 100644 --- a/examples/trivial/MODULE.bazel +++ b/examples/trivial/MODULE.bazel @@ -2,9 +2,13 @@ module(name = "trival-example") bazel_dep(name = "rules_java", version = "6.4.0") bazel_dep(name = "io_bazel_rules_kotlin") -local_path_override(module_name = "io_bazel_rules_kotlin", path = "../..") +local_path_override( + module_name = "io_bazel_rules_kotlin", + path = "../..", +) bazel_dep(name = "rules_jvm_external", version = "4.4.2") + maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") maven.install( artifacts = [ From 271f22a874625352838df4f54c17552f026a376b Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:18:28 -0700 Subject: [PATCH 10/27] Testing... --- MODULE.bazel | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 38f77c235..0f0aca23e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -9,6 +9,7 @@ bazel_dep(name = "platforms", version = "0.0.6") bazel_dep(name = "bazel_skylib", version = "1.3.0") bazel_dep(name = "rules_java", version = "6.4.0") bazel_dep(name = "rules_python", version = "0.24.0") +bazel_dep(name = "rules_cc", version = "0.0.8") rules_kotlin_extensions = use_extension("//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions") use_repo( @@ -23,7 +24,7 @@ use_repo( register_toolchains("//kotlin/internal:default_toolchain") -# Development depenencies +# Development dependencies bazel_dep(name = "rules_jvm_external", version = "4.4.2") From 627a52b98e699506a51b685e709bf2f33528b15e Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:21:11 -0700 Subject: [PATCH 11/27] Presubmit changes --- .bazelci/presubmit.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1c1dccd43..ef849ab8c 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -8,18 +8,13 @@ buildifier: warnings: "-confusing-name,-constant-glob,-duplicated-name,-function-docstring,-function-docstring-args,-function-docstring-header,-module-docstring,-name-conventions,-no-effect,-constant-glob,-provider-params,-print,-rule-impl-return,-bzl-visibility,-unnamed-macro,-uninitialized,-unreachable" tasks: ubuntu1804: - build_flags: + build_flags_workspace: - "--enable_bzlmod=false" test_targets: - "//:all_tests" build_targets: - "//:rules_kotlin_release" - macos: - test_flags: - - "--enable_bzlmod=false" - test_targets: - - "//:all_tests" - ubuntu2004_bzlmod: + ubuntu2004: platform: ubuntu2004 build_flags: - "--enable_bzlmod" From 46fbfa82ed9211dabf26b7226714b823d75f3c05 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:44:16 -0700 Subject: [PATCH 12/27] CI --- .bazelci/presubmit.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index ef849ab8c..17ea76353 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -7,17 +7,16 @@ buildifier: # keep this argument in sync with .pre-commit-config.yaml warnings: "-confusing-name,-constant-glob,-duplicated-name,-function-docstring,-function-docstring-args,-function-docstring-header,-module-docstring,-name-conventions,-no-effect,-constant-glob,-provider-params,-print,-rule-impl-return,-bzl-visibility,-unnamed-macro,-uninitialized,-unreachable" tasks: - ubuntu1804: - build_flags_workspace: + ubuntu1804_without_bzlmod: + build_flags: + - "--enable_bzlmod=false" + test_flags: - "--enable_bzlmod=false" test_targets: - "//:all_tests" build_targets: - "//:rules_kotlin_release" - ubuntu2004: - platform: ubuntu2004 - build_flags: - - "--enable_bzlmod" + ubuntu1804: test_targets: - "//:all_tests" build_targets: From a1669bc7dc2ad9680031cee14e00e435358854a4 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:45:41 -0700 Subject: [PATCH 13/27] CI --- .bazelci/presubmit.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 17ea76353..daab456db 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -16,6 +16,15 @@ tasks: - "//:all_tests" build_targets: - "//:rules_kotlin_release" + macos_without_bzlmod: + build_flags: + - "--enable_bzlmod=false" + test_flags: + - "--enable_bzlmod=false" + test_targets: + - "//:all_tests" + build_targets: + - "//:rules_kotlin_release" ubuntu1804: test_targets: - "//:all_tests" @@ -24,6 +33,8 @@ tasks: macos: test_targets: - "//:all_tests" + build_targets: + - "//:rules_kotlin_release" rbe_ubuntu1604: test_targets: - "--" From 636e03de91cfa65d111f626b3abf2f5e54be8fb9 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:48:26 -0700 Subject: [PATCH 14/27] More ci --- .bazelci/presubmit.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index daab456db..0fe8fa494 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -7,25 +7,26 @@ buildifier: # keep this argument in sync with .pre-commit-config.yaml warnings: "-confusing-name,-constant-glob,-duplicated-name,-function-docstring,-function-docstring-args,-function-docstring-header,-module-docstring,-name-conventions,-no-effect,-constant-glob,-provider-params,-print,-rule-impl-return,-bzl-visibility,-unnamed-macro,-uninitialized,-unreachable" tasks: - ubuntu1804_without_bzlmod: - build_flags: - - "--enable_bzlmod=false" - test_flags: + ubuntu1804: + name: "Tests without Bzlmod (Ubuntu 18.04)" + common_flags: - "--enable_bzlmod=false" test_targets: - "//:all_tests" build_targets: - "//:rules_kotlin_release" - macos_without_bzlmod: - build_flags: - - "--enable_bzlmod=false" - test_flags: + macos: + name: "Tests without Bzlmod (Macos)" + common_flags: - "--enable_bzlmod=false" test_targets: - "//:all_tests" build_targets: - "//:rules_kotlin_release" - ubuntu1804: + ubuntu2004_bzlmod: + platform: ubuntu2004 + build_flags: + - "--enable_bzlmod" test_targets: - "//:all_tests" build_targets: From 49752737f9f9666358858ed732f621673f62bd11 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:49:10 -0700 Subject: [PATCH 15/27] More ci --- .bazelci/presubmit.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 0fe8fa494..332030ff0 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -9,7 +9,9 @@ buildifier: tasks: ubuntu1804: name: "Tests without Bzlmod (Ubuntu 18.04)" - common_flags: + build_flags: + - "--enable_bzlmod=false" + test_flags: - "--enable_bzlmod=false" test_targets: - "//:all_tests" @@ -17,7 +19,9 @@ tasks: - "//:rules_kotlin_release" macos: name: "Tests without Bzlmod (Macos)" - common_flags: + build_flags: + - "--enable_bzlmod=false" + test_flags: - "--enable_bzlmod=false" test_targets: - "//:all_tests" From 721c10649ba12774e6e3ce3a7590cb7eba35ac84 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:50:43 -0700 Subject: [PATCH 16/27] More ci --- .bazelci/presubmit.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 332030ff0..60e0e5aa5 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -17,16 +17,6 @@ tasks: - "//:all_tests" build_targets: - "//:rules_kotlin_release" - macos: - name: "Tests without Bzlmod (Macos)" - build_flags: - - "--enable_bzlmod=false" - test_flags: - - "--enable_bzlmod=false" - test_targets: - - "//:all_tests" - build_targets: - - "//:rules_kotlin_release" ubuntu2004_bzlmod: platform: ubuntu2004 build_flags: From a55ca44d822d9b4f4414c4bb10755a1e815ca156 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:51:57 -0700 Subject: [PATCH 17/27] More ci --- .bazelci/presubmit.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 60e0e5aa5..a76d58216 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -18,9 +18,8 @@ tasks: build_targets: - "//:rules_kotlin_release" ubuntu2004_bzlmod: + name: "Tests (Ubuntu 20.04)" platform: ubuntu2004 - build_flags: - - "--enable_bzlmod" test_targets: - "//:all_tests" build_targets: From 82d139a49a634230c465d06ce81e408dac27bed9 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:54:37 -0700 Subject: [PATCH 18/27] More CI --- .bazelci/presubmit.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index a76d58216..533cfcf13 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -25,6 +25,7 @@ tasks: build_targets: - "//:rules_kotlin_release" macos: + name: "Tests (Latest Macos)" test_targets: - "//:all_tests" build_targets: @@ -82,6 +83,21 @@ tasks: - //... test_targets: - //... + examples-trivial-bzlmod-ubuntu1804: + name: "Example - Trivial Bzlmod (Ubuntu 18.04)" + platform: ubuntu1804 + working_directory: examples/trivial + build_flags: + - "--enable_bzlmod=false" + test_flags: + - "--enable_bzlmod=false" + include_json_profile: + - build + - test + build_targets: + - //... + test_targets: + - //... examples-trivial-windows: name: "Example - Trivial (Windows)" platform: windows From 5b12b2db9ab8f81516bd9f2716a224046a6ee120 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 22:58:18 -0700 Subject: [PATCH 19/27] More CI --- .bazelci/presubmit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 533cfcf13..68ee6f5a6 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -88,9 +88,9 @@ tasks: platform: ubuntu1804 working_directory: examples/trivial build_flags: - - "--enable_bzlmod=false" + - "--enable_bzlmod=true" test_flags: - - "--enable_bzlmod=false" + - "--enable_bzlmod=true" include_json_profile: - build - test From cc2c072db82165e811978f27c394064dbab33a01 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 23:02:13 -0700 Subject: [PATCH 20/27] Rename to is_bzlmod --- src/main/starlark/core/repositories/bzlmod_setup.bzl | 2 +- src/main/starlark/core/repositories/initialize.bzl | 6 +++--- src/main/starlark/core/repositories/initialize.release.bzl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/starlark/core/repositories/bzlmod_setup.bzl b/src/main/starlark/core/repositories/bzlmod_setup.bzl index 232623582..eeecc2ab8 100644 --- a/src/main/starlark/core/repositories/bzlmod_setup.bzl +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -63,7 +63,7 @@ def _rules_kotlin_extensions_impl(mctx): fail("Only one ksp_version is supported right now!") ksp_version = _ksp_version(release = override.version, sha256 = override.sha256) - _kotlin_repositories_args = dict(bzlmod = True) + _kotlin_repositories_args = dict(is_bzlmod = True) if kotlinc_version: _kotlin_repositories_args["compiler_release"] = kotlinc_version if ksp_version: diff --git a/src/main/starlark/core/repositories/initialize.bzl b/src/main/starlark/core/repositories/initialize.bzl index fb5de9912..5e27d33da 100644 --- a/src/main/starlark/core/repositories/initialize.bzl +++ b/src/main/starlark/core/repositories/initialize.bzl @@ -29,7 +29,7 @@ kotlinc_version = _kotlinc_version ksp_version = _ksp_version def kotlin_repositories( - bzlmod = False, + is_bzlmod = False, compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE, ksp_compiler_release = versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE): """Call this in the WORKSPACE file to setup the Kotlin rules. @@ -38,9 +38,9 @@ def kotlin_repositories( compiler_release: (internal) version provider from versions.bzl. ksp_compiler_release: (internal) version provider from versions.bzl. """ - _release_kotlin_repositories(bzlmod = bzlmod, compiler_release = compiler_release, ksp_compiler_release = ksp_compiler_release) + _release_kotlin_repositories(is_bzlmod = is_bzlmod, compiler_release = compiler_release, ksp_compiler_release = ksp_compiler_release) # When Bzlmod is enabled skip over the toolchain setup entirely - if bzlmod: + if is_bzlmod: return kt_configure() diff --git a/src/main/starlark/core/repositories/initialize.release.bzl b/src/main/starlark/core/repositories/initialize.release.bzl index 5c9ab2456..23ebb49b3 100644 --- a/src/main/starlark/core/repositories/initialize.release.bzl +++ b/src/main/starlark/core/repositories/initialize.release.bzl @@ -34,7 +34,7 @@ versions = _versions RULES_KOTLIN = Label("//:all") def kotlin_repositories( - bzlmod = False, + is_bzlmod = False, compiler_repository_name = _KT_COMPILER_REPO, ksp_repository_name = _KSP_COMPILER_PLUGIN_REPO, compiler_release = versions.KOTLIN_CURRENT_COMPILER_RELEASE, @@ -88,7 +88,7 @@ def kotlin_repositories( urls = versions.ANDROID.URLS, ) - if bzlmod: + if is_bzlmod: return versions.use_repository( From 679d6d26831c60d387ba4bea9dc88a0b28147c63 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Wed, 13 Sep 2023 23:03:37 -0700 Subject: [PATCH 21/27] Docs --- docs/kotlin.md | 4 +-- .../core/repositories/bzlmod_setup.bzl | 29 ++++--------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/docs/kotlin.md b/docs/kotlin.md index 9762924e6..d424975ca 100755 --- a/docs/kotlin.md +++ b/docs/kotlin.md @@ -529,7 +529,7 @@ This macro registers the kotlin toolchain. ## kotlin_repositories
-kotlin_repositories(bzlmod, compiler_repository_name, ksp_repository_name, compiler_release,
+kotlin_repositories(is_bzlmod, compiler_repository_name, ksp_repository_name, compiler_release,
                     ksp_compiler_release)
 
@@ -540,7 +540,7 @@ Call this in the WORKSPACE file to setup the Kotlin rules. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| bzlmod |

-

| False | +| is_bzlmod |

-

| False | | compiler_repository_name | for the kotlinc compiler repository. | "com_github_jetbrains_kotlin" | | ksp_repository_name |

-

| "com_github_google_ksp" | | compiler_release | version provider from versions.bzl. | struct() | diff --git a/src/main/starlark/core/repositories/bzlmod_setup.bzl b/src/main/starlark/core/repositories/bzlmod_setup.bzl index eeecc2ab8..6dc0cf38d 100644 --- a/src/main/starlark/core/repositories/bzlmod_setup.bzl +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -15,29 +15,10 @@ load( _versions = "versions", ) -_kotlinc_version_tag = tag_class( +_version_tag = tag_class( attrs = { - "version": attr.string( - mandatory = True, - default = _versions.KOTLIN_CURRENT_COMPILER_RELEASE.version, - ), - "sha256": attr.string( - mandatory = True, - default = _versions.KOTLIN_CURRENT_COMPILER_RELEASE.sha256, - ), - }, -) - -_ksp_version_tag = tag_class( - attrs = { - "version": attr.string( - mandatory = True, - default = _versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE.version, - ), - "sha256": attr.string( - mandatory = True, - default = _versions.KSP_CURRENT_COMPILER_PLUGIN_RELEASE.sha256, - ), + "version": attr.string(mandatory = True), + "sha256": attr.string(mandatory = True), }, ) @@ -75,7 +56,7 @@ def _rules_kotlin_extensions_impl(mctx): rules_kotlin_extensions = module_extension( implementation = _rules_kotlin_extensions_impl, tag_classes = { - "kotlinc_version": _kotlinc_version_tag, - "ksp_version": _ksp_version_tag, + "kotlinc_version": _version_tag, + "ksp_version": _version_tag, }, ) From 8284083f92dbcb5396bafe7a15f83c6df3a28386 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Thu, 14 Sep 2023 12:46:42 -0700 Subject: [PATCH 22/27] Rename to rules_kotlin --- CONTRIBUTING.md | 2 +- MODULE.bazel | 6 ++--- README.md | 48 +++++++++++++++++----------------- WORKSPACE.dev.bazel | 4 +-- WORKSPACE.release.bazel | 2 +- docs/kotlin.md | 2 +- kotlin/internal/js/js.bzl | 2 +- kotlin/internal/jvm/jvm.bzl | 8 +++--- kotlin/internal/toolchains.bzl | 2 +- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eca086013..4d1edae15 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,7 +54,7 @@ To ease development, pains should be taken to keep the packages in the archive t ### Multi-repo runtime The `rules_kotlin` runtime is comprised of multiple repositories. The end user will interact with a single repository, that repository delegates to -versioned feature sub-repositories. Currently, the delegation is managed by using well known names (e.g. core lives in `@io_bazel_rules_kotlin_configured`), +versioned feature sub-repositories. Currently, the delegation is managed by using well known names (e.g. core lives in `@rules_kotlin_configured`), a necessity while the initial repository can be named arbitrarily. Future development intends to remove this restriction. ### Versioning diff --git a/MODULE.bazel b/MODULE.bazel index 0f0aca23e..e1c1948eb 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,8 +1,8 @@ module( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", version = "1.8.1", compatibility_level = 1, - repo_name = "io_bazel_rules_kotlin", + repo_name = "rules_kotlin", ) bazel_dep(name = "platforms", version = "0.0.6") @@ -64,4 +64,4 @@ 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") -register_toolchains("@io_bazel_rules_kotlin//kotlin/internal:default_toolchain") +register_toolchains("@rules_kotlin//kotlin/internal:default_toolchain") diff --git a/README.md b/README.md index b9cce1123..635ebf21f 100644 --- a/README.md +++ b/README.md @@ -59,15 +59,15 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") rules_kotlin_version = "1.8" rules_kotlin_sha = "01293740a16e474669aba5b5a1fe3d368de5832442f164e4fbfc566815a8bc3a" http_archive( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v%s/rules_kotlin_release.tgz" % rules_kotlin_version], sha256 = rules_kotlin_sha, ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") kotlin_repositories() # if you want the default. Otherwise see custom kotlinc distribution below -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() # to use the default toolchain, otherwise see toolchains below ``` @@ -76,7 +76,7 @@ kt_register_toolchains() # to use the default toolchain, otherwise see toolchain In your project's `BUILD` files, load the Kotlin rules and use them like so: ```python -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "package_name", @@ -93,7 +93,7 @@ To enable a custom toolchain (to configure language level, etc.) do the following. In a `/BUILD.bazel` file define the following: ```python -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain") +load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain") define_kt_toolchain( name = "kotlin_toolchain", @@ -115,7 +115,7 @@ To choose a different `kotlinc` distribution (1.3 and 1.4 variants supported), d in your `WORKSPACE` file (or import from a `.bzl` file: ```python -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version") kotlin_repositories( compiler_release = kotlinc_version( @@ -141,19 +141,19 @@ In the project's `WORKSPACE`, change the setup: # Use local check-out of repo rules (or a commit-archive from github via http_archive or git_repository) local_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", path = "../path/to/rules_kotlin_clone/", ) -load("@io_bazel_rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies") +load("@rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies") kt_download_local_dev_dependencies() -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() ``` @@ -164,16 +164,16 @@ rules to this: ```python # Download master or specific revisions http_archive( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", strip_prefix = "rules_kotlin-master", urls = ["https://github.com/bazelbuild/rules_kotlin/archive/refs/heads/master.zip"], ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") kotlin_repositories() -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() ``` @@ -185,10 +185,10 @@ To attach debugger and step through native action code when using local checkout 1. Open `rules_kotlin` project in Android Studio, using existing `.bazelproject` file as project view. 2. In terminal, build the kotlin target you want to debug, using the subcommand option, ex: `bazel build //lib/mylib:main_kt -s`. You can also use `bazel aquery` to get this info. 3. Locate the subcommand for the kotlin action you want to debug, let's say `KotlinCompile`. Note: If you don't see it, target rebuild may have been skipped (in this case `touch` one of the source .kt file to trigger rebuild). -4. Export `REPOSITORY_NAME` as specified in action env, ex : `export REPOSITORY_NAME=io_bazel_rules_kotlin` -5. Copy the command line, ex : `bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_kotlin/src/main/kotlin/build '--flagfile=bazel-out/darwin_arm64-fastbuild/bin/lib/mylib/main_kt-kt.jar-0.params'` +4. Export `REPOSITORY_NAME` as specified in action env, ex : `export REPOSITORY_NAME=rules_kotlin` +5. Copy the command line, ex : `bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/rules_kotlin/src/main/kotlin/build '--flagfile=bazel-out/darwin_arm64-fastbuild/bin/lib/mylib/main_kt-kt.jar-0.params'` 6. Change directory into the [execRoot](https://bazel.build/remote/output-directories#layout-diagram), normally `bazel-MYPROJECT`, available via `bazel info | grep execution_root`. -7. Add `--debug=5005` to command line to make the action wait for a debugger to attach, ex: `bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_kotlin/src/main/kotlin/build --debug=5005 '--flagfile=bazel-out/darwin_arm64-fastbuild/bin/lib/mylib/main_kt-kt.jar-0.params'`. Note: if command invokes `java` toolchain directly, use `-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005` instead. +7. Add `--debug=5005` to command line to make the action wait for a debugger to attach, ex: `bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/rules_kotlin/src/main/kotlin/build --debug=5005 '--flagfile=bazel-out/darwin_arm64-fastbuild/bin/lib/mylib/main_kt-kt.jar-0.params'`. Note: if command invokes `java` toolchain directly, use `-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005` instead. 8. You should see in output that action is waiting for debugger. Use a default `Remote JVM Debug` configuration in Android Studio, set breakpoint in kotlin action java/kt code, and attach debugger. Breakpoints should be hit. # Kotlin and Java compiler flags @@ -199,7 +199,7 @@ Note: Not all compiler flags are supported in all language versions. When this h For example you can define global compiler flags by doing: ```python -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options", "kt_javac_options", "define_kt_toolchain") +load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options", "kt_javac_options", "define_kt_toolchain") kt_kotlinc_options( name = "kt_kotlinc_options", @@ -225,8 +225,8 @@ Compiler flags that are passed to the rule definitions will be taken over the to Example: ```python -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options", "kt_javac_options") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options", "kt_javac_options") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_kotlinc_options( name = "kt_kotlinc_options_for_package_name", @@ -270,8 +270,8 @@ A few things to note: ``` ```python -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_ksp_plugin") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_ksp_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_ksp_plugin( name = "moshi-kotlin-codegen", @@ -294,7 +294,7 @@ To choose a different `ksp_version` distribution, do the following in your `WORKSPACE` file (or import from a `.bzl` file): ```python -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "ksp_version") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "ksp_version") kotlin_repositories( ksp_compiler_release = ksp_version( @@ -310,8 +310,8 @@ The `kt_compiler_plugin` rule allows running Kotlin compiler plugins, such as no For example, you can add allopen to your project like this: ```python -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_compiler_plugin( name = "open_for_testing_plugin", diff --git a/WORKSPACE.dev.bazel b/WORKSPACE.dev.bazel index d1cab749d..768b3e4ed 100644 --- a/WORKSPACE.dev.bazel +++ b/WORKSPACE.dev.bazel @@ -11,7 +11,7 @@ # 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. -workspace(name = "io_bazel_rules_kotlin") +workspace(name = "rules_kotlin") load("//src/main/starlark/core/repositories:download.bzl", "kt_download_local_dev_dependencies") @@ -21,4 +21,4 @@ load("//kotlin:repositories.bzl", "kotlin_repositories") kotlin_repositories() -register_toolchains("@io_bazel_rules_kotlin//kotlin/internal:default_toolchain") +register_toolchains("@rules_kotlin//kotlin/internal:default_toolchain") diff --git a/WORKSPACE.release.bazel b/WORKSPACE.release.bazel index 523bdce17..09ff933e1 100644 --- a/WORKSPACE.release.bazel +++ b/WORKSPACE.release.bazel @@ -11,4 +11,4 @@ # 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. -workspace(name = "io_bazel_rules_kotlin") +workspace(name = "rules_kotlin") diff --git a/docs/kotlin.md b/docs/kotlin.md index d424975ca..5eadb3734 100755 --- a/docs/kotlin.md +++ b/docs/kotlin.md @@ -211,7 +211,7 @@ kt_jvm_test(name, Date: Fri, 15 Sep 2023 14:38:26 -0700 Subject: [PATCH 23/27] More renaming --- examples/android/WORKSPACE | 4 ++-- examples/android/bzl/BUILD.bazel | 4 ++-- examples/android/libAndroid/BUILD.bazel | 2 +- examples/android/libKtAndroid/BUILD.bazel | 6 +++--- .../src/test/java/examples/android/lib/BUILD.bazel | 2 +- examples/anvil/BUILD.bazel | 2 +- examples/anvil/WORKSPACE | 4 ++-- .../main/java/com/squareup/anvil/sample/BUILD.bazel | 2 +- .../test/java/com/squareup/anvil/sample/BUILD.bazel | 2 +- examples/anvil/library/BUILD.bazel | 2 +- .../main/java/com/squareup/anvil/sample/BUILD.bazel | 2 +- .../repro/src/main/java/com/repro/lib/BUILD.bazel | 2 +- examples/anvil/scopes/BUILD.bazel | 2 +- .../src/main/java/com/squareup/scopes/BUILD.bazel | 2 +- examples/anvil/third_party/BUILD.bazel | 4 ++-- examples/associates/WORKSPACE | 6 +++--- examples/associates/projects/core/api/BUILD.bazel | 2 +- examples/associates/projects/core/impl/BUILD.bazel | 2 +- examples/dagger/BUILD | 4 ++-- examples/dagger/WORKSPACE | 4 ++-- examples/deps/WORKSPACE | 4 ++-- examples/deps/bzl/BUILD.bazel | 4 ++-- examples/deps/libKt1/BUILD.bazel | 2 +- examples/deps/libKt2/BUILD.bazel | 2 +- examples/deps/libKt3/BUILD.bazel | 2 +- examples/deps/libKt4/BUILD.bazel | 2 +- examples/deps/libKtAndroid1/BUILD.bazel | 2 +- examples/deps/libKtAndroid2/BUILD.bazel | 2 +- examples/deps/libKtAndroid3/BUILD.bazel | 2 +- examples/deps/libKtAndroid4/BUILD.bazel | 2 +- examples/jetpack_compose/BUILD | 2 +- examples/jetpack_compose/WORKSPACE | 4 ++-- examples/jetpack_compose/compose-ui/BUILD | 2 +- examples/ksp/BUILD | 4 ++-- examples/ksp/WORKSPACE | 4 ++-- examples/multiplex/WORKSPACE | 6 +++--- examples/multiplex/src/BUILD.bazel | 2 +- examples/node/BUILD | 2 +- examples/node/WORKSPACE | 6 +++--- examples/node/coroutines-helloworld/BUILD | 2 +- examples/node/express/BUILD | 2 +- examples/node/express/auth/BUILD | 2 +- examples/plugin/WORKSPACE | 6 +++--- examples/plugin/src/allopen/BUILD | 6 +++--- examples/plugin/src/allopennoarg/BUILD | 10 +++++----- examples/plugin/src/noarg/BUILD | 8 ++++---- examples/plugin/src/parcelize/BUILD | 10 +++++----- examples/plugin/src/sam_with_receiver/BUILD | 6 +++--- examples/plugin/src/serialization/BUILD | 6 +++--- examples/trivial/MODULE.bazel | 4 ++-- examples/trivial/WORKSPACE | 6 +++--- examples/trivial/app/BUILD.bazel | 4 ++-- 52 files changed, 94 insertions(+), 94 deletions(-) diff --git a/examples/android/WORKSPACE b/examples/android/WORKSPACE index ab1bc65b9..2067bc9ad 100644 --- a/examples/android/WORKSPACE +++ b/examples/android/WORKSPACE @@ -8,11 +8,11 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", local_path = "../..", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() diff --git a/examples/android/bzl/BUILD.bazel b/examples/android/bzl/BUILD.bazel index 116da98d2..d094d2cb4 100644 --- a/examples/android/bzl/BUILD.bazel +++ b/examples/android/bzl/BUILD.bazel @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_kotlinc_options") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_javac_options") +load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_kotlinc_options") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_javac_options") kt_kotlinc_options( name = "default_kotlinc_options", diff --git a/examples/android/libAndroid/BUILD.bazel b/examples/android/libAndroid/BUILD.bazel index 3369b3289..9578351af 100644 --- a/examples/android/libAndroid/BUILD.bazel +++ b/examples/android/libAndroid/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_android//android:rules.bzl", "android_library") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") android_library( name = "my_android", diff --git a/examples/android/libKtAndroid/BUILD.bazel b/examples/android/libKtAndroid/BUILD.bazel index a75d9a82a..c8f280ae5 100644 --- a/examples/android/libKtAndroid/BUILD.bazel +++ b/examples/android/libKtAndroid/BUILD.bazel @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin", "kt_ksp_plugin") -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin", "kt_ksp_plugin") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") load("@rules_java//java:defs.bzl", "java_plugin") kt_compiler_plugin( @@ -8,7 +8,7 @@ kt_compiler_plugin( id = "org.jetbrains.kotlin.serialization", stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin", + "@rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin", ], ) diff --git a/examples/android/libKtAndroid/src/test/java/examples/android/lib/BUILD.bazel b/examples/android/libKtAndroid/src/test/java/examples/android/lib/BUILD.bazel index 901dcc60b..34848b668 100644 --- a/examples/android/libKtAndroid/src/test/java/examples/android/lib/BUILD.bazel +++ b/examples/android/libKtAndroid/src/test/java/examples/android/lib/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_local_test") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_local_test") kt_android_local_test( name = "SomeTest", diff --git a/examples/anvil/BUILD.bazel b/examples/anvil/BUILD.bazel index 8704bf9c2..45724be70 100644 --- a/examples/anvil/BUILD.bazel +++ b/examples/anvil/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain") +load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain") define_kt_toolchain( name = "kotlin_toolchain", diff --git a/examples/anvil/WORKSPACE b/examples/anvil/WORKSPACE index 1d668ae03..06c445171 100644 --- a/examples/anvil/WORKSPACE +++ b/examples/anvil/WORKSPACE @@ -6,10 +6,10 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() diff --git a/examples/anvil/app/src/main/java/com/squareup/anvil/sample/BUILD.bazel b/examples/anvil/app/src/main/java/com/squareup/anvil/sample/BUILD.bazel index 89a5160bd..96cb90cce 100644 --- a/examples/anvil/app/src/main/java/com/squareup/anvil/sample/BUILD.bazel +++ b/examples/anvil/app/src/main/java/com/squareup/anvil/sample/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") kt_android_library( name = "sample", diff --git a/examples/anvil/app/src/test/java/com/squareup/anvil/sample/BUILD.bazel b/examples/anvil/app/src/test/java/com/squareup/anvil/sample/BUILD.bazel index ca7f2acdd..a139d457a 100644 --- a/examples/anvil/app/src/test/java/com/squareup/anvil/sample/BUILD.bazel +++ b/examples/anvil/app/src/test/java/com/squareup/anvil/sample/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_test") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_test") kt_jvm_test( name = "LoggedInComponentTest", diff --git a/examples/anvil/library/BUILD.bazel b/examples/anvil/library/BUILD.bazel index b869fd731..d4d1ebfa3 100644 --- a/examples/anvil/library/BUILD.bazel +++ b/examples/anvil/library/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "library", diff --git a/examples/anvil/library/src/main/java/com/squareup/anvil/sample/BUILD.bazel b/examples/anvil/library/src/main/java/com/squareup/anvil/sample/BUILD.bazel index 851b94a54..5e7d1d7e2 100644 --- a/examples/anvil/library/src/main/java/com/squareup/anvil/sample/BUILD.bazel +++ b/examples/anvil/library/src/main/java/com/squareup/anvil/sample/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "god", diff --git a/examples/anvil/repro/src/main/java/com/repro/lib/BUILD.bazel b/examples/anvil/repro/src/main/java/com/repro/lib/BUILD.bazel index f7a1c19ad..39fd422dd 100644 --- a/examples/anvil/repro/src/main/java/com/repro/lib/BUILD.bazel +++ b/examples/anvil/repro/src/main/java/com/repro/lib/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "lib", diff --git a/examples/anvil/scopes/BUILD.bazel b/examples/anvil/scopes/BUILD.bazel index 2971f1927..ed749cee1 100644 --- a/examples/anvil/scopes/BUILD.bazel +++ b/examples/anvil/scopes/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "scopes", diff --git a/examples/anvil/scopes/src/main/java/com/squareup/scopes/BUILD.bazel b/examples/anvil/scopes/src/main/java/com/squareup/scopes/BUILD.bazel index 5f057c1ef..39c123af6 100644 --- a/examples/anvil/scopes/src/main/java/com/squareup/scopes/BUILD.bazel +++ b/examples/anvil/scopes/src/main/java/com/squareup/scopes/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "scopes", diff --git a/examples/anvil/third_party/BUILD.bazel b/examples/anvil/third_party/BUILD.bazel index 91c3b1cb3..9fce2ad93 100644 --- a/examples/anvil/third_party/BUILD.bazel +++ b/examples/anvil/third_party/BUILD.bazel @@ -1,6 +1,6 @@ load("@rules_java//java:defs.bzl", "java_library", "java_plugin") -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") java_plugin( name = "dagger_component_plugin", diff --git a/examples/associates/WORKSPACE b/examples/associates/WORKSPACE index 2c83af27f..52cae694d 100644 --- a/examples/associates/WORKSPACE +++ b/examples/associates/WORKSPACE @@ -6,14 +6,14 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() diff --git a/examples/associates/projects/core/api/BUILD.bazel b/examples/associates/projects/core/api/BUILD.bazel index 54b5f68b2..2be19f841 100644 --- a/examples/associates/projects/core/api/BUILD.bazel +++ b/examples/associates/projects/core/api/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library") package(default_visibility = ["//visibility:public"]) diff --git a/examples/associates/projects/core/impl/BUILD.bazel b/examples/associates/projects/core/impl/BUILD.bazel index c1055d289..c5788f021 100644 --- a/examples/associates/projects/core/impl/BUILD.bazel +++ b/examples/associates/projects/core/impl/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library") kt_jvm_library( name = "impl", diff --git a/examples/dagger/BUILD b/examples/dagger/BUILD index e8778db41..6ff82f9c4 100644 --- a/examples/dagger/BUILD +++ b/examples/dagger/BUILD @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. load("@rules_java//java:defs.bzl", "java_binary") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain") package(default_visibility = ["//visibility:private"]) diff --git a/examples/dagger/WORKSPACE b/examples/dagger/WORKSPACE index 9339a888a..213945f5b 100644 --- a/examples/dagger/WORKSPACE +++ b/examples/dagger/WORKSPACE @@ -6,10 +6,10 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() diff --git a/examples/deps/WORKSPACE b/examples/deps/WORKSPACE index 533055d22..e054d9e93 100644 --- a/examples/deps/WORKSPACE +++ b/examples/deps/WORKSPACE @@ -6,11 +6,11 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", local_path = "../..", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() diff --git a/examples/deps/bzl/BUILD.bazel b/examples/deps/bzl/BUILD.bazel index 85129c17d..596d308c3 100644 --- a/examples/deps/bzl/BUILD.bazel +++ b/examples/deps/bzl/BUILD.bazel @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_kotlinc_options") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_javac_options") +load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_kotlinc_options") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_javac_options") kt_kotlinc_options( name = "default_kotlinc_options", diff --git a/examples/deps/libKt1/BUILD.bazel b/examples/deps/libKt1/BUILD.bazel index 076c64db3..23a87a99c 100644 --- a/examples/deps/libKt1/BUILD.bazel +++ b/examples/deps/libKt1/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "src_main", diff --git a/examples/deps/libKt2/BUILD.bazel b/examples/deps/libKt2/BUILD.bazel index 91c604175..74f5a69d3 100644 --- a/examples/deps/libKt2/BUILD.bazel +++ b/examples/deps/libKt2/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "src_main", diff --git a/examples/deps/libKt3/BUILD.bazel b/examples/deps/libKt3/BUILD.bazel index 345af9d52..0b18b8c10 100644 --- a/examples/deps/libKt3/BUILD.bazel +++ b/examples/deps/libKt3/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "src_main", diff --git a/examples/deps/libKt4/BUILD.bazel b/examples/deps/libKt4/BUILD.bazel index cf45e05a7..907eba0db 100644 --- a/examples/deps/libKt4/BUILD.bazel +++ b/examples/deps/libKt4/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "src_main", diff --git a/examples/deps/libKtAndroid1/BUILD.bazel b/examples/deps/libKtAndroid1/BUILD.bazel index dd2f227b5..5cf8402c2 100644 --- a/examples/deps/libKtAndroid1/BUILD.bazel +++ b/examples/deps/libKtAndroid1/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") kt_android_library( name = "src_main", diff --git a/examples/deps/libKtAndroid2/BUILD.bazel b/examples/deps/libKtAndroid2/BUILD.bazel index 35fc25b76..75d43f418 100644 --- a/examples/deps/libKtAndroid2/BUILD.bazel +++ b/examples/deps/libKtAndroid2/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") kt_android_library( name = "src_main", diff --git a/examples/deps/libKtAndroid3/BUILD.bazel b/examples/deps/libKtAndroid3/BUILD.bazel index 8af0e4d8a..4f8550345 100644 --- a/examples/deps/libKtAndroid3/BUILD.bazel +++ b/examples/deps/libKtAndroid3/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") kt_android_library( name = "src_main", diff --git a/examples/deps/libKtAndroid4/BUILD.bazel b/examples/deps/libKtAndroid4/BUILD.bazel index 1db315f17..87351d8ce 100644 --- a/examples/deps/libKtAndroid4/BUILD.bazel +++ b/examples/deps/libKtAndroid4/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") kt_android_library( name = "src_main", diff --git a/examples/jetpack_compose/BUILD b/examples/jetpack_compose/BUILD index 6c832932c..7a44e865d 100644 --- a/examples/jetpack_compose/BUILD +++ b/examples/jetpack_compose/BUILD @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_compiler_plugin") load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain") # Java Toolchain diff --git a/examples/jetpack_compose/WORKSPACE b/examples/jetpack_compose/WORKSPACE index 278c312a2..a131da76d 100644 --- a/examples/jetpack_compose/WORKSPACE +++ b/examples/jetpack_compose/WORKSPACE @@ -18,10 +18,10 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version", "versions") kotlin_repositories( compiler_release = kotlinc_version( diff --git a/examples/jetpack_compose/compose-ui/BUILD b/examples/jetpack_compose/compose-ui/BUILD index cc5b55465..7f65cf209 100644 --- a/examples/jetpack_compose/compose-ui/BUILD +++ b/examples/jetpack_compose/compose-ui/BUILD @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") kt_android_library( name = "lib", diff --git a/examples/ksp/BUILD b/examples/ksp/BUILD index bf340076f..d6c194b32 100644 --- a/examples/ksp/BUILD +++ b/examples/ksp/BUILD @@ -11,10 +11,10 @@ # 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("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_ksp_plugin") +load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_ksp_plugin") load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@rules_java//java:defs.bzl", "java_binary", "java_plugin") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") package(default_visibility = ["//visibility:public"]) diff --git a/examples/ksp/WORKSPACE b/examples/ksp/WORKSPACE index 078721755..662839bba 100644 --- a/examples/ksp/WORKSPACE +++ b/examples/ksp/WORKSPACE @@ -8,10 +8,10 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() diff --git a/examples/multiplex/WORKSPACE b/examples/multiplex/WORKSPACE index 2be85a70c..8e015d524 100644 --- a/examples/multiplex/WORKSPACE +++ b/examples/multiplex/WORKSPACE @@ -8,13 +8,13 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") kotlin_repositories() -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() diff --git a/examples/multiplex/src/BUILD.bazel b/examples/multiplex/src/BUILD.bazel index d0465176d..e72cdd78b 100644 --- a/examples/multiplex/src/BUILD.bazel +++ b/examples/multiplex/src/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_jvm_library( name = "big", diff --git a/examples/node/BUILD b/examples/node/BUILD index 303f76263..3376d0b41 100644 --- a/examples/node/BUILD +++ b/examples/node/BUILD @@ -11,7 +11,7 @@ # 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("@io_bazel_rules_kotlin//kotlin:js.bzl", "kt_js_import") +load("@rules_kotlin//kotlin:js.bzl", "kt_js_import") # Create kt_js_imports for KotlinX's Coroutines and Atomicfu libraries. # diff --git a/examples/node/WORKSPACE b/examples/node/WORKSPACE index 57cc23a99..2bdb326ba 100644 --- a/examples/node/WORKSPACE +++ b/examples/node/WORKSPACE @@ -8,14 +8,14 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() diff --git a/examples/node/coroutines-helloworld/BUILD b/examples/node/coroutines-helloworld/BUILD index 84ce980af..2e1112610 100644 --- a/examples/node/coroutines-helloworld/BUILD +++ b/examples/node/coroutines-helloworld/BUILD @@ -11,7 +11,7 @@ # 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("@io_bazel_rules_kotlin//kotlin:js.bzl", "kt_js_library") +load("@rules_kotlin//kotlin:js.bzl", "kt_js_library") load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") kt_js_library( diff --git a/examples/node/express/BUILD b/examples/node/express/BUILD index 83c156d0a..a8b04efe9 100644 --- a/examples/node/express/BUILD +++ b/examples/node/express/BUILD @@ -11,7 +11,7 @@ # 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("@io_bazel_rules_kotlin//kotlin:js.bzl", "kt_js_library") +load("@rules_kotlin//kotlin:js.bzl", "kt_js_library") load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") # routes and auth have acme prepended to the rule name as these are the names of the resulting jars. The name of the diff --git a/examples/node/express/auth/BUILD b/examples/node/express/auth/BUILD index 430dbe3f2..4c465e3f4 100644 --- a/examples/node/express/auth/BUILD +++ b/examples/node/express/auth/BUILD @@ -11,7 +11,7 @@ # 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("@io_bazel_rules_kotlin//kotlin:js.bzl", "kt_js_library") +load("@rules_kotlin//kotlin:js.bzl", "kt_js_library") kt_js_library( name = "acme-auth", diff --git a/examples/plugin/WORKSPACE b/examples/plugin/WORKSPACE index 8dc608912..88cffbf32 100644 --- a/examples/plugin/WORKSPACE +++ b/examples/plugin/WORKSPACE @@ -6,14 +6,14 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() diff --git a/examples/plugin/src/allopen/BUILD b/examples/plugin/src/allopen/BUILD index df40efe5d..437fa913a 100644 --- a/examples/plugin/src/allopen/BUILD +++ b/examples/plugin/src/allopen/BUILD @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") kt_compiler_plugin( name = "open_for_testing_plugin", @@ -10,7 +10,7 @@ kt_compiler_plugin( }, stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:allopen-compiler-plugin", + "@rules_kotlin//kotlin/compiler:allopen-compiler-plugin", ], ) diff --git a/examples/plugin/src/allopennoarg/BUILD b/examples/plugin/src/allopennoarg/BUILD index 3f89c1ef0..1804f8c10 100644 --- a/examples/plugin/src/allopennoarg/BUILD +++ b/examples/plugin/src/allopennoarg/BUILD @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test") kt_compiler_plugin( name = "open_for_testing_plugin", @@ -10,7 +10,7 @@ kt_compiler_plugin( }, stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:allopen-compiler-plugin", + "@rules_kotlin//kotlin/compiler:allopen-compiler-plugin", ], ) @@ -23,7 +23,7 @@ kt_compiler_plugin( }, stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:noarg-compiler-plugin", + "@rules_kotlin//kotlin/compiler:noarg-compiler-plugin", ], ) @@ -64,7 +64,7 @@ kt_jvm_test( test_class = "plugin.allopennoarg.UserHasNoargConstructorTest", deps = [ ":user", - "@io_bazel_rules_kotlin//kotlin/compiler:kotlin-reflect", "@maven//:junit_junit", + "@rules_kotlin//kotlin/compiler:kotlin-reflect", ], ) diff --git a/examples/plugin/src/noarg/BUILD b/examples/plugin/src/noarg/BUILD index 1e57e693a..0b1b178af 100644 --- a/examples/plugin/src/noarg/BUILD +++ b/examples/plugin/src/noarg/BUILD @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test") -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") kt_compiler_plugin( name = "no_arg_plugin", @@ -10,7 +10,7 @@ kt_compiler_plugin( }, stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:noarg-compiler-plugin", + "@rules_kotlin//kotlin/compiler:noarg-compiler-plugin", ], ) @@ -35,7 +35,7 @@ kt_jvm_test( test_class = "plugin.noarg.UserHasNoargConstructorTest", deps = [ ":user", - "@io_bazel_rules_kotlin//kotlin/compiler:kotlin-reflect", "@maven//:junit_junit", + "@rules_kotlin//kotlin/compiler:kotlin-reflect", ], ) diff --git a/examples/plugin/src/parcelize/BUILD b/examples/plugin/src/parcelize/BUILD index 945388777..0fc4a8884 100644 --- a/examples/plugin/src/parcelize/BUILD +++ b/examples/plugin/src/parcelize/BUILD @@ -1,6 +1,6 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_compiler_plugin( name = "parcelize_plugin", @@ -8,7 +8,7 @@ kt_compiler_plugin( id = "org.jetbrains.kotlin.parcelize", stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:parcelize-compiler-plugin", + "@rules_kotlin//kotlin/compiler:parcelize-compiler-plugin", ], ) @@ -21,7 +21,7 @@ kt_jvm_library( ], visibility = ["//visibility:public"], exports = [ - "@io_bazel_rules_kotlin//kotlin/compiler:parcelize-runtime", + "@rules_kotlin//kotlin/compiler:parcelize-runtime", ], ) diff --git a/examples/plugin/src/sam_with_receiver/BUILD b/examples/plugin/src/sam_with_receiver/BUILD index a2d4a43f7..22e36ed07 100644 --- a/examples/plugin/src/sam_with_receiver/BUILD +++ b/examples/plugin/src/sam_with_receiver/BUILD @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") load("@rules_java//java:defs.bzl", "java_library") kt_compiler_plugin( @@ -11,7 +11,7 @@ kt_compiler_plugin( }, stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:sam-with-receiver-compiler-plugin", + "@rules_kotlin//kotlin/compiler:sam-with-receiver-compiler-plugin", ], ) diff --git a/examples/plugin/src/serialization/BUILD b/examples/plugin/src/serialization/BUILD index 1d8b7a5cb..892978fbc 100644 --- a/examples/plugin/src/serialization/BUILD +++ b/examples/plugin/src/serialization/BUILD @@ -1,5 +1,5 @@ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test") +load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test") kt_compiler_plugin( name = "serialization_plugin", @@ -7,7 +7,7 @@ kt_compiler_plugin( id = "org.jetbrains.kotlin.serialization", stubs_phase = True, deps = [ - "@io_bazel_rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin", + "@rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin", ], ) diff --git a/examples/trivial/MODULE.bazel b/examples/trivial/MODULE.bazel index d2f55a335..95a0ca05d 100644 --- a/examples/trivial/MODULE.bazel +++ b/examples/trivial/MODULE.bazel @@ -1,9 +1,9 @@ module(name = "trival-example") bazel_dep(name = "rules_java", version = "6.4.0") -bazel_dep(name = "io_bazel_rules_kotlin") +bazel_dep(name = "rules_kotlin") local_path_override( - module_name = "io_bazel_rules_kotlin", + module_name = "rules_kotlin", path = "../..", ) diff --git a/examples/trivial/WORKSPACE b/examples/trivial/WORKSPACE index 75435ae87..253cab808 100644 --- a/examples/trivial/WORKSPACE +++ b/examples/trivial/WORKSPACE @@ -8,14 +8,14 @@ local_repository( load("@release_archive//:repository.bzl", "archive_repository") archive_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions") kotlin_repositories() -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() diff --git a/examples/trivial/app/BUILD.bazel b/examples/trivial/app/BUILD.bazel index 3ea87a0b4..974052298 100644 --- a/examples/trivial/app/BUILD.bazel +++ b/examples/trivial/app/BUILD.bazel @@ -1,6 +1,6 @@ load("@rules_java//java:defs.bzl", "java_binary") -load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") -load("@io_bazel_rules_kotlin//kotlin:lint.bzl", "ktlint_fix", "ktlint_test") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_kotlin//kotlin:lint.bzl", "ktlint_fix", "ktlint_test") kt_jvm_library( name = "app_lib", From fb8d889085eef61b2a8cf9179f3a9b824f1e48fd Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Fri, 15 Sep 2023 14:39:35 -0700 Subject: [PATCH 24/27] Remove --- examples/trivial/MODULE.bazel | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 examples/trivial/MODULE.bazel diff --git a/examples/trivial/MODULE.bazel b/examples/trivial/MODULE.bazel deleted file mode 100644 index 95a0ca05d..000000000 --- a/examples/trivial/MODULE.bazel +++ /dev/null @@ -1,31 +0,0 @@ -module(name = "trival-example") - -bazel_dep(name = "rules_java", version = "6.4.0") -bazel_dep(name = "rules_kotlin") -local_path_override( - module_name = "rules_kotlin", - path = "../..", -) - -bazel_dep(name = "rules_jvm_external", version = "4.4.2") - -maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") -maven.install( - artifacts = [ - "com.expedia:graphql-kotlin:1.0.0-RC5", - "com.expedia:graphql-kotlin-schema-generator:1.0.0-RC5", - "com.expedia:graphql-kotlin-federation:1.0.0-RC5", - "com.graphql-java:graphql-java:13.0", - "org.opentest4j:opentest4j:1.1.1", - "org.apiguardian:apiguardian-api:1.0.0", - "org.junit.platform:junit-platform-commons:1.4.2", - "org.junit.jupiter:junit-jupiter-api:5.4.2", - "org.junit.jupiter:junit-jupiter-params:5.4.2", - "org.apache.logging.log4j:log4j-core:2.16.0", - ], - repositories = [ - "https://maven-central.storage.googleapis.com/repos/central/data/", - "https://repo1.maven.org/maven2", - ], -) -use_repo(maven, "maven") From ce9fe55afb665caec5a6896cdd91ccc2d9670f0b Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Fri, 15 Sep 2023 14:44:17 -0700 Subject: [PATCH 25/27] Revert "Remove" This reverts commit fb8d889085eef61b2a8cf9179f3a9b824f1e48fd. --- examples/trivial/MODULE.bazel | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/trivial/MODULE.bazel diff --git a/examples/trivial/MODULE.bazel b/examples/trivial/MODULE.bazel new file mode 100644 index 000000000..95a0ca05d --- /dev/null +++ b/examples/trivial/MODULE.bazel @@ -0,0 +1,31 @@ +module(name = "trival-example") + +bazel_dep(name = "rules_java", version = "6.4.0") +bazel_dep(name = "rules_kotlin") +local_path_override( + module_name = "rules_kotlin", + path = "../..", +) + +bazel_dep(name = "rules_jvm_external", version = "4.4.2") + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +maven.install( + artifacts = [ + "com.expedia:graphql-kotlin:1.0.0-RC5", + "com.expedia:graphql-kotlin-schema-generator:1.0.0-RC5", + "com.expedia:graphql-kotlin-federation:1.0.0-RC5", + "com.graphql-java:graphql-java:13.0", + "org.opentest4j:opentest4j:1.1.1", + "org.apiguardian:apiguardian-api:1.0.0", + "org.junit.platform:junit-platform-commons:1.4.2", + "org.junit.jupiter:junit-jupiter-api:5.4.2", + "org.junit.jupiter:junit-jupiter-params:5.4.2", + "org.apache.logging.log4j:log4j-core:2.16.0", + ], + repositories = [ + "https://maven-central.storage.googleapis.com/repos/central/data/", + "https://repo1.maven.org/maven2", + ], +) +use_repo(maven, "maven") From fea5064d7fef4e3979fa8a135081e697a2d1a7f5 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Fri, 15 Sep 2023 15:04:07 -0700 Subject: [PATCH 26/27] More renaming --- .../projects/core/api/src/test/kotlin/core/api/BUILD.bazel | 2 +- .../projects/core/impl/src/test/kotlin/core/impl/BUILD.bazel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/associates/projects/core/api/src/test/kotlin/core/api/BUILD.bazel b/examples/associates/projects/core/api/src/test/kotlin/core/api/BUILD.bazel index 166a5ed13..bb25f0d96 100644 --- a/examples/associates/projects/core/api/src/test/kotlin/core/api/BUILD.bazel +++ b/examples/associates/projects/core/api/src/test/kotlin/core/api/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_test") +load("@rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_test") kt_jvm_test( name = "CoreApiTest", diff --git a/examples/associates/projects/core/impl/src/test/kotlin/core/impl/BUILD.bazel b/examples/associates/projects/core/impl/src/test/kotlin/core/impl/BUILD.bazel index a0525d3f4..ff9302945 100644 --- a/examples/associates/projects/core/impl/src/test/kotlin/core/impl/BUILD.bazel +++ b/examples/associates/projects/core/impl/src/test/kotlin/core/impl/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_test") +load("@rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_test") kt_jvm_test( name = "CoreImplTest", From 55b8bac5529e5774ad42c68fdb0c29bc889b24f7 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Fri, 15 Sep 2023 15:10:47 -0700 Subject: [PATCH 27/27] Revert --- src/main/starlark/core/repositories/versions.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/starlark/core/repositories/versions.bzl b/src/main/starlark/core/repositories/versions.bzl index 998a8b30e..3c05c1f9c 100644 --- a/src/main/starlark/core/repositories/versions.bzl +++ b/src/main/starlark/core/repositories/versions.bzl @@ -53,7 +53,7 @@ versions = struct( "https://github.com/bazelbuild/stardoc/releases/download/{version}/stardoc-{version}.tar.gz", ], ), - BAZEL_JAVA_LAUNCHER_VERSION = "6.3.2", + BAZEL_JAVA_LAUNCHER_VERSION = "6.2.1", BAZEL_JAVA_LAUNCHER_SHA = "78e29525872594ffc783c825f428b3e61d4f3e632f46eaa64f004b2814c4a612", PINTEREST_KTLINT = version( version = "0.49.1",