Skip to content

Commit

Permalink
Enable Bzlmod for examples/android (#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bencodes authored Sep 29, 2023
1 parent 58a71d7 commit 43a6269
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ tasks:
name: "Example - Android"
platform: ubuntu1804
working_directory: examples/android
bazel: 7.0.0-pre.20230906.2
test_flags:
- "--enable_bzlmod=false"
test_targets:
- //...
example-bzlmod-android:
name: "Example Bzlmod - Android"
platform: ubuntu1804
working_directory: examples/android
bazel: 7.0.0-pre.20230906.2
test_flags:
- "--enable_bzlmod=true"
test_targets:
- //...
example-ksp:
Expand Down
1 change: 1 addition & 0 deletions examples/android/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
common --lockfile_mode=off
1 change: 0 additions & 1 deletion examples/android/.bazelversion

This file was deleted.

1 change: 1 addition & 0 deletions examples/android/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0-pre.20230906.2
41 changes: 41 additions & 0 deletions examples/android/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module(name = "android-example")

remote_android_extensions = use_extension("@bazel_tools//tools/android:android_extensions.bzl", "remote_android_tools_extensions")
use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

bazel_dep(name = "rules_android", version = "0.1.1", repo_name = "build_bazel_rules_android")
bazel_dep(name = "bazel_skylib", version = "1.2.1")
bazel_dep(name = "rules_robolectric", version = "4.10.3", repo_name = "robolectric")
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 = "5.3")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
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.squareup.moshi:moshi:1.14.0",
"com.squareup.moshi:moshi-kotlin:1.14.0",
"com.squareup.moshi:moshi-kotlin-codegen:1.14.0",
"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.10.3",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
use_repo(maven, "maven")
7 changes: 4 additions & 3 deletions examples/android/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ maven_install(
"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.8.1",
"org.robolectric:robolectric:4.10.3",
],
repositories = [
"https://maven.google.com",
Expand All @@ -80,8 +80,9 @@ android_sdk_repository(name = "androidsdk")

http_archive(
name = "robolectric",
strip_prefix = "robolectric-bazel-4.8.1",
urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.8.1.tar.gz"],
sha256 = "1b199a932cbde4af728dd8275937091adbb89a4bf63d326de49e6d0a42e723bf",
strip_prefix = "robolectric-bazel-4.10.3",
urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.10.3.tar.gz"],
)

load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")
Expand Down
3 changes: 3 additions & 0 deletions examples/android/WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
android_sdk_repository(name = "androidsdk")

android_ndk_repository(name = "androidndk")

0 comments on commit 43a6269

Please sign in to comment.