blob: 0caea56a57365adee950d14c2b96e9aae5da7234 [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,
Zhi Doua751c842025-01-07 11:23:19 -080041 sdk_version: "current",
Nick Chalkoc5130702024-11-14 12:54:14 -080042}
43
44java_library {
45 name: "backported_fixes_common",
46 srcs: ["src/java/com/android/build/backportedfixes/common/*.java"],
47 static_libs: [
48 "backported_fixes_proto",
49 "guava",
50 ],
51 host_supported: true,
52}
53
54java_test_host {
55 name: "backported_fixes_common_test",
56 srcs: ["tests/java/com/android/build/backportedfixes/common/*.java"],
57 static_libs: [
58 "backported_fixes_common",
59 "backported_fixes_proto",
60 "junit",
61 "truth",
62 "truth-liteproto-extension",
63 "truth-proto-extension",
64 ],
65 test_options: {
66 unit_test: true,
67 },
68 test_suites: ["general-tests"],
69}
70
71java_library {
Nick Chalko2161dc22024-12-12 16:00:50 -080072 name: "backported_fixes_main_lib",
Nick Chalkoc5130702024-11-14 12:54:14 -080073 srcs: ["src/java/com/android/build/backportedfixes/*.java"],
74 static_libs: [
75 "backported_fixes_common",
76 "backported_fixes_proto",
77 "jcommander",
78 "guava",
79 ],
80 host_supported: true,
81}
82
83java_binary_host {
Nick Chalko2161dc22024-12-12 16:00:50 -080084 name: "applied_backported_fixes_property_writer",
85 main_class: "com.android.build.backportedfixes.WriteBackportedFixesPropFile",
Nick Chalkoc5130702024-11-14 12:54:14 -080086 static_libs: [
Nick Chalko2161dc22024-12-12 16:00:50 -080087 "backported_fixes_main_lib",
Nick Chalkoc5130702024-11-14 12:54:14 -080088 ],
89}
90
Nick Chalko2161dc22024-12-12 16:00:50 -080091java_binary_host {
92 name: "backported_fixes_combiner",
93 main_class: "com.android.build.backportedfixes.CombineBackportedFixes",
94 static_libs: [
95 "backported_fixes_main_lib",
96 ],
97}
98
99// Combines BackportedFix binary proto files into a single BackportedFixes binary proto file.
100genrule_defaults {
101 name: "default_backported_fixes_combiner",
102 tools: ["backported_fixes_combiner"],
103 cmd: "$(location backported_fixes_combiner)" +
104 " -o $(out)" +
105 " $(in)",
106}
107
Nick Chalkoc5130702024-11-14 12:54:14 -0800108java_test_host {
Nick Chalko2161dc22024-12-12 16:00:50 -0800109 name: "backported_fixes_main_lib_test",
Nick Chalkoc5130702024-11-14 12:54:14 -0800110 srcs: ["tests/java/com/android/build/backportedfixes/*.java"],
111 static_libs: [
Nick Chalko2161dc22024-12-12 16:00:50 -0800112 "backported_fixes_main_lib",
Nick Chalkoc5130702024-11-14 12:54:14 -0800113 "backported_fixes_proto",
114 "junit",
115 "truth",
116 ],
117 test_options: {
118 unit_test: true,
119 },
120 test_suites: ["general-tests"],
121}
122
Nick Chalko2161dc22024-12-12 16:00:50 -0800123// Converts BackprotedFix text protos to binary protos
124genrule_defaults {
125 name: "default_backported_fix_binpbs",
126 tools: ["aprotoc"],
127 tool_files: [
128 ":backported_fixes_proto_file",
129 ],
130 cmd: "$(location aprotoc) " +
131 " --encode=com.android.build.backportedfixes.BackportedFix" +
132 " $(location :backported_fixes_proto_file)" +
133 " < $(in)" +
134 " > $(out); echo $(out)",
135}
136
Nick Chalkoc5130702024-11-14 12:54:14 -0800137gensrcs {
138 name: "applied_backported_fix_binpbs",
Nick Chalko2161dc22024-12-12 16:00:50 -0800139 defaults: ["default_backported_fix_binpbs"],
140 output_extension: "binpb",
Nick Chalkoc5130702024-11-14 12:54:14 -0800141 srcs: [
142 "applied_fixes/*.txtpb",
143 ],
Nick Chalkoc5130702024-11-14 12:54:14 -0800144}