• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/transaction_ids.h>
25 #include "aidl_language.h"
26 #include "import_resolver.h"
27 #include "io_delegate.h"
28 #include "options.h"
29 
30 namespace android {
31 namespace aidl {
32 
33 enum class AidlError {
34   UNKOWN = std::numeric_limits<int32_t>::min(),
35   BAD_PRE_PROCESSED_FILE,
36   PARSE_ERROR,
37   FOUND_PARCELABLE,
38   BAD_PACKAGE,
39   BAD_IMPORT,
40   BAD_TYPE,
41   BAD_METHOD_ID,
42   GENERATION_ERROR,
43   BAD_INPUT,
44   NOT_STRUCTURED,
45 
46   OK = 0,
47 };
48 
49 bool compile_aidl(const Options& options, const IoDelegate& io_delegate);
50 bool dump_mappings(const Options& options, const IoDelegate& io_delegate);
51 
52 // main entry point to AIDL
53 int aidl_entry(const Options& options, const IoDelegate& io_delegate);
54 
55 const char kPreamble[] =
56     R"(///////////////////////////////////////////////////////////////////////////////
57 // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
58 ///////////////////////////////////////////////////////////////////////////////
59 
60 // This file is a snapshot of an AIDL file. Do not edit it manually. There are
61 // two cases:
62 // 1). this is a frozen version file - do not edit this in any case.
63 // 2). this is a 'current' file. If you make a backwards compatible change to
64 //     the interface (from the latest frozen version), the build system will
65 //     prompt you to update this file with `m <name>-update-api`.
66 //
67 // You must not make a backward incompatible change to any AIDL file built
68 // with the aidl_interface module type with versions property set. The module
69 // type is used to build AIDL files in a way that they can be used across
70 // independently updatable components of the system. If a device is shipped
71 // with such a backward incompatible change, it has a high risk of breaking
72 // later when a module using the interface is updated, e.g., Mainline modules.
73 
74 )";
75 
76 const string kGetInterfaceVersion("getInterfaceVersion");
77 const string kGetInterfaceHash("getInterfaceHash");
78 
79 namespace internals {
80 
81 AidlError load_and_validate_aidl(const std::string& input_file_name, const Options& options,
82                                  const IoDelegate& io_delegate, AidlTypenames* typenames,
83                                  vector<string>* imported_files);
84 
85 } // namespace internals
86 
87 }  // namespace aidl
88 }  // namespace android
89