Skip to content

Create a new "bootstrap" toolchain and compile with 2.1.0 #1244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1d71c79
Create a new "bootstrap" toolchain.
restingbull Dec 14, 2024
125ceb7
Add neverlink and export support.
restingbull Dec 14, 2024
c66eed3
Able to compile with 2.1.0.
restingbull Dec 14, 2024
23ecc6d
Fix naming of outputs in test.
restingbull Dec 16, 2024
e0f20d5
Add cli toolchain to workspace
restingbull Dec 16, 2024
c712839
Cleanup lint
restingbull Dec 16, 2024
10b48d6
Update maven deps
restingbull Dec 16, 2024
3b7bffd
Workaround change in reflection resolution in 2.1.0. Fixed in 2.1.20
restingbull Dec 17, 2024
3f80a00
Pass stdlib to clit compiler runtime.
restingbull Dec 17, 2024
1a70251
Remove integration test as examples now covers all cases.
restingbull Dec 17, 2024
b036cf2
Include coroutines, as the compiler needs them to run
restingbull Dec 17, 2024
7a13ebc
Remove kotlin released references.
restingbull Dec 17, 2024
e2c7fc0
Add 2.1 capabilities
restingbull Dec 17, 2024
2ea9a15
Update docs, add provider to the release
restingbull Dec 18, 2024
a4331ff
Update serializer core
restingbull Dec 18, 2024
435e900
Fix serialization lib
restingbull Dec 18, 2024
b643a76
Clean up deps test
restingbull Dec 18, 2024
52eaa8b
Update defaults and add toolchain to actions
restingbull Dec 18, 2024
64f9ac3
Shutdown and clean. Something seems rotten
restingbull Dec 18, 2024
a913f0e
enable toolchain debug and fix toUpserCase;
restingbull Dec 18, 2024
5f09d1b
Update runner to use override_module when correct
restingbull Dec 18, 2024
79b04ce
switch off rbe
restingbull Dec 19, 2024
fb7c090
Fix workspace cycles
restingbull Dec 19, 2024
0b7da29
Fix ordering on deps, update compose version
restingbull Dec 19, 2024
ae72932
Map compse versions, fix deps toolchain version
restingbull Dec 19, 2024
b0b3abd
update jetpack again
restingbull Dec 19, 2024
fbd257c
Finally get a working set of libraries
restingbull Dec 20, 2024
aca7ee1
Add pnning mechanism and hard code workspace
restingbull Dec 20, 2024
ff12c2c
Remove stdlib. Should pulled from toolchain
restingbull Dec 20, 2024
c40d2e5
Work around https://github.com/bazelbuild/bazel/issues/21225
restingbull Dec 20, 2024
51b753b
Re-enable rbe for integration tests, turn off verbose
restingbull Dec 23, 2024
e78858a
Update options
restingbull Dec 24, 2024
42c2f78
revert jvm default for another pr
restingbull Dec 24, 2024
9088ba7
Add capabilities
restingbull Dec 24, 2024
cd7ca3e
Add capabilities and update docs
restingbull Dec 24, 2024
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
2 changes: 0 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ test_suite(
tests = [
"//src/test/kotlin/io/bazel/kotlin:assertion_tests",
"//src/test/kotlin/io/bazel/kotlin/builder:builder_tests",
"//src/test/kotlin/io/bazel/kotlin/integration:integration_tests",
"//src/test/kotlin/io/bazel/worker:worker_tests",
"//src/test/starlark:convert_tests",
],
Expand All @@ -50,7 +49,6 @@ test_suite(
tests = [
":all_tests",
"//src/test/kotlin/io/bazel/kotlin:local_assertion_tests",
"//src/test/kotlin/io/bazel/kotlin/integration:local_integration_tests",
"//src/test/kotlin/io/bazel/worker:local_worker_tests",
"//src/test/starlark:convert_tests",
],
Expand Down
21 changes: 4 additions & 17 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,10 @@ use_repo(
"kotlinx_serialization_core_jvm",
"kotlinx_serialization_json",
"kotlinx_serialization_json_jvm",
"released_rules_kotlin",
)

# Once the released rules_koltin is defined, configure it.
rules_kotlin_bootstrap_extensions = use_extension(
"//src/main/starlark/core/repositories:bzlmod_bootstrap.bzl",
"rules_kotlin_bootstrap_extensions",
)
use_repo(
rules_kotlin_bootstrap_extensions,
"released_com_github_google_ksp",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these not being synced anymore for some reason?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the build-kotlin-with kotlin, so we don't use the released rules anymore.

"released_com_github_jetbrains_kotlin",
)

register_toolchains("@released_rules_kotlin//kotlin/internal:default_toolchain")
register_toolchains("//src/main/starlark/core/compile/cli")

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

# TODO(bencodes) We should be able to remove this once rules_android has rolled out official Bzlmod support
Expand Down Expand Up @@ -73,9 +60,9 @@ maven.install(
"com.google.auto.service:auto-service-annotations:1.1.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.51",
"com.google.dagger:dagger-compiler:2.51",
"com.google.dagger:dagger-producers:2.51",
"com.google.dagger:dagger:2.53.1",
"com.google.dagger:dagger-compiler:2.53.1",
"com.google.dagger:dagger-producers:2.53.1",
"javax.annotation:javax.annotation-api:1.3.2",
"javax.inject:javax.inject:1",
"org.apache.commons:commons-compress:1.26.2",
Expand Down
2 changes: 2 additions & 0 deletions WORKSPACE.dev.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ load("//kotlin:repositories.bzl", "kotlin_repositories")

kotlin_repositories()

register_toolchains("//src/main/starlark/core/compile/cli")

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

android_sdk_repository(name = "androidsdk")
33 changes: 6 additions & 27 deletions docs/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,10 @@ Define java compiler options for `kt_jvm_*` rules with java sources.
load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options")

kt_kotlinc_options(<a href="#kt_kotlinc_options-name">name</a>, <a href="#kt_kotlinc_options-include_stdlibs">include_stdlibs</a>, <a href="#kt_kotlinc_options-java_parameters">java_parameters</a>, <a href="#kt_kotlinc_options-jvm_target">jvm_target</a>, <a href="#kt_kotlinc_options-warn">warn</a>,
<a href="#kt_kotlinc_options-x_allow_result_return_type">x_allow_result_return_type</a>, <a href="#kt_kotlinc_options-x_assertions">x_assertions</a>, <a href="#kt_kotlinc_options-x_backend_threads">x_backend_threads</a>,
<a href="#kt_kotlinc_options-x_consistent_data_class_copy_visibility">x_consistent_data_class_copy_visibility</a>, <a href="#kt_kotlinc_options-x_context_receivers">x_context_receivers</a>,
<a href="#kt_kotlinc_options-x_emit_jvm_type_annotations">x_emit_jvm_type_annotations</a>, <a href="#kt_kotlinc_options-x_enable_incremental_compilation">x_enable_incremental_compilation</a>, <a href="#kt_kotlinc_options-x_explicit_api_mode">x_explicit_api_mode</a>,
<a href="#kt_kotlinc_options-x_inline_classes">x_inline_classes</a>, <a href="#kt_kotlinc_options-x_jdk_release">x_jdk_release</a>, <a href="#kt_kotlinc_options-x_jspecify_annotations">x_jspecify_annotations</a>, <a href="#kt_kotlinc_options-x_jsr_305">x_jsr_305</a>, <a href="#kt_kotlinc_options-x_jvm_default">x_jvm_default</a>,
<a href="#kt_kotlinc_options-x_lambdas">x_lambdas</a>, <a href="#kt_kotlinc_options-x_multi_platform">x_multi_platform</a>, <a href="#kt_kotlinc_options-x_no_call_assertions">x_no_call_assertions</a>, <a href="#kt_kotlinc_options-x_no_optimize">x_no_optimize</a>,
<a href="#kt_kotlinc_options-x_no_optimized_callable_references">x_no_optimized_callable_references</a>, <a href="#kt_kotlinc_options-x_no_param_assertions">x_no_param_assertions</a>,
<a href="#kt_kotlinc_options-x_no_receiver_assertions">x_no_receiver_assertions</a>, <a href="#kt_kotlinc_options-x_no_source_debug_extension">x_no_source_debug_extension</a>, <a href="#kt_kotlinc_options-x_optin">x_optin</a>, <a href="#kt_kotlinc_options-x_report_perf">x_report_perf</a>,
<a href="#kt_kotlinc_options-x_sam_conversions">x_sam_conversions</a>, <a href="#kt_kotlinc_options-x_skip_prerelease_check">x_skip_prerelease_check</a>, <a href="#kt_kotlinc_options-x_suppress_version_warnings">x_suppress_version_warnings</a>,
<a href="#kt_kotlinc_options-x_type_enhancement_improvements_strict_mode">x_type_enhancement_improvements_strict_mode</a>, <a href="#kt_kotlinc_options-x_use_fir_lt">x_use_fir_lt</a>, <a href="#kt_kotlinc_options-x_use_k2">x_use_k2</a>)
<a href="#kt_kotlinc_options-x_allow_result_return_type">x_allow_result_return_type</a>, <a href="#kt_kotlinc_options-x_assertions">x_assertions</a>, <a href="#kt_kotlinc_options-x_consistent_data_class_copy_visibility">x_consistent_data_class_copy_visibility</a>,
<a href="#kt_kotlinc_options-x_enable_incremental_compilation">x_enable_incremental_compilation</a>, <a href="#kt_kotlinc_options-x_jdk_release">x_jdk_release</a>, <a href="#kt_kotlinc_options-x_jspecify_annotations">x_jspecify_annotations</a>, <a href="#kt_kotlinc_options-x_jsr_305">x_jsr_305</a>,
<a href="#kt_kotlinc_options-x_jvm_default">x_jvm_default</a>, <a href="#kt_kotlinc_options-x_multi_platform">x_multi_platform</a>, <a href="#kt_kotlinc_options-x_no_source_debug_extension">x_no_source_debug_extension</a>, <a href="#kt_kotlinc_options-x_optin">x_optin</a>,
<a href="#kt_kotlinc_options-x_type_enhancement_improvements_strict_mode">x_type_enhancement_improvements_strict_mode</a>, <a href="#kt_kotlinc_options-x_use_fir_lt">x_use_fir_lt</a>)
</pre>

Define kotlin compiler options.
Expand All @@ -402,33 +397,17 @@ Define kotlin compiler options.
| <a id="kt_kotlinc_options-warn"></a>warn | Control warning behaviour. | String | optional | `"report"` |
| <a id="kt_kotlinc_options-x_allow_result_return_type"></a>x_allow_result_return_type | Enable kotlin.Result as a return type | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_assertions"></a>x_assertions | Configures how assertions are handled. The 'jvm' option enables assertions in JVM code. | String | optional | `""` |
| <a id="kt_kotlinc_options-x_backend_threads"></a>x_backend_threads | When using the IR backend, run lowerings by file in N parallel threads. 0 means use a thread per processor core. Default value is 1. | Integer | optional | `1` |
| <a id="kt_kotlinc_options-x_consistent_data_class_copy_visibility"></a>x_consistent_data_class_copy_visibility | The effect of this compiler flag is the same as applying @ConsistentCopyVisibility annotation to all data classes in the module. See https://youtrack.jetbrains.com/issue/KT-11914 | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_context_receivers"></a>x_context_receivers | Enable experimental context receivers. | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_emit_jvm_type_annotations"></a>x_emit_jvm_type_annotations | Basic support for type annotations in JVM bytecode. | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_enable_incremental_compilation"></a>x_enable_incremental_compilation | Enable incremental compilation | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_explicit_api_mode"></a>x_explicit_api_mode | Enable explicit API mode for Kotlin libraries. | String | optional | `"off"` |
| <a id="kt_kotlinc_options-x_inline_classes"></a>x_inline_classes | Enable experimental inline classes | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_jdk_release"></a>x_jdk_release | The -jvm_target flag. This is only tested at 1.8. | String | optional | `""` |
| <a id="kt_kotlinc_options-x_jspecify_annotations"></a>x_jspecify_annotations | Controls how JSpecify annotations are treated. Options are 'default', 'ignore', 'warn', and 'strict'. | String | optional | `""` |
| <a id="kt_kotlinc_options-x_jsr_305"></a>x_jsr_305 | Specifies how to handle JSR-305 annotations in Kotlin code. Options are 'default', 'ignore', 'warn', and 'strict'. | String | optional | `""` |
| <a id="kt_kotlinc_options-x_jvm_default"></a>x_jvm_default | Specifies that a JVM default method should be generated for non-abstract Kotlin interface member. | String | optional | `"off"` |
| <a id="kt_kotlinc_options-x_lambdas"></a>x_lambdas | Change codegen behavior of lambdas | String | optional | `"class"` |
| <a id="kt_kotlinc_options-x_multi_platform"></a>x_multi_platform | Enable experimental language support for multi-platform projects | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_no_call_assertions"></a>x_no_call_assertions | Don't generate not-null assertions for arguments of platform types | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_no_optimize"></a>x_no_optimize | Disable optimizations | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_no_optimized_callable_references"></a>x_no_optimized_callable_references | Do not use optimized callable reference superclasses. Available from 1.4. | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_no_param_assertions"></a>x_no_param_assertions | Don't generate not-null assertions on parameters of methods accessible from Java | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_no_receiver_assertions"></a>x_no_receiver_assertions | Don't generate not-null assertion for extension receiver arguments of platform types | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_no_source_debug_extension"></a>x_no_source_debug_extension | Do not generate @kotlin.jvm.internal.SourceDebugExtension annotation on a class with the copy of SMAP | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_optin"></a>x_optin | Define APIs to opt-in to. | List of strings | optional | `[]` |
| <a id="kt_kotlinc_options-x_report_perf"></a>x_report_perf | Report detailed performance statistics | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_sam_conversions"></a>x_sam_conversions | Change codegen behavior of SAM/functional interfaces | String | optional | `"class"` |
| <a id="kt_kotlinc_options-x_skip_prerelease_check"></a>x_skip_prerelease_check | Suppress errors thrown when using pre-release classes. | Boolean | optional | `False` |
| <a id="kt_kotlinc_options-x_suppress_version_warnings"></a>x_suppress_version_warnings | Suppress warnings about outdated, inconsistent, or experimental language or API versions. | Boolean | optional | `False` |
| <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_ksp_plugin"></a>
Expand Down Expand Up @@ -579,8 +558,8 @@ Call this in the WORKSPACE file to setup the Kotlin rules.
| <a id="kotlin_repositories-is_bzlmod"></a>is_bzlmod | <p align="center"> - </p> | `False` |
| <a id="kotlin_repositories-compiler_repository_name"></a>compiler_repository_name | for the kotlinc compiler repository. | `"com_github_jetbrains_kotlin"` |
| <a id="kotlin_repositories-ksp_repository_name"></a>ksp_repository_name | <p align="center"> - </p> | `"com_github_google_ksp"` |
| <a id="kotlin_repositories-compiler_release"></a>compiler_release | version provider from versions.bzl. | `struct(sha256 = "88d7d8bad362ae4e114a8b9668c6887b8c85f48e340883db0e317e47c8dc2f4f", url_templates = ["https://github.com/JetBrains/kotlin/releases/download/v{version}/kotlin-compiler-{version}.zip"], version = "2.0.10")` |
| <a id="kotlin_repositories-ksp_compiler_release"></a>ksp_compiler_release | (internal) version provider from versions.bzl. | `struct(sha256 = "e6a79e649ee383b372fa982be89686c10ee42b25e60147b3271a70fd75a9eb19", url_templates = ["https://github.com/google/ksp/releases/download/{version}/artifacts.zip"], version = "2.0.10-1.0.24")` |
| <a id="kotlin_repositories-compiler_release"></a>compiler_release | version provider from versions.bzl. | `struct(sha256 = "b6698d5728ad8f9edcdd01617d638073191d8a03139cc538a391b4e3759ad297", url_templates = ["https://github.com/JetBrains/kotlin/releases/download/v{version}/kotlin-compiler-{version}.zip"], version = "2.1.0")` |
| <a id="kotlin_repositories-ksp_compiler_release"></a>ksp_compiler_release | (internal) version provider from versions.bzl. | `struct(sha256 = "fc27b08cadc061a4a989af01cbeccb613feef1995f4aad68f2be0f886a3ee251", url_templates = ["https://github.com/google/ksp/releases/download/{version}/artifacts.zip"], version = "2.1.0-1.0.28")` |


<a id="versions.use_repository"></a>
Expand Down
2 changes: 1 addition & 1 deletion examples/android/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ maven.install(
"junit:junit:4.12",
"androidx.test.espresso:espresso-core:3.1.1",
"org.hamcrest:hamcrest-library:1.3",
"org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc",
"org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3",
"com.squareup.moshi:moshi:1.14.0",
"com.squareup.moshi:moshi-kotlin:1.14.0",
"com.squareup.moshi:moshi-kotlin-codegen:1.14.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/android/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ maven_install(
"junit:junit:4.12",
"androidx.test.espresso:espresso-core:3.1.1",
"org.hamcrest:hamcrest-library:1.3",
"org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc",
"org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3",
"com.squareup.moshi:moshi:1.14.0",
"com.squareup.moshi:moshi-kotlin:1.14.0",
"com.squareup.moshi:moshi-kotlin-codegen:1.14.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/android/libKtAndroid/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ kt_android_library(
"@maven//:androidx_appcompat_appcompat",
"@maven//:com_google_auto_value_auto_value_annotations",
"@maven//:com_squareup_moshi_moshi",
"@maven//:org_jetbrains_kotlinx_kotlinx_serialization_runtime",
"@maven//:org_jetbrains_kotlinx_kotlinx_serialization_core",
],
)

Expand Down
13 changes: 0 additions & 13 deletions examples/associates/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ kt_register_toolchains()

load("@rules_kotlin//src/main/starlark/core/repositories:versions.bzl", "versions")

http_archive(
name = "rules_android",
sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
strip_prefix = "rules_android-0.1.1",
urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"],
)

http_archive(
name = "bazel_skylib",
sha256 = versions.SKYLIB_SHA,
Expand Down Expand Up @@ -52,9 +45,3 @@ maven_install(
"https://repo1.maven.org/maven2",
],
)

http_archive(
name = "rules_pkg",
sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ data class MyType(
}

internal fun String.camelCase() = this.split("_").joinToString("") {
"${it[0].toUpperCase()}${it.substring(1)}"
"${it[0].uppercase()}${it.substring(1)}"
}
5 changes: 4 additions & 1 deletion examples/deps/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
common --incompatible_enable_android_toolchain_resolution
common --android_platforms=//:arm64-v8a
common --enable_workspace=true
common --enable_bzlmod=false
common --android_platforms=//:arm64-v8a
common --toolchain_resolution_debug=.*
26 changes: 3 additions & 23 deletions examples/deps/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ http_archive(
)

load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
load("@rules_kotlin//src/main/starlark/core/repositories:versions.bzl", "versions")

kotlin_repositories()

register_toolchains("//bzl:experimental_toolchain")

load("@rules_kotlin//src/main/starlark/core/repositories:versions.bzl", "versions")

http_archive(
name = "bazel_skylib",
sha256 = versions.SKYLIB_SHA,
Expand All @@ -37,24 +34,17 @@ load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
artifacts = [
"androidx.appcompat:appcompat:1.0.0",
"junit:junit:4.12",
"androidx.test.espresso:espresso-core:3.1.1",
"org.hamcrest:hamcrest-library:1.3",
"org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc",
"com.google.dagger:dagger:2.45",
"com.google.dagger:dagger-compiler:2.45",
"com.google.dagger:dagger-producers:2.45",
"com.google.auto.value:auto-value:1.6.5",
"com.google.auto.value:auto-value-annotations:1.6.5",
"org.robolectric:robolectric:4.7.3",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

register_toolchains("//bzl:experimental_toolchain")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does this need to be registered here in the example app? Is this requirement moving forward?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Defining a toolchain and not registering it means it will never be chosen.

App didn't compile without the toolchain -- complained about all sorts of things.


http_archive(
name = "rules_android",
sha256 = versions.ANDROID.SHA,
Expand All @@ -70,13 +60,3 @@ load(
android_sdk_repository(
name = "androidsdk",
)

http_archive(
name = "robolectric",
strip_prefix = "robolectric-bazel-4.7.3",
urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.7.3.tar.gz"],
)

load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")

robolectric_repositories()
2 changes: 1 addition & 1 deletion examples/deps/bzl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ kt_javac_options(
name = "default_javac_options",
)

KOTLIN_LANGUAGE_LEVEL = "1.6"
KOTLIN_LANGUAGE_LEVEL = "2.1"

define_kt_toolchain(
name = "experimental_toolchain",
Expand Down
9 changes: 9 additions & 0 deletions examples/jetpack_compose/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ build --define=android_dexmerger_tool=d8_dexmerger
# Flags for the D8 dexer
build --define=android_incremental_dexing_tool=d8_dexbuilder
build --define=android_standalone_dexing_tool=d8_compat_dx

common --enable_workspace=true --enable_bzlmod=false
common --noincompatible_enable_android_toolchain_resolution
build --platform_mappings=platform_mappings
build --fat_apk_cpu arm64-v8a
# Uncomment the below lines to build for x86
# build --fat_apk_cpu x86_64
build --android_crosstool_top=@androidndk//:toolchain
build --@rules_kotlin//kotlin/settings:jvm_emit_jdeps=False
8 changes: 8 additions & 0 deletions examples/jetpack_compose/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ platform(
"@platforms//os:android",
],
)

platform(
name = "x86_64",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:android",
],
)
Loading