Skip to content

Commit

Permalink
Fix AccessibilitySample build (android#309)
Browse files Browse the repository at this point in the history
* Fix AccessibilitySample build

* Update and jetify
  • Loading branch information
jin authored Feb 16, 2020
1 parent a2f1e85 commit 8ae5237
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
10 changes: 8 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ android_test_repositories()

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

RULES_JVM_EXTERNAL_TAG = "2.1"
RULES_JVM_EXTERNAL_SHA = "515ee5265387b88e4547b34a57393d2bcb1101314bcc5360ec7a482792556f42"

RULES_JVM_EXTERNAL_TAG = "3.1"
RULES_JVM_EXTERNAL_SHA = "e246373de2353f3d34d35814947aa8b7d0dd1a58c2f7a6c41cfeaff3007c2d14"

http_archive(
name = "rules_jvm_external",
Expand Down Expand Up @@ -60,6 +61,7 @@ maven_install(
"androidx.core:core:" + androidxLibVersion,
"androidx.recyclerview:recyclerview:" + androidxLibVersion,
"androidx.test:core:" + coreVersion,
"androidx.test.espresso:espresso-accessibility:" + espressoVersion,
"androidx.test.espresso:espresso-contrib:" + espressoVersion,
"androidx.test.espresso:espresso-core:" + espressoVersion,
"androidx.test.espresso:espresso-idling-resource:" + espressoVersion,
Expand All @@ -70,6 +72,7 @@ maven_install(
"androidx.test:rules:" + rulesVersion,
"androidx.test:runner:" + runnerVersion,
"androidx.test.uiautomator:uiautomator:" + uiAutomatorVersion,
"androidx.viewpager:viewpager:1.0.0",
maven.artifact("com.google.inject", "guice", "4.0", neverlink = True),
"junit:junit:4.12",
"javax.inject:javax.inject:1",
Expand All @@ -83,9 +86,12 @@ maven_install(
),
"com.google.guava:guava:26.0-android",
"com.google.truth:truth:0.42",
"com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.0",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
jetify = True,
version_conflict_policy = "pinned",
)
7 changes: 7 additions & 0 deletions bazelci/buildkite-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ platforms:
- "--spawn_strategy=standalone" # Reduce flakes.
test_targets:
- "//..."
- "-//ui/espresso/AccessibilitySample/..."
ubuntu1804:
build_targets:
- "//..."
Expand All @@ -19,6 +20,7 @@ platforms:
- "--spawn_strategy=standalone" # Reduce flakes.
test_targets:
- "//..."
- "-//ui/espresso/AccessibilitySample/..."
macos:
# Testing does not work for macos and windows yet
build_targets: # Results of `bazel query 'kind(android_binary, //...)'
Expand All @@ -40,6 +42,8 @@ platforms:
- "//ui/espresso/CustomMatcherSample:CustomMatcherSample"
- "//ui/espresso/BasicSample:BasicSampleTest"
- "//ui/espresso/BasicSample:BasicSample"
- "//ui/espresso/AccessibilitySample:BasicSampleTest"
- "//ui/espresso/AccessibilitySample:BasicSample"
windows:
build_targets: # Results of `bazel query 'kind(android_binary, //...)'
- "//ui/uiautomator/BasicSample:BasicSampleTest"
Expand All @@ -60,3 +64,6 @@ platforms:
- "//ui/espresso/CustomMatcherSample:CustomMatcherSample"
- "//ui/espresso/BasicSample:BasicSampleTest"
- "//ui/espresso/BasicSample:BasicSample"
- "//ui/espresso/AccessibilitySample:BasicSampleTest"
- "//ui/espresso/AccessibilitySample:BasicSample"

18 changes: 13 additions & 5 deletions ui/espresso/AccessibilitySample/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ load("@rules_jvm_external//:defs.bzl", "artifact")
android_library(
name = "BasicSampleLib",
srcs = glob(["app/src/main/**/*.java"]),
custom_package = "com.example.android.testing.espresso.BasicSample",
custom_package = "com.example.android.testing.espresso.AccessibilitySample",
manifest = "app/src/main/AndroidManifest.xml",
resource_files = glob(["app/src/main/res/**/*"]),
deps = [
Expand All @@ -16,7 +16,7 @@ android_library(

android_binary(
name = "BasicSample",
custom_package = "com.example.android.testing.espresso.BasicSample",
custom_package = "com.example.android.testing.espresso.AccessibilitySample",
manifest = "app/src/main/AppManifest.xml",
manifest_values = {
"minSdkVersion": minSdkVersion,
Expand All @@ -28,23 +28,31 @@ android_binary(
android_library(
name = "BasicSampleTestLib",
srcs = glob(["app/src/androidTest/**/*.java"]),
custom_package = "com.example.android.testing.espresso.BasicSample.test",
custom_package = "com.example.android.testing.espresso.AccessibilitySample.test",
deps = [
artifact("androidx.viewpager:viewpager"),
artifact("androidx.test.espresso:espresso-accessibility"),
artifact("com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework"),
":BasicSampleLib",
"//:test_deps",
],
)

android_binary(
name = "BasicSampleTest",
custom_package = "com.example.android.testing.espresso.BasicSample.test",
custom_package = "com.example.android.testing.espresso.AccessibilitySample.test",
instruments = ":BasicSample",
manifest = "app/src/androidTest/AndroidManifest.xml",
manifest_values = {
"minSdkVersion": minSdkVersion,
"targetSdkVersion": targetSdkVersion,
},
deps = [":BasicSampleTestLib"],
deps = [
artifact("androidx.viewpager:viewpager"),
artifact("androidx.test.espresso:espresso-accessibility"),
artifact("com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework"),
":BasicSampleTestLib",
],
)

API_LEVELS = [
Expand Down

0 comments on commit 8ae5237

Please sign in to comment.