/* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package { default_applicable_licenses: ["Android-Apache-2.0"], } java_binary_host { name: "EnumMetadataGenerator", srcs: ["src/**/*.java"], manifest: "manifest.txt", static_libs: [ "javaparser", "javaparser-symbol-solver", "json-prebuilt", "androidx.annotation_annotation", ], } // A rule to convert VHAL property AIDL files to java files. gensrcs { name: "gen_vehicle_property_java_file", srcs: [ ":android.hardware.automotive.vehicle.property-files", ], tools: ["aidl"], cmd: "$(location aidl) --lang=java --structured --stability=vintf $(in) -I hardware/interfaces/automotive/vehicle/aidl_property --out $(genDir)/hardware/interfaces/automotive/vehicle/aidl_property", output_extension: "java", } // A target to check whether android.hardware.automotive.vehicle-types-meta.json // needs to be updated. The output is just an empty cpp file to be included // in the higher-level build target. // It will generate generated.json at output directory based on VHAL property // java files and check it against // android.hardware.automotive.vehicle-types-meta.json. If not the same, the // build will fail. genrule { name: "check_generated_enum_metadata_json", tools: ["EnumMetadataGenerator"], srcs: [ ":android.hardware.automotive.vehicle-types-meta", ":gen_vehicle_property_java_file", ], cmd: "$(location EnumMetadataGenerator) --check_against $(location :android.hardware.automotive.vehicle-types-meta) --output_empty_file $(out) --output_json $(genDir)/generate_enum_metadata.json --input_files $(locations :gen_vehicle_property_java_file)", out: ["generate_enum_metadata_checked.cpp"], }