1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_base_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
default_team: "trendy_team_system_performance",
}
java_library_host {
name: "systemfeatures-gen-lib",
srcs: [
"src/**/*.java",
"src/**/*.kt",
":framework-metalava-annotations",
],
static_libs: [
"guava",
"javapoet",
],
}
java_binary_host {
name: "systemfeatures-gen-tool",
main_class: "com.android.systemfeatures.SystemFeaturesGenerator",
static_libs: ["systemfeatures-gen-lib"],
}
java_plugin {
name: "systemfeatures-metadata-processor",
processor_class: "com.android.systemfeatures.SystemFeaturesMetadataProcessor",
static_libs: ["systemfeatures-gen-lib"],
}
genrule {
name: "systemfeatures-gen-tests-srcs",
cmd: "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwNoFeatures --readonly=false > $(location RwNoFeatures.java) && " +
"$(location systemfeatures-gen-tool) com.android.systemfeatures.RoNoFeatures --readonly=true --feature-apis=WATCH > $(location RoNoFeatures.java) && " +
"$(location systemfeatures-gen-tool) com.android.systemfeatures.RwFeatures --readonly=false --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:UNAVAILABLE --feature=AUTO: > $(location RwFeatures.java) && " +
"$(location systemfeatures-gen-tool) com.android.systemfeatures.RoFeatures --readonly=true --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:UNAVAILABLE --feature=AUTO: --feature-apis=WATCH,PC > $(location RoFeatures.java)",
out: [
"RwNoFeatures.java",
"RoNoFeatures.java",
"RwFeatures.java",
"RoFeatures.java",
],
tools: ["systemfeatures-gen-tool"],
}
// Functional runtime behavior testing.
java_test_host {
name: "systemfeatures-gen-tests",
test_suites: ["general-tests"],
srcs: [
"tests/src/**/*.java",
":systemfeatures-gen-tests-srcs",
],
test_options: {
unit_test: true,
},
static_libs: [
"aconfig-annotations-lib",
"framework-annotations-lib",
"junit",
"objenesis",
"mockito",
"systemfeatures-gen-lib",
"truth",
],
plugins: ["systemfeatures-metadata-processor"],
}
// Rename the goldens as they may be copied into the source tree, and we don't
// need or want the usual `.java` linting (e.g., copyright checks).
genrule {
name: "systemfeatures-gen-tests-golden-srcs",
cmd: "for f in $(in); do cp $$f $(genDir)/tests/gen/$$(basename $$f).gen; done",
srcs: [":systemfeatures-gen-tests-srcs"],
out: [
"tests/gen/RwNoFeatures.java.gen",
"tests/gen/RoNoFeatures.java.gen",
"tests/gen/RwFeatures.java.gen",
"tests/gen/RoFeatures.java.gen",
],
}
// Golden output testing. Golden sources can be updated via:
// $ANDROID_BUILD_TOP/frameworks/base/tools/systemfeatures/tests/golden_test.sh --update
sh_test_host {
name: "systemfeatures-gen-golden-tests",
src: "tests/golden_test.sh",
filename: "systemfeatures-gen-golden-tests.sh",
test_config: "tests/systemfeatures-gen-golden-tests.xml",
data: [
"tests/golden/**/*.java*",
":systemfeatures-gen-tests-golden-srcs",
],
test_options: {
unit_test: true,
},
}
java_library_host {
name: "systemfeatures-errorprone-lib",
srcs: [
":systemfeatures-gen-metadata-srcs",
"errorprone/java/**/*.java",
],
static_libs: [
"//external/error_prone:error_prone_core",
"guava",
"jsr305",
],
libs: [
"//external/auto:auto_service_annotations",
],
javacflags: [
// These exports are needed because this errorprone plugin access some private classes
// of the java compiler.
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
plugins: [
"//external/auto:auto_service_plugin",
],
}
java_plugin {
name: "systemfeatures-errorprone",
static_libs: ["systemfeatures-errorprone-lib"],
}
java_test_host {
name: "systemfeatures-errorprone-tests",
srcs: [
"errorprone/tests/java/**/*.java",
],
java_resource_dirs: ["tests/src"],
java_resources: [
":systemfeatures-errorprone-tests-data",
],
static_libs: [
"compile-testing-prebuilt",
"error_prone_test_helpers",
"framework-annotations-lib",
"hamcrest",
"hamcrest-library",
"junit",
"systemfeatures-errorprone-lib",
"truth",
],
test_options: {
unit_test: true,
},
}
java_system_features_srcs {
name: "systemfeatures-gen-metadata-srcs",
full_class_name: "com.android.systemfeatures.RoSystemFeaturesMetadata",
metadata_only: true,
visibility: ["//visibility:private"],
}
filegroup {
name: "systemfeatures-errorprone-tests-data",
path: "tests/src",
srcs: ["tests/src/android/**/*.java"],
visibility: ["//visibility:private"],
}
|