blob: 243e77e1da8e6be92fd772ff6bcf6917f3b062dd [file] [log] [blame]
Nick Chalkoc5130702024-11-14 12:54:14 -08001// Copyright 2024 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16 default_applicable_licenses: ["Android-Apache-2.0"],
17 default_team: "trendy_team_android_media_reliability",
18}
19
20genrule {
21 name: "applied_backported_fixes",
Nick Chalko2161dc22024-12-12 16:00:50 -080022 tools: ["applied_backported_fixes_property_writer"],
Nick Chalkoc5130702024-11-14 12:54:14 -080023 srcs: [":applied_backported_fix_binpbs"],
24 out: ["applied_backported_fixes.prop"],
Nick Chalko2161dc22024-12-12 16:00:50 -080025 cmd: "$(location applied_backported_fixes_property_writer)" +
Nick Chalkoc5130702024-11-14 12:54:14 -080026 " -p $(location applied_backported_fixes.prop)" +
27 " $(in)",
28}
29
Nick Chalko2161dc22024-12-12 16:00:50 -080030filegroup {
31 name: "backported_fixes_proto_file",
Nick Chalkoc5130702024-11-14 12:54:14 -080032 srcs: [
33 "backported_fixes.proto",
34 ],
Nick Chalko2161dc22024-12-12 16:00:50 -080035}
36
37java_library {
38 name: "backported_fixes_proto",
39 srcs: ["backported_fixes.proto"],
Nick Chalkoc5130702024-11-14 12:54:14 -080040 host_supported: true,
41}
42
43java_library {
44 name: "backported_fixes_common",
45 srcs: ["src/java/com/android/build/backportedfixes/common/*.java"],
46 static_libs: [
47 "backported_fixes_proto",
48 "guava",
49 ],
50 host_supported: true,
51}
52
53java_test_host {
54 name: "backported_fixes_common_test",
55 srcs: ["tests/java/com/android/build/backportedfixes/common/*.java"],
56 static_libs: [
57 "backported_fixes_common",
58 "backported_fixes_proto",
59 "junit",
60 "truth",
61 "truth-liteproto-extension",
62 "truth-proto-extension",
63 ],
64 test_options: {
65 unit_test: true,
66 },
67 test_suites: ["general-tests"],
68}
69
70java_library {
Nick Chalko2161dc22024-12-12 16:00:50 -080071 name: "backported_fixes_main_lib",
Nick Chalkoc5130702024-11-14 12:54:14 -080072 srcs: ["src/java/com/android/build/backportedfixes/*.java"],
73 static_libs: [
74 "backported_fixes_common",
75 "backported_fixes_proto",
76 "jcommander",
77 "guava",
78 ],
79 host_supported: true,
80}
81
82java_binary_host {
Nick Chalko2161dc22024-12-12 16:00:50 -080083 name: "applied_backported_fixes_property_writer",
84 main_class: "com.android.build.backportedfixes.WriteBackportedFixesPropFile",
Nick Chalkoc5130702024-11-14 12:54:14 -080085 static_libs: [
Nick Chalko2161dc22024-12-12 16:00:50 -080086 "backported_fixes_main_lib",
Nick Chalkoc5130702024-11-14 12:54:14 -080087 ],
88}
89
Nick Chalko2161dc22024-12-12 16:00:50 -080090java_binary_host {
91 name: "backported_fixes_combiner",
92 main_class: "com.android.build.backportedfixes.CombineBackportedFixes",
93 static_libs: [
94 "backported_fixes_main_lib",
95 ],
96}
97
98// Combines BackportedFix binary proto files into a single BackportedFixes binary proto file.
99genrule_defaults {
100 name: "default_backported_fixes_combiner",
101 tools: ["backported_fixes_combiner"],
102 cmd: "$(location backported_fixes_combiner)" +
103 " -o $(out)" +
104 " $(in)",
105}
106
Nick Chalkoc5130702024-11-14 12:54:14 -0800107java_test_host {
Nick Chalko2161dc22024-12-12 16:00:50 -0800108 name: "backported_fixes_main_lib_test",
Nick Chalkoc5130702024-11-14 12:54:14 -0800109 srcs: ["tests/java/com/android/build/backportedfixes/*.java"],
110 static_libs: [
Nick Chalko2161dc22024-12-12 16:00:50 -0800111 "backported_fixes_main_lib",
Nick Chalkoc5130702024-11-14 12:54:14 -0800112 "backported_fixes_proto",
113 "junit",
114 "truth",
115 ],
116 test_options: {
117 unit_test: true,
118 },
119 test_suites: ["general-tests"],
120}
121
Nick Chalko2161dc22024-12-12 16:00:50 -0800122// Converts BackprotedFix text protos to binary protos
123genrule_defaults {
124 name: "default_backported_fix_binpbs",
125 tools: ["aprotoc"],
126 tool_files: [
127 ":backported_fixes_proto_file",
128 ],
129 cmd: "$(location aprotoc) " +
130 " --encode=com.android.build.backportedfixes.BackportedFix" +
131 " $(location :backported_fixes_proto_file)" +
132 " < $(in)" +
133 " > $(out); echo $(out)",
134}
135
Nick Chalkoc5130702024-11-14 12:54:14 -0800136gensrcs {
137 name: "applied_backported_fix_binpbs",
Nick Chalko2161dc22024-12-12 16:00:50 -0800138 defaults: ["default_backported_fix_binpbs"],
139 output_extension: "binpb",
Nick Chalkoc5130702024-11-14 12:54:14 -0800140 srcs: [
141 "applied_fixes/*.txtpb",
142 ],
Nick Chalkoc5130702024-11-14 12:54:14 -0800143}