Skip to content

Commit bcf8265

Browse files
brettchabotcopybara-androidxtest
authored andcommitted
Change androidx_test targets to default to testonly = 1.
multiprocess onClick definitions were also moved from xml to java to placate a lint check. PiperOrigin-RevId: 737765858
1 parent be0d60b commit bcf8265

File tree

173 files changed

+533
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+533
-191
lines changed

build_extensions/kt_android_library.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33

44
load("@io_bazel_rules_kotlin//kotlin:android.bzl", io_kt_android_library = "kt_android_library")
55

6-
def kt_android_library(**kwargs):
7-
io_kt_android_library(**kwargs)
6+
def kt_android_library(testonly = 1, **kwargs):
7+
# explicitly set testonly to 1 because io_kt_android_library doesn't seem to respect package(default_testonly = 1)
8+
io_kt_android_library(testonly = testonly, **kwargs)

core/BUILD

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Publicly visible androidx.test.core API library
22

3-
package(default_applicable_licenses = ["//:license"])
3+
package(
4+
default_applicable_licenses = ["//:license"],
5+
default_testonly = 1,
6+
)
47

58
licenses(["notice"])
69

710
alias(
811
name = "core",
9-
testonly = 1,
1012
actual = "//core/java/androidx/test/core",
1113
visibility = ["//visibility:public"],
1214
)
@@ -16,7 +18,6 @@ alias(
1618
# for the bootstrap activities
1719
alias(
1820
name = "manifest",
19-
testonly = 1,
2021
actual = "//core/java/androidx/test/core:manifest",
2122
visibility = ["//visibility:public"],
2223
)

core/java/androidx/test/core/BUILD

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ load("//build_extensions/maven:maven_artifact.bzl", "maven_artifact")
1010
# all users should reference the equivalent targets in //core
1111
package(
1212
default_applicable_licenses = ["//:license"],
13+
default_testonly = 1,
1314
default_visibility = [
1415
":allowlist",
1516
],
@@ -29,13 +30,15 @@ licenses(["notice"])
2930
# for the bootstrap activities
3031
android_library(
3132
name = "manifest",
33+
testonly = 0,
3234
exports_manifest = 1,
3335
manifest = "AndroidManifest.xml",
3436
resource_files = glob(["res/**"]),
3537
)
3638

3739
kt_android_library(
3840
name = "core_internal",
41+
testonly = 0,
3942
srcs = glob(
4043
[
4144
"**/*.java",
@@ -59,20 +62,19 @@ kt_android_library(
5962
# TODO(b/199522848): delete these targets once espresso moves to testonly
6063
android_library(
6164
name = "core",
62-
testonly = 1,
6365
exports = [":core_internal"],
6466
)
6567

6668
android_library(
6769
name = "core_not_test_only",
70+
testonly = 0,
6871
visibility = ["//espresso/core/java/androidx/test/espresso:__subpackages__"],
6972
exports = [":core_internal"],
7073
)
7174

7275
# kt_android_library does not produce an aar, so wrap in a android_library for release
7376
android_library(
7477
name = "core_aar_lib",
75-
testonly = 1,
7678
manifest = "AndroidManifest.xml",
7779
resource_files = glob(["res/**"]),
7880
visibility = ["//visibility:private"],
@@ -90,7 +92,6 @@ alias(
9092
# Generate rules for the release artifacts.
9193
axt_android_aar(
9294
name = "core_aar",
93-
testonly = 1,
9495
expected_class_prefixes = [
9596
"androidx.test.core",
9697
],
@@ -99,7 +100,6 @@ axt_android_aar(
99100

100101
maven_artifact(
101102
name = "core_maven_artifact",
102-
testonly = 1,
103103
last_updated = "20180403000000",
104104
target = ":core_aar",
105105
)

core/javatests/androidx/test/core/app/testing/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ licenses(["notice"])
1212

1313
kt_android_library(
1414
name = "testing",
15-
testonly = 1,
1615
srcs = glob([
1716
"**/*.java",
1817
"**/*.kt",

espresso/BUILD

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
load("@rules_license//rules:license.bzl", "license")
22

3-
package(default_applicable_licenses = ["//espresso:license"])
3+
package(
4+
default_applicable_licenses = ["//espresso:license"],
5+
default_testonly = 1,
6+
)
47

58
license(
69
name = "license",

espresso/accessibility/java/androidx/test/espresso/accessibility/BUILD

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ licenses(["notice"])
1010

1111
package(
1212
default_applicable_licenses = ["//espresso:license"],
13+
default_testonly = 1,
1314
default_visibility = ["//:__subpackages__"],
1415
)
1516

1617
android_library(
1718
name = "accessibility_checks",
18-
testonly = 1,
1919
srcs = [
2020
"AccessibilityChecks.java",
2121
],
@@ -31,7 +31,6 @@ android_library(
3131

3232
axt_android_aar(
3333
name = "accessibility_checks_aar",
34-
testonly = 1,
3534
expected_class_prefixes = [
3635
"androidx.test.espresso.accessibility",
3736
],
@@ -40,7 +39,6 @@ axt_android_aar(
4039

4140
maven_artifact(
4241
name = "accessibility_checks_maven_artifact",
43-
testonly = 1,
4442
last_updated = "20170622000000",
4543
target = ":accessibility_checks_aar",
4644
)

espresso/accessibility/javatests/androidx/test/espresso/accessibility/BUILD

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ load(
66
"axt_android_library_test",
77
)
88

9-
package(default_applicable_licenses = ["//espresso:license"])
9+
package(
10+
default_applicable_licenses = ["//espresso:license"],
11+
default_testonly = 1,
12+
)
1013

1114
licenses(["notice"])
1215

espresso/contrib/java/androidx/test/espresso/contrib/BUILD

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ licenses(["notice"])
1212

1313
package(
1414
default_applicable_licenses = ["//espresso:license"],
15+
default_testonly = 1,
1516
default_visibility = ["//:__subpackages__"],
1617
)
1718

@@ -51,7 +52,6 @@ android_library(
5152

5253
android_library(
5354
name = "picker_actions",
54-
testonly = 1,
5555
srcs = ["PickerActions.java"],
5656
visibility = ["//visibility:public"],
5757
deps = [
@@ -70,6 +70,7 @@ COMMON_JAVACOPTS = [
7070

7171
jetify_android_library(
7272
name = "recycler_view",
73+
testonly = 0,
7374
srcs = ["RecyclerViewActions.java"],
7475
javacopts = COMMON_JAVACOPTS,
7576
jetify_sources = True,
@@ -87,7 +88,6 @@ jetify_android_library(
8788

8889
android_library(
8990
name = "drawer_actions",
90-
testonly = 1,
9191
srcs = [
9292
"DrawerActions.java",
9393
"DrawerMatchers.java",
@@ -116,7 +116,6 @@ android_library(
116116

117117
android_library(
118118
name = "accessibility_checks",
119-
testonly = 1,
120119
srcs = [
121120
"AccessibilityChecks.java",
122121
],
@@ -130,7 +129,6 @@ android_library(
130129

131130
android_library(
132131
name = "design_lib_actions",
133-
testonly = 1,
134132
srcs = ["NavigationViewActions.java"],
135133
visibility = ["//visibility:public"],
136134
deps = [
@@ -146,7 +144,6 @@ android_library(
146144

147145
android_library(
148146
name = "view_pager_actions",
149-
testonly = 1,
150147
srcs = ["ViewPagerActions.java"],
151148
visibility = ["//visibility:public"],
152149
deps = [
@@ -160,7 +157,6 @@ android_library(
160157

161158
android_library(
162159
name = "espresso_contrib_aar_lib",
163-
testonly = 1,
164160
manifest = "AndroidManifest.xml",
165161
resource_files = glob(["res/**"]),
166162
exports = [
@@ -176,7 +172,6 @@ android_library(
176172

177173
axt_android_aar(
178174
name = "espresso_contrib_aar",
179-
testonly = 1,
180175
expected_class_prefixes = [
181176
"androidx.test.espresso.contrib",
182177
],
@@ -185,7 +180,6 @@ axt_android_aar(
185180

186181
maven_artifact(
187182
name = "espresso_contrib_maven_artifact",
188-
testonly = 1,
189183
last_updated = "20170622000000",
190184
target = ":espresso_contrib_aar",
191185
)

espresso/contrib/javatests/androidx/test/espresso/contrib/BUILD

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ load(
77
)
88
load("//build_extensions:jetify.bzl", "jetify_android_library")
99

10-
package(default_applicable_licenses = ["//espresso:license"])
10+
package(
11+
default_applicable_licenses = ["//espresso:license"],
12+
default_testonly = 1,
13+
)
1114

1215
licenses(["notice"])
1316
## Android tests
1417

1518
jetify_android_library(
1619
name = "recycler_view_tests",
17-
testonly = 1,
1820
srcs = [
1921
"RecyclerViewGridLayoutManagerTest.java",
2022
"RecyclerViewIntegrationTest.java",

espresso/core/BUILD

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Alias for androidx.test.espresso.core API library
22

3-
package(default_applicable_licenses = ["//espresso:license"])
3+
package(
4+
default_applicable_licenses = ["//espresso:license"],
5+
default_testonly = 1,
6+
)
47

58
licenses(["notice"])
69

710
alias(
811
name = "core",
9-
testonly = 1,
1012
actual = "//espresso/core/java/androidx/test/espresso",
1113
visibility = ["//visibility:public"],
1214
)

0 commit comments

Comments
 (0)