Skip to content

Commit 21ae65f

Browse files
committed
Get the compose example building again
1 parent e38710a commit 21ae65f

File tree

3 files changed

+594
-1187
lines changed

3 files changed

+594
-1187
lines changed

examples/jetpack_compose/WORKSPACE

Lines changed: 18 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ http_archive(
66
url = "https://github.com/bazelbuild/rules_kotlin/releases/download/v1.9.5/rules_kotlin-v1.9.5.tar.gz",
77
)
88

9-
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version", "versions")
9+
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions")
1010

1111
http_archive(
1212
name = "rules_jvm_external",
@@ -23,16 +23,10 @@ http_archive(
2323
)
2424

2525
http_archive(
26-
name = "rules_java",
27-
sha256 = versions.RULES_JAVA.sha256,
28-
urls = [url.format(version = versions.RULES_JAVA.version) for url in versions.RULES_JAVA.url_templates],
29-
)
30-
31-
http_archive(
32-
name = "bazel_features",
33-
sha256 = versions.BAZEL_FEATURES.sha256,
34-
strip_prefix = versions.BAZEL_FEATURES.strip_prefix_template.format(version = versions.BAZEL_FEATURES.version),
35-
urls = [url.format(version = versions.BAZEL_FEATURES.version) for url in versions.BAZEL_FEATURES.url_templates],
26+
name = "robolectric",
27+
sha256 = "b2d2164bae80fcfbdd078eb2f0935ba06557402b8c814928d9e3bec7358e2b7b",
28+
strip_prefix = "robolectric-bazel-4.14.1.2",
29+
urls = ["https://github.com/robolectric/robolectric-bazel/releases/download/4.14.1.2/robolectric-bazel-4.14.1.2.tar.gz"],
3630
)
3731

3832
http_archive(
@@ -41,10 +35,6 @@ http_archive(
4135
urls = [url.format(version = versions.BAZEL_SKYLIB.version) for url in versions.BAZEL_SKYLIB.url_templates],
4236
)
4337

44-
load("@bazel_features//:deps.bzl", "bazel_features_deps")
45-
46-
bazel_features_deps()
47-
4838
# Android rules dependencies
4939
load("@rules_android//:prereqs.bzl", "rules_android_prereqs")
5040

@@ -90,36 +80,18 @@ register_toolchains(
9080
"@rules_android//toolchains/android_sdk:android_sdk_tools",
9181
)
9282

93-
KOTLINC_RELEASE = versions.KOTLIN_CURRENT_COMPILER_RELEASE
94-
95-
kotlin_repositories(
96-
compiler_release = kotlinc_version(
97-
release = "2.1.20",
98-
sha256 = "a118197b0de55ffab2bc8d5cd03a5e39033cfb53383d6931bc761dec0784891a",
99-
) if KOTLINC_RELEASE.version == "1.9.22" else kotlinc_version(
100-
release = KOTLINC_RELEASE.version,
101-
sha256 = KOTLINC_RELEASE.sha256,
102-
),
103-
)
83+
kotlin_repositories()
10484

10585
load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
10686

10787
kt_register_toolchains()
10888

109-
register_toolchains("//:kotlin_toolchain")
110-
111-
KOTLIN_TO_COMPOSE = {
112-
"1.9.22": [
113-
"org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.0.0",
114-
"androidx.core:core-ktx:1.7.0",
115-
"androidx.appcompat:appcompat:1.4.1",
116-
"androidx.activity:activity-compose:1.3.0",
117-
"androidx.compose.material:material:1.2.1",
118-
"androidx.compose.ui:ui:1.2.1",
119-
"androidx.compose.ui:ui-tooling:1.2.1",
120-
"androidx.compose.runtime:runtime:1.2.1",
121-
],
122-
"2.1.20": [
89+
load("@rules_jvm_external//:defs.bzl", "maven_install")
90+
91+
maven_install(
92+
name = "maven_rules_kotlin_example",
93+
aar_import_bzl_label = "@rules_android//rules:rules.bzl",
94+
artifacts = [
12395
"org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.1.20",
12496
"androidx.core:core-ktx:1.15.0",
12597
"androidx.appcompat:appcompat:1.7.0",
@@ -130,24 +102,20 @@ KOTLIN_TO_COMPOSE = {
130102
"androidx.compose.ui:ui-tooling:1.7.6",
131103
"androidx.compose.runtime:runtime:1.7.6",
132104
],
133-
}
134-
135-
load("@rules_jvm_external//:defs.bzl", "maven_install")
136-
137-
maven_install(
138-
name = "maven_rules_kotlin_example",
139-
aar_import_bzl_label = "@rules_android//rules:rules.bzl",
140-
artifacts = KOTLIN_TO_COMPOSE[KOTLINC_RELEASE.version],
141105
fetch_sources = True,
142-
maven_install_json = "//:maven_install-%s.json" % KOTLINC_RELEASE.version,
106+
maven_install_json = "//:maven_install.json",
143107
repositories = [
144108
"https://maven.google.com",
145109
"https://repo1.maven.org/maven2",
146110
],
147-
resolver = "coursier" if KOTLINC_RELEASE.version == "1.9.22" else "maven",
111+
resolver = "maven",
148112
use_starlark_android_rules = True,
149113
)
150114

151115
load("@maven_rules_kotlin_example//:defs.bzl", "pinned_maven_install")
152116

153117
pinned_maven_install()
118+
119+
load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")
120+
121+
robolectric_repositories()

0 commit comments

Comments
 (0)