diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 446efb6b4..68ee6f5a6 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -8,13 +8,28 @@ 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: + name: "Tests without Bzlmod (Ubuntu 18.04)" + build_flags: + - "--enable_bzlmod=false" + test_flags: + - "--enable_bzlmod=false" + test_targets: + - "//:all_tests" + build_targets: + - "//:rules_kotlin_release" + ubuntu2004_bzlmod: + name: "Tests (Ubuntu 20.04)" + platform: ubuntu2004 test_targets: - "//:all_tests" build_targets: - "//:rules_kotlin_release" macos: + name: "Tests (Latest Macos)" test_targets: - "//:all_tests" + build_targets: + - "//:rules_kotlin_release" rbe_ubuntu1604: test_targets: - "--" @@ -68,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=true" + test_flags: + - "--enable_bzlmod=true" + include_json_profile: + - build + - test + build_targets: + - //... + test_targets: + - //... examples-trivial-windows: name: "Example - Trivial (Windows)" platform: windows 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/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 new file mode 100644 index 000000000..e1c1948eb --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,67 @@ +module( + name = "rules_kotlin", + version = "1.8.1", + compatibility_level = 1, + repo_name = "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_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( + 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", +) + +register_toolchains("//kotlin/internal:default_toolchain") + +# Development dependencies + +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", + 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.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", + "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") +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("@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.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 000000000..e69de29bb 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 26720f7a1..5eadb3734 100755 --- a/docs/kotlin.md +++ b/docs/kotlin.md @@ -211,7 +211,7 @@ kt_jvm_test(name, compiler_repository_name, ksp_repository_name, compiler_release, +kotlin_repositories(is_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 | | :------------- | :------------- | :------------- | +| 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/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/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/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/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", 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 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") 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/WORKSPACE.bzlmod b/examples/trivial/WORKSPACE.bzlmod new file mode 100644 index 000000000..e69de29bb 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", diff --git a/kotlin/internal/js/js.bzl b/kotlin/internal/js/js.bzl index 7a360d5f4..246b20e34 100644 --- a/kotlin/internal/js/js.bzl +++ b/kotlin/internal/js/js.bzl @@ -108,7 +108,7 @@ def kt_js_library_macro(name, **kwargs): kwargs = _lock_attrs(name, kwargs) # TODO this is a runtime dep, it should be picked up from the _toolchain attr or from a provider. - kwargs["deps"] = kwargs.get("deps", []) + ["@io_bazel_rules_kotlin//kotlin/compiler:kotlin-stdlib-js"] + kwargs["deps"] = kwargs.get("deps", []) + ["@rules_kotlin//kotlin/compiler:kotlin-stdlib-js"] kt_js_library(name = name, **kwargs) kt_js_import = rule( 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/kotlin/internal/jvm/jvm.bzl b/kotlin/internal/jvm/jvm.bzl index a50536197..ed3029c35 100644 --- a/kotlin/internal/jvm/jvm.bzl +++ b/kotlin/internal/jvm/jvm.bzl @@ -19,14 +19,14 @@ Add the following snippet to your `WORKSPACE` file: ```bzl git_repository( - name = "io_bazel_rules_kotlin", + name = "rules_kotlin", remote = "https://github.com/bazelbuild/rules_kotlin.git", commit = "", ) -load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") kotlin_repositories(kotlin_release_version = "1.4.0") -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") kt_register_toolchains() ``` @@ -335,7 +335,7 @@ Setup a simple kotlin_test. **Notes:** * The kotlin test library is not added implicitly, it is available with the label -`@io_bazel_rules_kotlin//kotlin/compiler:kotlin-test`. +`@rules_kotlin//kotlin/compiler:kotlin-test`. """, attrs = utils.add_dicts(_runnable_common_attr, { "_bazel_test_runner": attr.label( diff --git a/kotlin/internal/toolchains.bzl b/kotlin/internal/toolchains.bzl index 9f1760fb8..dfc9eb70a 100644 --- a/kotlin/internal/toolchains.bzl +++ b/kotlin/internal/toolchains.bzl @@ -35,7 +35,7 @@ This file contains macros for defining and registering specific toolchains. To override a tool chain use the appropriate macro in a `BUILD` file to declare the toolchain: ```bzl -load("@io_bazel_rules_kotlin//kotlin:toolchains.bzl", "define_kt_toolchain") +load("@rules_kotlin//kotlin:toolchains.bzl", "define_kt_toolchain") define_kt_toolchain( name= "custom_toolchain", 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", ], ) 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..6dc0cf38d --- /dev/null +++ b/src/main/starlark/core/repositories/bzlmod_setup.bzl @@ -0,0 +1,62 @@ +"""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 = "kotlinc_version", + _ksp_version = "ksp_version", +) +load( + "//src/main/starlark/core/repositories:versions.bzl", + _versions = "versions", +) + +_version_tag = tag_class( + attrs = { + "version": attr.string(mandatory = True), + "sha256": attr.string(mandatory = True), + }, +) + +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 = None + ksp_version = None + for mod in mctx.modules: + for override in mod.tags.kotlinc_version: + if kotlinc_version: + 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("Only one ksp_version is supported right now!") + ksp_version = _ksp_version(release = override.version, sha256 = override.sha256) + + _kotlin_repositories_args = dict(is_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) + + _extra_repositories() + +rules_kotlin_extensions = module_extension( + implementation = _rules_kotlin_extensions_impl, + tag_classes = { + "kotlinc_version": _version_tag, + "ksp_version": _version_tag, + }, +) diff --git a/src/main/starlark/core/repositories/initialize.bzl b/src/main/starlark/core/repositories/initialize.bzl index 902d6004e..5e27d33da 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( + 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. @@ -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(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 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 d32caccc4..23ebb49b3 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( + is_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( @@ -87,6 +88,9 @@ def kotlin_repositories( urls = versions.ANDROID.URLS, ) + if is_bzlmod: + return + versions.use_repository( name = "rules_python", rule = http_archive, diff --git a/src/main/starlark/core/repositories/versions.bzl b/src/main/starlark/core/repositories/versions.bzl index 809854ef0..3c05c1f9c 100644 --- a/src/main/starlark/core/repositories/versions.bzl +++ b/src/main/starlark/core/repositories/versions.bzl @@ -54,6 +54,7 @@ versions = struct( ], ), BAZEL_JAVA_LAUNCHER_VERSION = "6.2.1", + BAZEL_JAVA_LAUNCHER_SHA = "78e29525872594ffc783c825f428b3e61d4f3e632f46eaa64f004b2814c4a612", PINTEREST_KTLINT = version( version = "0.49.1", url_templates = [