1// 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", 22 tools: ["applied_backported_fixes_property_writer"], 23 srcs: [":applied_backported_fix_binpbs"], 24 out: ["applied_backported_fixes.prop"], 25 cmd: "$(location applied_backported_fixes_property_writer)" + 26 " -p $(location applied_backported_fixes.prop)" + 27 " $(in)", 28} 29 30filegroup { 31 name: "backported_fixes_proto_file", 32 srcs: [ 33 "backported_fixes.proto", 34 ], 35} 36 37java_library { 38 name: "backported_fixes_proto", 39 srcs: ["backported_fixes.proto"], 40 host_supported: true, 41 sdk_version: "current", 42} 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 { 72 name: "backported_fixes_main_lib", 73 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 { 84 name: "applied_backported_fixes_property_writer", 85 main_class: "com.android.build.backportedfixes.WriteBackportedFixesPropFile", 86 static_libs: [ 87 "backported_fixes_main_lib", 88 ], 89} 90 91java_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 108java_test_host { 109 name: "backported_fixes_main_lib_test", 110 srcs: ["tests/java/com/android/build/backportedfixes/*.java"], 111 static_libs: [ 112 "backported_fixes_main_lib", 113 "backported_fixes_proto", 114 "junit", 115 "truth", 116 ], 117 test_options: { 118 unit_test: true, 119 }, 120 test_suites: ["general-tests"], 121} 122 123// 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 137gensrcs { 138 name: "applied_backported_fix_binpbs", 139 defaults: ["default_backported_fix_binpbs"], 140 output_extension: "binpb", 141 srcs: [ 142 "applied_fixes/*.txtpb", 143 ], 144} 145