Skip to content

Commit

Permalink
Update rules_jvm_external to latest (5.3) (#360)
Browse files Browse the repository at this point in the history
For bazelbuild/bazel#17032 (eliminate
dependencies on `cfg = "host"`)
  • Loading branch information
gregestren authored Dec 8, 2023
1 parent b498bb1 commit ca3f576
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 126 deletions.
5 changes: 4 additions & 1 deletion .bazelci/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ common:
- "--noincompatible_enable_android_toolchain_resolution"
- "--fat_apk_cpu=arm64-v8a,x86"
- "--android_crosstool_top=@androidndk//:toolchain"
- "--enable_bzlmod"
build_targets:
- "//app/src/main:app"
android-jetpack: &android-jetpack
Expand All @@ -29,15 +30,17 @@ common:
build_flags:
- "--noincompatible_enable_android_toolchain_resolution"
- "--remote_download_outputs=all"
- "--enable_bzlmod"
build_targets:
- "//app/src/main:app"
android-robolectric: &android-robolectric
name: "Android Robolectric Testing"
# Cannot upgrade this until rules_kotlin is compatible.
bazel: 6.3.2
working_directory: ../android/robolectric-testing
build_flags:
test_flags:
- "--noincompatible_enable_android_toolchain_resolution"
- "--enable_bzlmod"
test_targets:
- "//app:test"

Expand Down
7 changes: 4 additions & 3 deletions android/firebase-cloud-messaging/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ android_sdk_repository(name = "androidsdk")

android_ndk_repository(name = "androidndk")

RULES_JVM_EXTERNAL_TAG = "2.9"
RULES_JVM_EXTERNAL_TAG = "5.3"

RULES_JVM_EXTERNAL_SHA = "e5b97a31a3e8feed91636f42e19b11c49487b85e5de2f387c999ea14d77c7f45"
RULES_JVM_EXTERNAL_SHA = "d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac"

http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
url =
"https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG)
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
38 changes: 38 additions & 0 deletions android/jetpack-compose/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"Bazel dependencies"

bazel_dep(name = "platforms", version = "0.0.6")
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.5.1",
# Jetpack Compose Dependencies
"androidx.activity:activity-compose:1.6.0",
"androidx.compose.material:material:1.2.1",
"androidx.compose.ui:ui:1.2.1",
"androidx.compose.ui:ui-tooling:1.2.1",
"androidx.compose.compiler:compiler:1.3.2",
"androidx.compose.runtime:runtime:1.2.1",
# Dependencies needed to manage version conflicts
"androidx.core:core:1.6.0",
"androidx.core:core-ktx:1.6.0",
"androidx.savedstate:savedstate-ktx:1.2.0",
"androidx.savedstate:savedstate:1.2.0",
"androidx.lifecycle:lifecycle-livedata-core-ktx:2.5.1",
"androidx.lifecycle:lifecycle-livedata-core:2.5.1",
"androidx.lifecycle:lifecycle-livedata:2.5.1",
"androidx.lifecycle:lifecycle-process:2.5.1",
"androidx.lifecycle:lifecycle-runtime-ktx:2.5.1",
"androidx.lifecycle:lifecycle-runtime:2.5.1",
"androidx.lifecycle:lifecycle-service:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel:2.5.1",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
use_repo(maven, "maven")
49 changes: 2 additions & 47 deletions android/jetpack-compose/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,6 @@ _KOTLIN_COMPILER_VERSION = "1.7.20"

_KOTLIN_COMPILER_SHA = "5e3c8d0f965410ff12e90d6f8dc5df2fc09fd595a684d514616851ce7e94ae7d"

## rules_jvm_external

http_archive(
name = "rules_jvm_external",
sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
strip_prefix = "rules_jvm_external-4.2",
url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.2.zip",
)

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
name = "maven",
artifacts = [
"androidx.appcompat:appcompat:1.5.1",
# Jetpack Compose Dependencies
"androidx.activity:activity-compose:1.6.0",
"androidx.compose.material:material:1.2.1",
"androidx.compose.ui:ui:1.2.1",
"androidx.compose.ui:ui-tooling:1.2.1",
"androidx.compose.compiler:compiler:1.3.2",
"androidx.compose.runtime:runtime:1.2.1",
# Dependencies needed to manage version conflicts
"androidx.core:core:1.6.0",
"androidx.core:core-ktx:1.6.0",
"androidx.savedstate:savedstate-ktx:1.2.0",
"androidx.savedstate:savedstate:1.2.0",
"androidx.lifecycle:lifecycle-livedata-core-ktx:2.5.1",
"androidx.lifecycle:lifecycle-livedata-core:2.5.1",
"androidx.lifecycle:lifecycle-livedata:2.5.1",
"androidx.lifecycle:lifecycle-process:2.5.1",
"androidx.lifecycle:lifecycle-runtime-ktx:2.5.1",
"androidx.lifecycle:lifecycle-runtime:2.5.1",
"androidx.lifecycle:lifecycle-service:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel:2.5.1",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

## Android

http_archive(
Expand All @@ -62,9 +18,7 @@ http_archive(

load("@build_bazel_rules_android//android:rules.bzl", "android_sdk_repository")

android_sdk_repository(
name = "androidsdk",
)
android_sdk_repository(name = "androidsdk")

## Kotlin

Expand All @@ -86,3 +40,4 @@ kotlin_repositories(
load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")

kt_register_toolchains()

27 changes: 27 additions & 0 deletions android/ndk/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"Bazel dependencies"

bazel_dep(name = "platforms", version = "0.0.6")
bazel_dep(name = "rules_android", version = "0.1.1")
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.5.1",
"androidx.constraintlayout:constraintlayout:2.1.4",
# Needed to enforce version conflict resolution
"androidx.savedstate:savedstate:1.2.0",
"androidx.lifecycle:lifecycle-livedata-core:2.5.1",
"androidx.lifecycle:lifecycle-livedata:2.5.1",
"androidx.lifecycle:lifecycle-process:2.5.1",
"androidx.lifecycle:lifecycle-runtime:2.5.1",
"androidx.lifecycle:lifecycle-service:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel:2.5.1",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
use_repo(maven, "maven")
45 changes: 2 additions & 43 deletions android/ndk/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
# FIXME(alexeagle): move to bzlmod
workspace(name = "bazel_android_sample_project")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

## rules_jvm_external

http_archive(
name = "rules_jvm_external",
sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
strip_prefix = "rules_jvm_external-4.2",
url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.2.zip",
)

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
name = "maven",
artifacts = [
"androidx.appcompat:appcompat:1.5.1",
"androidx.constraintlayout:constraintlayout:2.1.4",
# Needed to enforce version conflict resolution
"androidx.savedstate:savedstate:1.2.0",
"androidx.lifecycle:lifecycle-livedata-core:2.5.1",
"androidx.lifecycle:lifecycle-livedata:2.5.1",
"androidx.lifecycle:lifecycle-process:2.5.1",
"androidx.lifecycle:lifecycle-runtime:2.5.1",
"androidx.lifecycle:lifecycle-service:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel:2.5.1",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

## Android

http_archive(
name = "build_bazel_rules_android",
sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
Expand All @@ -46,9 +9,7 @@ http_archive(

load("@build_bazel_rules_android//android:rules.bzl", "android_sdk_repository")

android_sdk_repository(
name = "androidsdk",
)
android_sdk_repository(name = "androidsdk")

http_archive(
name = "rules_android_ndk",
Expand All @@ -59,6 +20,4 @@ http_archive(

load("@rules_android_ndk//:rules.bzl", "android_ndk_repository")

android_ndk_repository(
name = "androidndk",
)
android_ndk_repository(name = "androidndk")
2 changes: 1 addition & 1 deletion android/ndk/app/src/main/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@build_bazel_rules_android//android:rules.bzl", "android_binary", "android_library")
load("@rules_android//android:rules.bzl", "android_binary", "android_library")
load("@rules_cc//cc:defs.bzl", "cc_library")

android_library(
Expand Down
23 changes: 23 additions & 0 deletions android/robolectric-testing/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"Bazel dependencies"

bazel_dep(name = "platforms", version = "0.0.6")
bazel_dep(name = "rules_jvm_external", version = "5.3")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
"org.robolectric:robolectric:4.9",
"junit:junit:4.13.2",
"com.google.truth:truth:1.1.3",
"org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10",
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10",
"org.jetbrains.kotlin:kotlin-stdlib:1.7.10",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

use_repo(maven, "maven")
32 changes: 1 addition & 31 deletions android/robolectric-testing/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,6 @@ workspace(name = "bazel_android_sample_project")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

## rules_jvm_external

http_archive(
name = "rules_jvm_external",
sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
strip_prefix = "rules_jvm_external-4.2",
url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.2.zip",
)

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
name = "maven",
artifacts = [
"org.robolectric:robolectric:4.9",
"junit:junit:4.13.2",
"com.google.truth:truth:1.1.3",
"org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10",
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10",
"org.jetbrains.kotlin:kotlin-stdlib:1.7.10",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

## Android

http_archive(
Expand All @@ -42,9 +14,7 @@ http_archive(

load("@build_bazel_rules_android//android:rules.bzl", "android_sdk_repository")

android_sdk_repository(
name = "androidsdk",
)
android_sdk_repository(name = "androidsdk")

## Kotlin

Expand Down

0 comments on commit ca3f576

Please sign in to comment.