blob: 7b5628f0a31334332482aff31ceb2c47164278bc [file] [log] [blame]
Christopher Wiley89eaab52015-09-15 14:46:46 -07001/*
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
Steven Moreland9fccf582018-08-27 20:36:27 -070017#pragma once
Christopher Wiley89e35862015-08-30 10:57:07 -070018
Christopher Wiley632801d2015-11-05 14:15:49 -080019#include <limits>
Christopher Wiley90be4e32015-10-20 14:55:25 -070020#include <memory>
21#include <string>
22#include <vector>
23
Casey Dahlin2cc93162015-10-02 16:14:17 -070024#include "aidl_language.h"
Jiyong Park02da7422018-07-16 16:00:26 +090025#include "import_resolver.h"
Christopher Wiley4a2884b2015-10-07 11:27:45 -070026#include "io_delegate.h"
Christopher Wiley89e35862015-08-30 10:57:07 -070027#include "options.h"
Casey Dahlin2cc93162015-10-02 16:14:17 -070028#include "type_namespace.h"
Christopher Wiley89e35862015-08-30 10:57:07 -070029
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070030namespace android {
31namespace aidl {
32
Christopher Wiley632801d2015-11-05 14:15:49 -080033enum 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,
Jiyong Park3656c3c2018-08-01 20:02:01 +090043 BAD_INPUT,
Steven Moreland1eac5fa2018-08-27 19:35:05 -070044 NOT_STRUCTURED,
Christopher Wiley632801d2015-11-05 14:15:49 -080045
46 OK = 0,
47};
48
Jiyong Parkb034bf02018-07-30 17:44:33 +090049int compile_aidl(const Options& options, const IoDelegate& io_delegate);
Jiyong Park74595c12018-07-23 15:22:50 +090050bool preprocess_aidl(const Options& options, const IoDelegate& io_delegate);
51bool dump_api(const Options& options, const IoDelegate& io_delegate);
Andrei Onea8714b022019-02-01 18:55:54 +000052bool dump_mappings(const Options& options, const IoDelegate& io_delegate);
Christopher Wiley89e35862015-08-30 10:57:07 -070053
Jiyong Park309668e2018-07-28 16:55:44 +090054const string kGetInterfaceVersion("getInterfaceVersion");
55
Casey Dahlin2cc93162015-10-02 16:14:17 -070056namespace internals {
57
Jiyong Parkfbbfa932018-07-30 21:44:10 +090058AidlError load_and_validate_aidl(const std::string& input_file_name, const Options& options,
59 const IoDelegate& io_delegate, TypeNamespace* types,
Jiyong Parkb034bf02018-07-30 17:44:33 +090060 vector<AidlDefinedType*>* defined_types,
61 vector<string>* imported_files);
Casey Dahlin2cc93162015-10-02 16:14:17 -070062
Jiyong Park1deecc32018-07-17 01:14:41 +090063bool parse_preprocessed_file(const IoDelegate& io_delegate, const std::string& filename,
64 TypeNamespace* types, AidlTypenames& typenames);
Christopher Wileyef140932015-11-03 09:29:19 -080065
Casey Dahlin2cc93162015-10-02 16:14:17 -070066} // namespace internals
67
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070068} // namespace android
69} // namespace aidl