Skip to content

Commit 7a988ee

Browse files
authored
Create a new "bootstrap" toolchain and compile with 2.1.0 (#1244)
* Create a new "bootstrap" toolchain. Given that Kotlin 2.1.0 now has a version metadata check during compilation, the idea of bootstrapping kotlin by using the previous is pretty much dead. Probably not the worst thing, as bzlmod did not enjoy the shennanigans necessary to make it work. This adds a new "cli" toolchain that invokes kotlinc via the established command line interface. Additionally, it sketches out a simpler, more contained toolchain api to build the more complex usecases (such as multiplex workers, jdeps, compiler plugins, etc.) on top of. the end goal is a more agile rule approach -- with the performance optimization (jdeps, class path reductions, etc) tucked behindthe simple api.Compiler plugins, linting, and the like should be able to live comfortably in the "production" rule and toolchain combinations. It also introduces new "core" rules, while limited in scope, should be IDE friendly and generally easier to work with than the previous bootstrapping effort -- and since they use the common providers, they will interoperate with the existing rules. Includes myriad of small fixes to get everything running on 2.1.
1 parent c68e194 commit 7a988ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3941
-1067
lines changed

BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ test_suite(
3838
tests = [
3939
"//src/test/kotlin/io/bazel/kotlin:assertion_tests",
4040
"//src/test/kotlin/io/bazel/kotlin/builder:builder_tests",
41-
"//src/test/kotlin/io/bazel/kotlin/integration:integration_tests",
4241
"//src/test/kotlin/io/bazel/worker:worker_tests",
4342
"//src/test/starlark:convert_tests",
4443
],
@@ -50,7 +49,6 @@ test_suite(
5049
tests = [
5150
":all_tests",
5251
"//src/test/kotlin/io/bazel/kotlin:local_assertion_tests",
53-
"//src/test/kotlin/io/bazel/kotlin/integration:local_integration_tests",
5452
"//src/test/kotlin/io/bazel/worker:local_worker_tests",
5553
"//src/test/starlark:convert_tests",
5654
],

MODULE.bazel

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,10 @@ use_repo(
2222
"kotlinx_serialization_core_jvm",
2323
"kotlinx_serialization_json",
2424
"kotlinx_serialization_json_jvm",
25-
"released_rules_kotlin",
2625
)
2726

28-
# Once the released rules_koltin is defined, configure it.
29-
rules_kotlin_bootstrap_extensions = use_extension(
30-
"//src/main/starlark/core/repositories:bzlmod_bootstrap.bzl",
31-
"rules_kotlin_bootstrap_extensions",
32-
)
33-
use_repo(
34-
rules_kotlin_bootstrap_extensions,
35-
"released_com_github_google_ksp",
36-
"released_com_github_jetbrains_kotlin",
37-
)
38-
39-
register_toolchains("@released_rules_kotlin//kotlin/internal:default_toolchain")
27+
register_toolchains("//src/main/starlark/core/compile/cli")
4028

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

4431
# TODO(bencodes) We should be able to remove this once rules_android has rolled out official Bzlmod support
@@ -73,9 +60,9 @@ maven.install(
7360
"com.google.auto.service:auto-service-annotations:1.1.1",
7461
"com.google.auto.value:auto-value:1.10.1",
7562
"com.google.auto.value:auto-value-annotations:1.10.1",
76-
"com.google.dagger:dagger:2.51",
77-
"com.google.dagger:dagger-compiler:2.51",
78-
"com.google.dagger:dagger-producers:2.51",
63+
"com.google.dagger:dagger:2.53.1",
64+
"com.google.dagger:dagger-compiler:2.53.1",
65+
"com.google.dagger:dagger-producers:2.53.1",
7966
"javax.annotation:javax.annotation-api:1.3.2",
8067
"javax.inject:javax.inject:1",
8168
"org.apache.commons:commons-compress:1.26.2",

WORKSPACE.dev.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ load("//kotlin:repositories.bzl", "kotlin_repositories")
2121

2222
kotlin_repositories()
2323

24+
register_toolchains("//src/main/starlark/core/compile/cli")
25+
2426
register_toolchains("@rules_kotlin//kotlin/internal:default_toolchain")
2527

2628
android_sdk_repository(name = "androidsdk")

docs/kotlin.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -376,16 +376,15 @@ Define java compiler options for `kt_jvm_*` rules with java sources.
376376
<pre>
377377
load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options")
378378

379-
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>,
380-
<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>,
381-
<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>,
379+
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_assertions">x_assertions</a>,
380+
<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>,
382381
<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>,
383382
<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>,
384383
<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>,
385-
<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>,
386-
<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>,
387-
<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>,
388-
<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>)
384+
<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>,
385+
<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>,
386+
<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>,
387+
<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>)
389388
</pre>
390389

391390
Define kotlin compiler options.
@@ -398,9 +397,8 @@ Define kotlin compiler options.
398397
| <a id="kt_kotlinc_options-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
399398
| <a id="kt_kotlinc_options-include_stdlibs"></a>include_stdlibs | Don't automatically include the Kotlin standard libraries into the classpath (stdlib and reflect). | String | optional | `"all"` |
400399
| <a id="kt_kotlinc_options-java_parameters"></a>java_parameters | Generate metadata for Java 1.8+ reflection on method parameters. | Boolean | optional | `False` |
401-
| <a id="kt_kotlinc_options-jvm_target"></a>jvm_target | The -jvm_target flag. This is only tested at 1.8. | String | optional | `""` |
400+
| <a id="kt_kotlinc_options-jvm_target"></a>jvm_target | The target version of the generated JVM bytecode | String | optional | `""` |
402401
| <a id="kt_kotlinc_options-warn"></a>warn | Control warning behaviour. | String | optional | `"report"` |
403-
| <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` |
404402
| <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 | `""` |
405403
| <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` |
406404
| <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` |
@@ -409,15 +407,14 @@ Define kotlin compiler options.
409407
| <a id="kt_kotlinc_options-x_enable_incremental_compilation"></a>x_enable_incremental_compilation | Enable incremental compilation | Boolean | optional | `False` |
410408
| <a id="kt_kotlinc_options-x_explicit_api_mode"></a>x_explicit_api_mode | Enable explicit API mode for Kotlin libraries. | String | optional | `"off"` |
411409
| <a id="kt_kotlinc_options-x_inline_classes"></a>x_inline_classes | Enable experimental inline classes | Boolean | optional | `False` |
412-
| <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 | `""` |
410+
| <a id="kt_kotlinc_options-x_jdk_release"></a>x_jdk_release | Compile against the specified JDK API version, similarly to javac's '-release'. This requires JDK 9 or newer. The supported versions depend on the JDK used; for JDK 17+, the supported versions are 1.8 and 9–21. This also sets the value of '-jvm-target' to be equal to the selected JDK version. | String | optional | `""` |
413411
| <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 | `""` |
414412
| <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 | `""` |
415413
| <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"` |
416414
| <a id="kt_kotlinc_options-x_lambdas"></a>x_lambdas | Change codegen behavior of lambdas | String | optional | `"class"` |
417415
| <a id="kt_kotlinc_options-x_multi_platform"></a>x_multi_platform | Enable experimental language support for multi-platform projects | Boolean | optional | `False` |
418416
| <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` |
419417
| <a id="kt_kotlinc_options-x_no_optimize"></a>x_no_optimize | Disable optimizations | Boolean | optional | `False` |
420-
| <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` |
421418
| <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` |
422419
| <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` |
423420
| <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` |
@@ -579,8 +576,8 @@ Call this in the WORKSPACE file to setup the Kotlin rules.
579576
| <a id="kotlin_repositories-is_bzlmod"></a>is_bzlmod | <p align="center"> - </p> | `False` |
580577
| <a id="kotlin_repositories-compiler_repository_name"></a>compiler_repository_name | for the kotlinc compiler repository. | `"com_github_jetbrains_kotlin"` |
581578
| <a id="kotlin_repositories-ksp_repository_name"></a>ksp_repository_name | <p align="center"> - </p> | `"com_github_google_ksp"` |
582-
| <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")` |
583-
| <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")` |
579+
| <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")` |
580+
| <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")` |
584581

585582

586583
<a id="versions.use_repository"></a>

examples/android/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ maven.install(
1818
"junit:junit:4.12",
1919
"androidx.test.espresso:espresso-core:3.1.1",
2020
"org.hamcrest:hamcrest-library:1.3",
21-
"org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc",
21+
"org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3",
2222
"com.squareup.moshi:moshi:1.14.0",
2323
"com.squareup.moshi:moshi-kotlin:1.14.0",
2424
"com.squareup.moshi:moshi-kotlin-codegen:1.14.0",

examples/android/WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ maven_install(
4343
"junit:junit:4.12",
4444
"androidx.test.espresso:espresso-core:3.1.1",
4545
"org.hamcrest:hamcrest-library:1.3",
46-
"org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc",
46+
"org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3",
4747
"com.squareup.moshi:moshi:1.14.0",
4848
"com.squareup.moshi:moshi-kotlin:1.14.0",
4949
"com.squareup.moshi:moshi-kotlin-codegen:1.14.0",

examples/android/libKtAndroid/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ kt_android_library(
4747
"@maven//:androidx_appcompat_appcompat",
4848
"@maven//:com_google_auto_value_auto_value_annotations",
4949
"@maven//:com_squareup_moshi_moshi",
50-
"@maven//:org_jetbrains_kotlinx_kotlinx_serialization_runtime",
50+
"@maven//:org_jetbrains_kotlinx_kotlinx_serialization_core",
5151
],
5252
)
5353

examples/associates/WORKSPACE

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ kt_register_toolchains()
1616

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

19-
http_archive(
20-
name = "rules_android",
21-
sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
22-
strip_prefix = "rules_android-0.1.1",
23-
urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"],
24-
)
25-
2619
http_archive(
2720
name = "bazel_skylib",
2821
sha256 = versions.SKYLIB_SHA,
@@ -52,9 +45,3 @@ maven_install(
5245
"https://repo1.maven.org/maven2",
5346
],
5447
)
55-
56-
http_archive(
57-
name = "rules_pkg",
58-
sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
59-
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
60-
)

examples/associates/projects/core/api/src/main/kotlin/core/api/api.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ data class MyType(
1212
}
1313

1414
internal fun String.camelCase() = this.split("_").joinToString("") {
15-
"${it[0].toUpperCase()}${it.substring(1)}"
15+
"${it[0].uppercase()}${it.substring(1)}"
1616
}

examples/deps/.bazelrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
common --incompatible_enable_android_toolchain_resolution
2-
common --android_platforms=//:arm64-v8a
2+
common --enable_workspace=true
3+
common --enable_bzlmod=false
4+
common --android_platforms=//:arm64-v8a
5+
common --toolchain_resolution_debug=.*

examples/deps/WORKSPACE

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ http_archive(
77
)
88

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

1112
kotlin_repositories()
1213

13-
register_toolchains("//bzl:experimental_toolchain")
14-
15-
load("@rules_kotlin//src/main/starlark/core/repositories:versions.bzl", "versions")
16-
1714
http_archive(
1815
name = "bazel_skylib",
1916
sha256 = versions.SKYLIB_SHA,
@@ -37,24 +34,17 @@ load("@rules_jvm_external//:defs.bzl", "maven_install")
3734

3835
maven_install(
3936
artifacts = [
40-
"androidx.appcompat:appcompat:1.0.0",
41-
"junit:junit:4.12",
42-
"androidx.test.espresso:espresso-core:3.1.1",
43-
"org.hamcrest:hamcrest-library:1.3",
44-
"org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc",
45-
"com.google.dagger:dagger:2.45",
46-
"com.google.dagger:dagger-compiler:2.45",
47-
"com.google.dagger:dagger-producers:2.45",
4837
"com.google.auto.value:auto-value:1.6.5",
4938
"com.google.auto.value:auto-value-annotations:1.6.5",
50-
"org.robolectric:robolectric:4.7.3",
5139
],
5240
repositories = [
5341
"https://maven.google.com",
5442
"https://repo1.maven.org/maven2",
5543
],
5644
)
5745

46+
register_toolchains("//bzl:experimental_toolchain")
47+
5848
http_archive(
5949
name = "rules_android",
6050
sha256 = versions.ANDROID.SHA,
@@ -70,13 +60,3 @@ load(
7060
android_sdk_repository(
7161
name = "androidsdk",
7262
)
73-
74-
http_archive(
75-
name = "robolectric",
76-
strip_prefix = "robolectric-bazel-4.7.3",
77-
urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.7.3.tar.gz"],
78-
)
79-
80-
load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")
81-
82-
robolectric_repositories()

examples/deps/bzl/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ kt_javac_options(
99
name = "default_javac_options",
1010
)
1111

12-
KOTLIN_LANGUAGE_LEVEL = "1.6"
12+
KOTLIN_LANGUAGE_LEVEL = "2.1"
1313

1414
define_kt_toolchain(
1515
name = "experimental_toolchain",

examples/jetpack_compose/.bazelrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@ build --define=android_dexmerger_tool=d8_dexmerger
44
# Flags for the D8 dexer
55
build --define=android_incremental_dexing_tool=d8_dexbuilder
66
build --define=android_standalone_dexing_tool=d8_compat_dx
7+
8+
common --enable_workspace=true --enable_bzlmod=false
9+
common --noincompatible_enable_android_toolchain_resolution
10+
build --platform_mappings=platform_mappings
11+
build --fat_apk_cpu arm64-v8a
12+
# Uncomment the below lines to build for x86
13+
# build --fat_apk_cpu x86_64
14+
build --android_crosstool_top=@androidndk//:toolchain
15+
build --@rules_kotlin//kotlin/settings:jvm_emit_jdeps=False

examples/jetpack_compose/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@ platform(
3333
"@platforms//os:android",
3434
],
3535
)
36+
37+
platform(
38+
name = "x86_64",
39+
constraint_values = [
40+
"@platforms//cpu:x86_64",
41+
"@platforms//os:android",
42+
],
43+
)

0 commit comments

Comments
 (0)