Nick Chalko | c513070 | 2024-11-14 12:54:14 -0800 | [diff] [blame^] | 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 | |
| 15 | package { |
| 16 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 17 | default_team: "trendy_team_android_media_reliability", |
| 18 | } |
| 19 | |
| 20 | genrule { |
| 21 | name: "applied_backported_fixes", |
| 22 | tools: ["applied_backported_fixes_main"], |
| 23 | srcs: [":applied_backported_fix_binpbs"], |
| 24 | out: ["applied_backported_fixes.prop"], |
| 25 | cmd: "$(location applied_backported_fixes_main)" + |
| 26 | " -p $(location applied_backported_fixes.prop)" + |
| 27 | " $(in)", |
| 28 | } |
| 29 | |
| 30 | java_library { |
| 31 | name: "backported_fixes_proto", |
| 32 | srcs: [ |
| 33 | "backported_fixes.proto", |
| 34 | ], |
| 35 | host_supported: true, |
| 36 | } |
| 37 | |
| 38 | java_library { |
| 39 | name: "backported_fixes_common", |
| 40 | srcs: ["src/java/com/android/build/backportedfixes/common/*.java"], |
| 41 | static_libs: [ |
| 42 | "backported_fixes_proto", |
| 43 | "guava", |
| 44 | ], |
| 45 | host_supported: true, |
| 46 | } |
| 47 | |
| 48 | java_test_host { |
| 49 | name: "backported_fixes_common_test", |
| 50 | srcs: ["tests/java/com/android/build/backportedfixes/common/*.java"], |
| 51 | static_libs: [ |
| 52 | "backported_fixes_common", |
| 53 | "backported_fixes_proto", |
| 54 | "junit", |
| 55 | "truth", |
| 56 | "truth-liteproto-extension", |
| 57 | "truth-proto-extension", |
| 58 | ], |
| 59 | test_options: { |
| 60 | unit_test: true, |
| 61 | }, |
| 62 | test_suites: ["general-tests"], |
| 63 | } |
| 64 | |
| 65 | java_library { |
| 66 | name: "applied_backported_fixes_lib", |
| 67 | srcs: ["src/java/com/android/build/backportedfixes/*.java"], |
| 68 | static_libs: [ |
| 69 | "backported_fixes_common", |
| 70 | "backported_fixes_proto", |
| 71 | "jcommander", |
| 72 | "guava", |
| 73 | ], |
| 74 | host_supported: true, |
| 75 | } |
| 76 | |
| 77 | java_binary_host { |
| 78 | name: "applied_backported_fixes_main", |
| 79 | main_class: "com.android.build.backportedfixes.Main", |
| 80 | static_libs: [ |
| 81 | "applied_backported_fixes_lib", |
| 82 | ], |
| 83 | } |
| 84 | |
| 85 | java_test_host { |
| 86 | name: "applied_backported_fixes_test", |
| 87 | srcs: ["tests/java/com/android/build/backportedfixes/*.java"], |
| 88 | static_libs: [ |
| 89 | "applied_backported_fixes_lib", |
| 90 | "backported_fixes_proto", |
| 91 | "junit", |
| 92 | "truth", |
| 93 | ], |
| 94 | test_options: { |
| 95 | unit_test: true, |
| 96 | }, |
| 97 | test_suites: ["general-tests"], |
| 98 | } |
| 99 | |
| 100 | gensrcs { |
| 101 | name: "applied_backported_fix_binpbs", |
| 102 | tools: ["aprotoc"], |
| 103 | srcs: [ |
| 104 | "applied_fixes/*.txtpb", |
| 105 | ], |
| 106 | tool_files: [ |
| 107 | "backported_fixes.proto", |
| 108 | ], |
| 109 | output_extension: "binpb", |
| 110 | cmd: "$(location aprotoc) " + |
| 111 | " --encode=com.android.build.backportedfixes.BackportedFix" + |
| 112 | " $(location backported_fixes.proto)" + |
| 113 | " < $(in)" + |
| 114 | " > $(out); echo $(out)", |
| 115 | } |