Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
# bazelci pipeline
matrix:
integration_shard_flags:
- [ "--test_tag_filters=shard_0" ]
- [ "--test_tag_filters=shard_1" ]
- [ "--test_tag_filters=shard_2" ]
- [ "--test_tag_filters=shard_0", "--local_test_jobs=3" ]
- [ "--test_tag_filters=shard_1", "--local_test_jobs=3" ]
- [ "--test_tag_filters=shard_2", "--local_test_jobs=3" ]
test_flags:
- [ "--enable_bzlmod=true" ]
validate_config: 1
Expand Down
11 changes: 7 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ common --enable_platform_specific_config
common --enable_bzlmod=true
common --incompatible_use_plus_in_repo_names
common --incompatible_disallow_empty_glob=false
common --incompatible_disable_native_repo_rules=true
common --incompatible_autoload_externally=

common --java_runtime_version=remotejdk_17
common --tool_java_runtime_version=remotejdk_17

# TODO[https://github.com/bazelbuild/rules_kotlin/issues/1395]: Uncomment when all rules support not using native repo rules.
# common --incompatible_disable_native_repo_rules=true
# common --incompatible_autoload_externally=

build --strategy=KotlinCompile=worker
build --test_output=all
build --verbose_failures
Expand All @@ -33,5 +32,9 @@ common:windows --repo_env=COURSIER_PROGRESS=false
build --deleted_packages=examples/android,examples/android/app,examples/android/bzl,examples/android/libAndroid,examples/android/libJava,examples/android/libKtAndroid,examples/android/libKtAndroid/src/test/java/examples/android/lib,examples/android/third_party,examples/anvil,examples/anvil/app,examples/anvil/app/src/androidTest/java/com/squareup/anvil/sample,examples/anvil/app/src/main/java/com/squareup/anvil/sample,examples/anvil/app/src/test/java/com/squareup/anvil/sample,examples/anvil/library,examples/anvil/library/src/main/java/com/squareup/anvil/sample,examples/anvil/repro/src/main/java/com/repro/lib,examples/anvil/scopes,examples/anvil/scopes/src/main/java/com/squareup/scopes,examples/anvil/third_party,examples/associates,examples/associates/projects/core/api,examples/associates/projects/core/api/src/test/kotlin/core/api,examples/associates/projects/core/impl,examples/associates/projects/core/impl/src/test/kotlin/core/impl,examples/coverage,examples/dagger,examples/dagger/third_party,examples/deps,examples/deps/bzl,examples/deps/libAndroid1,examples/deps/libAndroid2,examples/deps/libAndroid3,examples/deps/libAndroid4,examples/deps/libJava1,examples/deps/libJava2,examples/deps/libJava3,examples/deps/libJava4,examples/deps/libKt1,examples/deps/libKt2,examples/deps/libKt3,examples/deps/libKt4,examples/deps/libKtAndroid1,examples/deps/libKtAndroid2,examples/deps/libKtAndroid3,examples/deps/libKtAndroid4,examples/jetpack_compose,examples/jetpack_compose/app,examples/jetpack_compose/compose-ui,examples/ksp,examples/ksp/third_party,examples/multiplex,examples/multiplex/src,examples/nested_module_resources,examples/nested_module_resources/nested,examples/plugin,examples/plugin/src/allopen,examples/plugin/src/allopennoarg,examples/plugin/src/noarg,examples/plugin/src/parcelize,examples/plugin/src/sam_with_receiver,examples/plugin/src/serialization,examples/trivial,examples/trivial/app
query --deleted_packages=examples/android,examples/android/app,examples/android/bzl,examples/android/libAndroid,examples/android/libJava,examples/android/libKtAndroid,examples/android/libKtAndroid/src/test/java/examples/android/lib,examples/android/third_party,examples/anvil,examples/anvil/app,examples/anvil/app/src/androidTest/java/com/squareup/anvil/sample,examples/anvil/app/src/main/java/com/squareup/anvil/sample,examples/anvil/app/src/test/java/com/squareup/anvil/sample,examples/anvil/library,examples/anvil/library/src/main/java/com/squareup/anvil/sample,examples/anvil/repro/src/main/java/com/repro/lib,examples/anvil/scopes,examples/anvil/scopes/src/main/java/com/squareup/scopes,examples/anvil/third_party,examples/associates,examples/associates/projects/core/api,examples/associates/projects/core/api/src/test/kotlin/core/api,examples/associates/projects/core/impl,examples/associates/projects/core/impl/src/test/kotlin/core/impl,examples/coverage,examples/dagger,examples/dagger/third_party,examples/deps,examples/deps/bzl,examples/deps/libAndroid1,examples/deps/libAndroid2,examples/deps/libAndroid3,examples/deps/libAndroid4,examples/deps/libJava1,examples/deps/libJava2,examples/deps/libJava3,examples/deps/libJava4,examples/deps/libKt1,examples/deps/libKt2,examples/deps/libKt3,examples/deps/libKt4,examples/deps/libKtAndroid1,examples/deps/libKtAndroid2,examples/deps/libKtAndroid3,examples/deps/libKtAndroid4,examples/jetpack_compose,examples/jetpack_compose/app,examples/jetpack_compose/compose-ui,examples/ksp,examples/ksp/third_party,examples/multiplex,examples/multiplex/src,examples/nested_module_resources,examples/nested_module_resources/nested,examples/plugin,examples/plugin/src/allopen,examples/plugin/src/allopennoarg,examples/plugin/src/noarg,examples/plugin/src/parcelize,examples/plugin/src/sam_with_receiver,examples/plugin/src/serialization,examples/trivial,examples/trivial/app

# Use precompiled protoc
common --incompatible_enable_proto_toolchain_resolution
common --@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc=true

# User-specific .bazelrc
try-import %workspace%/user.bazelrc
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.4.2
9.0.0
30 changes: 21 additions & 9 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ module(
repo_name = "rules_kotlin",
)

proto_version = "4.33.1"
proto_version = "4.33.4"

proto_version_parts = proto_version.split(".")

proto_module_version = ".".join(proto_version_parts[-2:]) # Last 2 parts

bazel_dep(name = "protobuf", version = proto_module_version, repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "6.0.2", repo_name = "rules_proto")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is just gone?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, now protobuf has everything in it

bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "py_absl")
bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "rules_java", version = "8.9.0")
bazel_dep(name = "rules_python", version = "0.23.1")
bazel_dep(name = "rules_android", version = "0.7.0")
bazel_dep(name = "rules_android", version = "0.7.1")

remote_android_extensions = use_extension(
"@rules_android//bzlmod_extensions:android_extensions.bzl",
Expand All @@ -35,8 +33,8 @@ register_toolchains("@androidsdk//:all")
bazel_dep(name = "bazel_features", version = "1.39.0")
bazel_dep(name = "bazel_lib", version = "3.1.0")
bazel_dep(name = "rules_shell", version = "0.4.1")
bazel_dep(name = "bazel_worker_api", version = "0.0.8")
bazel_dep(name = "bazel_worker_java", version = "0.0.8")
bazel_dep(name = "bazel_worker_api", version = "0.0.10")
bazel_dep(name = "bazel_worker_java", version = "0.0.10")

# TODO[https://github.com/bazelbuild/rules_kotlin/issues/1395]: Update when fixed version is available.
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1", dev_dependency = True)
Expand Down Expand Up @@ -66,7 +64,7 @@ register_toolchains("//kotlin/internal:default_toolchain")
# TODO(bencodes) A bunch of these dependencies need to be marked as dev_dependencies but before we can do that
# we need to sort out a few cases around how these rules are consumed in various ways.

bazel_dep(name = "rules_jvm_external", version = "6.6")
bazel_dep(name = "rules_jvm_external", version = "6.10")
bazel_dep(name = "bazel_ci_rules", version = "1.0.0")

rbe_preconfig = use_repo_rule("@bazel_ci_rules//:rbe_repo.bzl", "rbe_preconfig")
Expand Down Expand Up @@ -131,19 +129,33 @@ maven.override(
coordinates = "org.jetbrains.kotlin.kotlin:kotlin-stdlib-jdk8",
target = "@rules_kotlin//kotlin/compiler:kotlin-stdlib-jdk8",
)
maven.override(
name = "override_target_in_deps_protobuf_java",
coordinates = "com.google.protobuf:protobuf-java",
target = "@com_google_protobuf//:protobuf_java",
)
maven.override(
name = "override_target_in_deps_protobuf_java_util",
coordinates = "com.google.protobuf:protobuf-java-util",
target = "@com_google_protobuf//:protobuf_java_util",
)
use_repo(maven, "kotlin_rules_maven", "unpinned_kotlin_rules_maven")

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

bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "stardoc", version = "0.8.1", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "rules_testing", version = "0.9.0", dev_dependency = True)
bazel_dep(name = "rules_bazel_integration_test", version = "0.34.0", dev_dependency = True)
bazel_dep(name = "rules_bazel_integration_test", version = "0.37.1", dev_dependency = True)

bazel_binaries = use_extension("@rules_bazel_integration_test//:extensions.bzl", "bazel_binaries", dev_dependency = True)
bazel_binaries.download(version = "7.x")
bazel_binaries.download(version = "8.x")
bazel_binaries.download(version_file = "//:.bazelversion")
use_repo(
bazel_binaries,
"bazel_binaries",
"bazel_binaries_bazelisk",
"build_bazel_bazel_.bazelversion",
"build_bazel_bazel_7_x",
"build_bazel_bazel_8_x",
)
30 changes: 24 additions & 6 deletions MODULE.release.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,36 @@ module(
repo_name = "rules_kotlin",
)

proto_version = "4.33.4"

proto_version_parts = proto_version.split(".")

proto_module_version = ".".join(proto_version_parts[-2:]) # Last 2 parts

bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_java", version = "8.9.0")
bazel_dep(name = "rules_android", version = "0.7.0")
bazel_dep(name = "rules_android", version = "0.7.1")
bazel_dep(name = "bazel_features", version = "1.39.0")
bazel_dep(name = "bazel_lib", version = "3.1.0")
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "6.0.2", repo_name = "rules_proto")
bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "py_absl")
bazel_dep(name = "protobuf", version = proto_module_version, repo_name = "com_google_protobuf")
bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "bazel_worker_api", version = "0.0.8")
bazel_dep(name = "bazel_worker_java", version = "0.0.8")
bazel_dep(name = "bazel_worker_api", version = "0.0.10")
bazel_dep(name = "bazel_worker_java", version = "0.0.10")
bazel_dep(name = "rules_jvm_external", version = "6.10") # >= 6.10 needed for Bazel 9 compat

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

maven.override(
name = "override_target_in_deps_protobuf_java",
coordinates = "com.google.protobuf:protobuf-java",
target = "@com_google_protobuf//:protobuf_java",
)
maven.override(
name = "override_target_in_deps_protobuf_java_util",
coordinates = "com.google.protobuf:protobuf-java-util",
target = "@com_google_protobuf//:protobuf_java_util",
)

rules_java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(rules_java_toolchains, "remote_java_tools")
Expand Down
10 changes: 5 additions & 5 deletions docs/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ It is appropriate for building workspace utilities. `java_binary` should be pref
| <a id="kt_jvm_binary-data"></a>data | The list of files needed by this rule at runtime. See general comments about `data` at [Attributes common to all build rules](https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes). | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_jvm_binary-resources"></a>resources | A list of files that should be include in a Java jar. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_jvm_binary-associates"></a>associates | Kotlin deps who should be considered part of the same module/compilation-unit for the purposes of "internal" access. Such deps must all share the same module space and so a target cannot associate to two deps from two different modules. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_jvm_binary-env"></a>env | Environment variables to set when this binary is executed with `bazel run`. Note: for Starlark rules, values are used as-is (no automatic $(location) / make variable expansion). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="kt_jvm_binary-env"></a>env | Environment variables to set when this binary is executed with `bazel run`. Note: for Starlark rules, values are used as-is (no automatic $(location) / make variable expansion). | <a href="https://bazel.build/rules/lib/core/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="kt_jvm_binary-env_inherit"></a>env_inherit | Names of environment variables to inherit from the shell when executed with `bazel run`. | List of strings | optional | `[]` |
| <a id="kt_jvm_binary-java_stub_template"></a>java_stub_template | - | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `"@rules_kotlin//third_party:java_stub_template.txt"` |
| <a id="kt_jvm_binary-javac_opts"></a>javac_opts | Javac options to be used when compiling this target. These opts if provided will be used instead of the ones provided to the toolchain. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
Expand Down Expand Up @@ -199,7 +199,7 @@ Setup a simple kotlin_test.
| <a id="kt_jvm_test-data"></a>data | The list of files needed by this rule at runtime. See general comments about `data` at [Attributes common to all build rules](https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes). | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_jvm_test-resources"></a>resources | A list of files that should be include in a Java jar. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_jvm_test-associates"></a>associates | Kotlin deps who should be considered part of the same module/compilation-unit for the purposes of "internal" access. Such deps must all share the same module space and so a target cannot associate to two deps from two different modules. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_jvm_test-env"></a>env | Specifies additional environment variables to set when the target is executed by bazel test. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="kt_jvm_test-env"></a>env | Specifies additional environment variables to set when the target is executed by bazel test. | <a href="https://bazel.build/rules/lib/core/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="kt_jvm_test-env_inherit"></a>env_inherit | Environment variables to inherit from the external environment. | List of strings | optional | `[]` |
| <a id="kt_jvm_test-java_stub_template"></a>java_stub_template | - | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `"@rules_kotlin//third_party:java_stub_template.txt"` |
| <a id="kt_jvm_test-javac_opts"></a>javac_opts | Javac options to be used when compiling this target. These opts if provided will be used instead of the ones provided to the toolchain. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
Expand Down Expand Up @@ -345,7 +345,7 @@ kt_jvm_library(
| <a id="kt_compiler_plugin-data"></a>data | The list of data files to be used by compiler's plugin | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_compiler_plugin-compile_phase"></a>compile_phase | Runs the compiler plugin during kotlin compilation. Known examples: `allopen`, `sam_with_reciever` | Boolean | optional | `True` |
| <a id="kt_compiler_plugin-id"></a>id | The ID of the plugin | String | required | |
| <a id="kt_compiler_plugin-options"></a>options | Dictionary of options to be passed to the plugin. Supports the following template values:<br><br>- `{generatedClasses}`: directory for generated class output - `{temp}`: temporary directory, discarded between invocations - `{generatedSources}`: directory for generated source output - `{classpath}` : replaced with a list of jars separated by the filesystem appropriate separator. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="kt_compiler_plugin-options"></a>options | Dictionary of options to be passed to the plugin. Supports the following template values:<br><br>- `{generatedClasses}`: directory for generated class output - `{temp}`: temporary directory, discarded between invocations - `{generatedSources}`: directory for generated source output - `{classpath}` : replaced with a list of jars separated by the filesystem appropriate separator. | <a href="https://bazel.build/rules/lib/core/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="kt_compiler_plugin-stubs_phase"></a>stubs_phase | Runs the compiler plugin in kapt stub generation. | Boolean | optional | `True` |
| <a id="kt_compiler_plugin-target_embedded_compiler"></a>target_embedded_compiler | Plugin was compiled against the embeddable kotlin compiler. These plugins expect shaded kotlinc dependencies, and will fail when running against a non-embeddable compiler. | Boolean | optional | `False` |

Expand Down Expand Up @@ -441,7 +441,7 @@ Define kotlin compiler options.
| <a id="kt_kotlinc_options-x_type_enhancement_improvements_strict_mode"></a>x_type_enhancement_improvements_strict_mode | Enables strict mode for type enhancement improvements, enforcing stricter type checking and enhancements. | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_use_fir_lt"></a>x_use_fir_lt | Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_use_k2"></a>x_use_k2 | Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_warning_level"></a>x_warning_level | Suppress specific warnings globally. Ex: 'OPTION': '(error\|warning\|disabled)' | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="kt_kotlinc_options-x_warning_level"></a>x_warning_level | Suppress specific warnings globally. Ex: 'OPTION': '(error\|warning\|disabled)' | <a href="https://bazel.build/rules/lib/core/dict">Dictionary: String -> String</a> | optional | `{}` |


<a id="kt_ksp_plugin"></a>
Expand Down Expand Up @@ -511,7 +511,7 @@ This allows setting options and dependencies independently from the initial plug
| <a id="kt_plugin_cfg-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="kt_plugin_cfg-deps"></a>deps | Dependencies for this configuration. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_plugin_cfg-data"></a>data | The list of data files to be used by compiler's plugin | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="kt_plugin_cfg-options"></a>options | A dictionary of flag to values to be used as plugin configuration options. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> List of strings</a> | optional | `{}` |
| <a id="kt_plugin_cfg-options"></a>options | A dictionary of flag to values to be used as plugin configuration options. | <a href="https://bazel.build/rules/lib/core/dict">Dictionary: String -> List of strings</a> | optional | `{}` |
| <a id="kt_plugin_cfg-plugin"></a>plugin | The plugin to associate with this configuration | <a href="https://bazel.build/concepts/labels">Label</a> | required | |


Expand Down
4 changes: 4 additions & 0 deletions examples/android/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ common --lockfile_mode=off
test --test_output=all
build --config=android_worker

# Required for abseil-cpp which requires C++17
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17

# Worker configuration
build:android_worker \
--worker_max_instances=auto \
Expand Down
Loading