diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 68ee6f5a6..b2efe666d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -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: diff --git a/examples/android/.bazelrc b/examples/android/.bazelrc new file mode 100644 index 000000000..96cefad8a --- /dev/null +++ b/examples/android/.bazelrc @@ -0,0 +1 @@ +common --lockfile_mode=off \ No newline at end of file diff --git a/examples/android/.bazelversion b/examples/android/.bazelversion deleted file mode 120000 index 96cf94962..000000000 --- a/examples/android/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -../../.bazelversion \ No newline at end of file diff --git a/examples/android/.bazelversion b/examples/android/.bazelversion new file mode 100644 index 000000000..2cc9f53b4 --- /dev/null +++ b/examples/android/.bazelversion @@ -0,0 +1 @@ +7.0.0-pre.20230906.2 diff --git a/examples/android/MODULE.bazel b/examples/android/MODULE.bazel new file mode 100644 index 000000000..fb7893c3e --- /dev/null +++ b/examples/android/MODULE.bazel @@ -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") diff --git a/examples/android/WORKSPACE b/examples/android/WORKSPACE index 2067bc9ad..b1f3a7def 100644 --- a/examples/android/WORKSPACE +++ b/examples/android/WORKSPACE @@ -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", @@ -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") diff --git a/examples/android/WORKSPACE.bzlmod b/examples/android/WORKSPACE.bzlmod new file mode 100644 index 000000000..1754a3eee --- /dev/null +++ b/examples/android/WORKSPACE.bzlmod @@ -0,0 +1,3 @@ +android_sdk_repository(name = "androidsdk") + +android_ndk_repository(name = "androidndk")