1 /* 2 * Copyright (C) 2015, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <limits> 20 #include <memory> 21 #include <string> 22 #include <vector> 23 24 #include "aidl_language.h" 25 #include "import_resolver.h" 26 #include "io_delegate.h" 27 #include "options.h" 28 29 namespace android { 30 namespace aidl { 31 32 enum class AidlError { 33 UNKOWN = std::numeric_limits<int32_t>::min(), 34 BAD_PRE_PROCESSED_FILE, 35 PARSE_ERROR, 36 FOUND_PARCELABLE, 37 BAD_PACKAGE, 38 BAD_IMPORT, 39 BAD_TYPE, 40 BAD_METHOD_ID, 41 GENERATION_ERROR, 42 BAD_INPUT, 43 NOT_STRUCTURED, 44 45 OK = 0, 46 }; 47 48 bool compile_aidl(const Options& options, const IoDelegate& io_delegate); 49 bool dump_mappings(const Options& options, const IoDelegate& io_delegate); 50 51 // main entry point to AIDL 52 int aidl_entry(const Options& options, const IoDelegate& io_delegate); 53 54 const char kPreamble[] = 55 R"(/////////////////////////////////////////////////////////////////////////////// 56 // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // 57 /////////////////////////////////////////////////////////////////////////////// 58 59 // This file is a snapshot of an AIDL file. Do not edit it manually. There are 60 // two cases: 61 // 1). this is a frozen version file - do not edit this in any case. 62 // 2). this is a 'current' file. If you make a backwards compatible change to 63 // the interface (from the latest frozen version), the build system will 64 // prompt you to update this file with `m <name>-update-api`. 65 // 66 // You must not make a backward incompatible change to any AIDL file built 67 // with the aidl_interface module type with versions property set. The module 68 // type is used to build AIDL files in a way that they can be used across 69 // independently updatable components of the system. If a device is shipped 70 // with such a backward incompatible change, it has a high risk of breaking 71 // later when a module using the interface is updated, e.g., Mainline modules. 72 73 )"; 74 75 const string kGetInterfaceVersion("getInterfaceVersion"); 76 const string kGetInterfaceHash("getInterfaceHash"); 77 78 namespace internals { 79 80 AidlError load_and_validate_aidl(const std::string& input_file_name, const Options& options, 81 const IoDelegate& io_delegate, AidlTypenames* typenames, 82 vector<string>* imported_files); 83 84 } // namespace internals 85 86 } // namespace aidl 87 } // namespace android 88