1java_defaults {
2    name: "cts_error_prone_rules",
3    errorprone: {
4        javacflags: [
5            // Set of error prone rules to ensure code quality
6            // When updating this list, also update error_prone_rules.mk
7            "-Xep:ArrayToString:ERROR",
8            "-Xep:BoxedPrimitiveConstructor:ERROR",
9            "-Xep:ConstantField:ERROR",
10            "-Xep:EqualsIncompatibleType:ERROR",
11            "-Xep:FormatString:ERROR",
12            "-Xep:GetClassOnClass:ERROR",
13            "-Xep:IdentityBinaryExpression:ERROR",
14            "-Xep:JUnit3TestNotRun:ERROR",
15            "-Xep:JUnit4ClassUsedInJUnit3:ERROR",
16            "-Xep:JUnitAmbiguousTestClass:ERROR",
17            "-Xep:MissingFail:ERROR",
18            "-Xep:MissingOverride:ERROR",
19            "-Xep:Overrides:ERROR",
20            "-Xep:ReferenceEquality:ERROR",
21            "-Xep:RemoveUnusedImports:ERROR",
22            "-Xep:ReturnValueIgnored:ERROR",
23            "-Xep:SelfEquals:ERROR",
24            "-Xep:SizeGreaterThanOrEqualsZero:ERROR",
25            "-Xep:TryFailThrowable:ERROR",
26        ],
27    },
28}
29
30java_defaults {
31    name: "cts_error_prone_rules_tests",
32    errorprone: {
33        javacflags: [
34            // Set of error prone rules to ensure code quality of tests
35            // Goal is to eventually merge with cts_error_prone_rules
36            // When updating this list, also update error_prone_rules_tests.mk
37            "-Xep:ArrayToString:ERROR",
38            "-Xep:CollectionIncompatibleType:ERROR",
39            "-Xep:EqualsIncompatibleType:ERROR",
40            "-Xep:EqualsNaN:ERROR",
41            "-Xep:FormatString:ERROR",
42            "-Xep:IdentityBinaryExpression:ERROR",
43            "-Xep:JUnit3TestNotRun:ERROR",
44            "-Xep:JUnit4ClassUsedInJUnit3:ERROR",
45            "-Xep:JUnitAmbiguousTestClass:ERROR",
46            "-Xep:MissingFail:ERROR",
47            "-Xep:SizeGreaterThanOrEqualsZero:ERROR",
48            "-Xep:TryFailThrowable:ERROR",
49        ],
50    },
51}
52
53// Used with an android_test / android_test_helper_app, this is equivalent to
54// BUILD_CTS_SUPPORT_PACKAGE
55java_defaults {
56    name: "cts_support_defaults",
57    defaults: ["cts_error_prone_rules_tests"],
58    dex_preopt: {
59        enabled: false,
60    },
61    optimize: {
62        enabled: false,
63    },
64}
65
66// Used with different module types, this is equivalent to:
67//   android_test: BUILD_CTS_PACKAGE
68//   java_library: BUILD_CTS_TARGET_JAVA_LIBRARY
69//   java_library_host: BUILD_CTS_HOST_JAVA_LIBRARY
70java_defaults {
71    name: "cts_defaults",
72    defaults: ["cts_support_defaults"],
73    target: {
74        android: {
75            static_libs: ["platform-test-annotations"],
76        },
77    },
78}
79