blob: 8bd2887e14c374954aa03639cb6e675bbd8d7dd9 [file] [log] [blame]
Christopher Wiley4427d862015-09-14 11:07:39 -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 */
Adam Lesinskiffa16862014-01-23 18:17:42 -080016
17#include "options.h"
Jiyong Park05463732018-08-09 16:03:02 +090018#include "logging.h"
Jiyong Park6f77e0c2018-07-28 16:55:44 +090019#include "os.h"
Adam Lesinskiffa16862014-01-23 18:17:42 -080020
Jiyong Park74595c12018-07-23 15:22:50 +090021#include <getopt.h>
22#include <stdlib.h>
23#include <unistd.h>
Jiyong Park8c380532018-08-30 14:55:26 +090024#include <algorithm>
Christopher Wileya590de82015-09-15 15:46:28 -070025#include <iostream>
Jiyong Park74595c12018-07-23 15:22:50 +090026#include <sstream>
27#include <string>
Adam Lesinskiffa16862014-01-23 18:17:42 -080028
Jiyong Park74595c12018-07-23 15:22:50 +090029#include <android-base/strings.h>
Christopher Wiley4432ccf2015-09-18 18:32:08 -070030
Jiyong Park6f77e0c2018-07-28 16:55:44 +090031using android::base::Split;
Jiyong Park74595c12018-07-23 15:22:50 +090032using android::base::Trim;
Christopher Wileya590de82015-09-15 15:46:28 -070033using std::endl;
Christopher Wiley4427d862015-09-14 11:07:39 -070034using std::string;
Christopher Wiley4427d862015-09-14 11:07:39 -070035
36namespace android {
37namespace aidl {
Christopher Wiley4427d862015-09-14 11:07:39 -070038
Jiyong Park74595c12018-07-23 15:22:50 +090039string Options::GetUsage() const {
40 std::ostringstream sstr;
41 sstr << "usage:" << endl
42 << myname_ << " --lang={java|cpp} [OPTION]... INPUT..." << endl
43 << " Generate Java or C++ files for AIDL file(s)." << endl
Steven Morelandda0654f2018-07-17 12:24:38 -070044 << endl
Jiyong Park74595c12018-07-23 15:22:50 +090045 << myname_ << " --preprocess OUTPUT INPUT..." << endl
46 << " Create an AIDL file having declarations of AIDL file(s)." << endl
Steven Morelandda0654f2018-07-17 12:24:38 -070047 << endl
Jiyong Parke59c3682018-09-11 23:10:25 +090048#ifndef _WIN32
49 << myname_ << " --dumpapi --out=DIR INPUT..." << endl
50 << " Dump API signature of AIDL file(s) to DIR." << endl
Jiyong Park3656c3c2018-08-01 20:02:01 +090051 << endl
Jiyong Parke59c3682018-09-11 23:10:25 +090052 << myname_ << " --checkapi OLD_DIR NEW_DIR" << endl
53 << " Checkes whether API dump NEW_DIR is backwards compatible extension " << endl
54 << " of the API dump OLD_DIR." << endl
55#endif
Steven Morelandda0654f2018-07-17 12:24:38 -070056 << endl;
Adam Lesinskiffa16862014-01-23 18:17:42 -080057
Jiyong Park74595c12018-07-23 15:22:50 +090058 // Legacy option formats
59 if (language_ == Options::Language::JAVA) {
60 sstr << myname_ << " [OPTION]... INPUT [OUTPUT]" << endl
61 << " Generate a Java file for an AIDL file." << endl
62 << endl;
63 } else if (language_ == Options::Language::CPP) {
64 sstr << myname_ << " [OPTION]... INPUT HEADER_DIR OUTPUT" << endl
65 << " Generate C++ headers and source for an AIDL file." << endl
66 << endl;
Christopher Wiley4427d862015-09-14 11:07:39 -070067 }
68
Jiyong Park74595c12018-07-23 15:22:50 +090069 sstr << "OPTION:" << endl
70 << " -I DIR, --include=DIR" << endl
71 << " Use DIR as a search path for import statements." << endl
Jiyong Park3c35e392018-08-30 13:10:30 +090072 << " -m FILE, --import=FILE" << endl
73 << " Import FILE directly without searching in the search paths." << endl
Jiyong Park74595c12018-07-23 15:22:50 +090074 << " -p FILE, --preprocessed=FILE" << endl
75 << " Include FILE which is created by --preprocess." << endl
76 << " -d FILE, --dep=FILE" << endl
77 << " Generate dependency file as FILE. Don't use this when" << endl
78 << " there are multiple input files. Use -a then." << endl
79 << " -o DIR, --out=DIR" << endl
80 << " Use DIR as the base output directory for generated files." << endl
81 << " -h DIR, --header_out=DIR" << endl
82 << " Generate C++ headers under DIR." << endl
83 << " -a" << endl
84 << " Generate dependency file next to the output file with the" << endl
85 << " name based on the input file." << endl
86 << " -b" << endl
87 << " Trigger fail when trying to compile a parcelable." << endl
88 << " --ninja" << endl
89 << " Generate dependency file in a format ninja understands." << endl
Steven Moreland6cee3482018-07-18 14:39:58 -070090 << " --structured" << endl
91 << " Whether this interface is defined exclusively in AIDL." << endl
92 << " It is therefore a candidate for stabilization." << endl
Steven Morelanda57d0a62019-07-30 09:41:14 -070093 << " --stability=<level>" << endl
94 << " The stability requirement of this interface." << endl
Jiyong Park74595c12018-07-23 15:22:50 +090095 << " -t, --trace" << endl
96 << " Include tracing code for systrace. Note that if either" << endl
97 << " the client or service code is not auto-generated by this" << endl
98 << " tool, that part will not be traced." << endl
99 << " --transaction_names" << endl
100 << " Generate transaction names." << endl
Andrei Onea8714b022019-02-01 18:55:54 +0000101 << " --apimapping" << endl
102 << " Generates a mapping of declared aidl method signatures to" << endl
103 << " the original line number. e.g.: " << endl
104 << " If line 39 of foo/bar/IFoo.aidl contains:"
105 << " void doFoo(int bar, String baz);" << endl
106 << " Then the result would be:" << endl
107 << " foo.bar.Baz|doFoo|int,String,|void" << endl
108 << " foo/bar/IFoo.aidl:39" << endl
Jiyong Park309668e2018-07-28 16:55:44 +0900109 << " -v VER, --version=VER" << endl
110 << " Set the version of the interface and parcelable to VER." << endl
111 << " VER must be an interger greater than 0." << endl
Jiyong Parkce50e262018-10-29 09:54:20 +0900112 << " --log" << endl
113 << " Information about the transaction, e.g., method name, argument" << endl
114 << " values, execution time, etc., is provided via callback." << endl
Nikita Ioffe8954a0e2019-06-25 23:36:13 +0100115 << " --parcelable-to-string" << endl
116 << " Generates an implementation of toString() for Java parcelables," << endl
117 << " and ostream& operator << for C++ parcelables." << endl
Jiyong Park74595c12018-07-23 15:22:50 +0900118 << " --help" << endl
119 << " Show this help." << endl
120 << endl
121 << "INPUT:" << endl
122 << " An AIDL file." << endl
123 << endl
124 << "OUTPUT:" << endl
125 << " Path to the generated Java or C++ source file. This is ignored when" << endl
126 << " -o or --out is specified or the number of the input files are" << endl
127 << " more than one." << endl
128 << " For Java, if omitted, Java source file is generated at the same" << endl
129 << " place as the input AIDL file," << endl
130 << endl
Christopher Wiley054afbd2015-10-16 17:08:43 -0700131 << "HEADER_DIR:" << endl
Jiyong Park74595c12018-07-23 15:22:50 +0900132 << " Path to where C++ headers are generated." << endl;
133 return sstr.str();
Christopher Wileya590de82015-09-15 15:46:28 -0700134}
135
Steven Morelanda57d0a62019-07-30 09:41:14 -0700136bool Options::StabilityFromString(const std::string& stability, Stability* out_stability) {
137 if (stability == "vintf") {
138 *out_stability = Stability::VINTF;
139 return true;
140 }
141 return false;
142}
143
Jiyong Park6f77e0c2018-07-28 16:55:44 +0900144Options Options::From(const string& cmdline) {
145 vector<string> args = Split(cmdline, " ");
146 return From(args);
147}
148
149Options Options::From(const vector<string>& args) {
150 Options::Language lang = Options::Language::JAVA;
151 int argc = args.size();
152 if (argc >= 1 && args.at(0) == "aidl-cpp") {
153 lang = Options::Language::CPP;
154 }
155 const char* argv[argc + 1];
156 for (int i = 0; i < argc; i++) {
157 argv[i] = args.at(i).c_str();
158 }
159 argv[argc] = nullptr;
160
161 return Options(argc, argv, lang);
162}
163
Jiyong Park74595c12018-07-23 15:22:50 +0900164Options::Options(int argc, const char* const argv[], Options::Language default_lang)
165 : myname_(argv[0]), language_(default_lang) {
166 bool lang_option_found = false;
Jiyong Park6f77e0c2018-07-28 16:55:44 +0900167 optind = 0;
Jiyong Park74595c12018-07-23 15:22:50 +0900168 while (true) {
169 static struct option long_options[] = {
170 {"lang", required_argument, 0, 'l'},
171 {"preprocess", no_argument, 0, 's'},
Jiyong Parke59c3682018-09-11 23:10:25 +0900172#ifndef _WIN32
Jiyong Park74595c12018-07-23 15:22:50 +0900173 {"dumpapi", no_argument, 0, 'u'},
Jiyong Park3656c3c2018-08-01 20:02:01 +0900174 {"checkapi", no_argument, 0, 'A'},
Jiyong Parke59c3682018-09-11 23:10:25 +0900175#endif
Andrei Onea8714b022019-02-01 18:55:54 +0000176 {"apimapping", required_argument, 0, 'i'},
Jiyong Park74595c12018-07-23 15:22:50 +0900177 {"include", required_argument, 0, 'I'},
Jiyong Park3c35e392018-08-30 13:10:30 +0900178 {"import", required_argument, 0, 'm'},
Jiyong Park74595c12018-07-23 15:22:50 +0900179 {"preprocessed", required_argument, 0, 'p'},
180 {"dep", required_argument, 0, 'd'},
181 {"out", required_argument, 0, 'o'},
182 {"header_out", required_argument, 0, 'h'},
183 {"ninja", no_argument, 0, 'n'},
Steven Morelanda57d0a62019-07-30 09:41:14 -0700184 {"stability", required_argument, 0, 'Y'},
Steven Moreland6cee3482018-07-18 14:39:58 -0700185 {"structured", no_argument, 0, 'S'},
Jiyong Park74595c12018-07-23 15:22:50 +0900186 {"trace", no_argument, 0, 't'},
187 {"transaction_names", no_argument, 0, 'c'},
Jiyong Park309668e2018-07-28 16:55:44 +0900188 {"version", required_argument, 0, 'v'},
Jiyong Parkce50e262018-10-29 09:54:20 +0900189 {"log", no_argument, 0, 'L'},
Nikita Ioffe8954a0e2019-06-25 23:36:13 +0100190 {"parcelable-to-string", no_argument, 0, 'P'},
Jiyong Park74595c12018-07-23 15:22:50 +0900191 {"help", no_argument, 0, 'e'},
192 {0, 0, 0, 0},
193 };
Jiyong Park3c35e392018-08-30 13:10:30 +0900194 const int c = getopt_long(argc, const_cast<char* const*>(argv),
195 "I:m:p:d:o:h:abtv:", long_options, nullptr);
Jiyong Park74595c12018-07-23 15:22:50 +0900196 if (c == -1) {
197 // no more options
198 break;
Christopher Wileya590de82015-09-15 15:46:28 -0700199 }
Jiyong Park74595c12018-07-23 15:22:50 +0900200 switch (c) {
201 case 'l':
202 if (language_ == Options::Language::CPP) {
203 // aidl-cpp can't set language. aidl-cpp exists only for backwards
204 // compatibility.
205 error_message_ << "aidl-cpp does not support --lang." << endl;
206 return;
207 } else {
208 lang_option_found = true;
Jiyong Park309668e2018-07-28 16:55:44 +0900209 string lang = Trim(optarg);
Jiyong Park74595c12018-07-23 15:22:50 +0900210 if (lang == "java") {
211 language_ = Options::Language::JAVA;
212 task_ = Options::Task::COMPILE;
213 } else if (lang == "cpp") {
214 language_ = Options::Language::CPP;
215 task_ = Options::Task::COMPILE;
Steven Morelandc26d8142018-09-17 14:25:33 -0700216 } else if (lang == "ndk") {
217 language_ = Options::Language::NDK;
218 task_ = Options::Task::COMPILE;
Jiyong Park74595c12018-07-23 15:22:50 +0900219 } else {
220 error_message_ << "Unsupported language: '" << lang << "'" << endl;
221 return;
222 }
223 }
224 break;
225 case 's':
226 if (task_ != Options::Task::UNSPECIFIED) {
227 task_ = Options::Task::PREPROCESS;
228 }
229 break;
Jiyong Parke59c3682018-09-11 23:10:25 +0900230#ifndef _WIN32
Jiyong Park74595c12018-07-23 15:22:50 +0900231 case 'u':
232 if (task_ != Options::Task::UNSPECIFIED) {
Jiyong Park3656c3c2018-08-01 20:02:01 +0900233 task_ = Options::Task::DUMP_API;
234 }
235 break;
236 case 'A':
237 if (task_ != Options::Task::UNSPECIFIED) {
238 task_ = Options::Task::CHECK_API;
239 // to ensure that all parcelables in the api dumpes are structured
240 structured_ = true;
Jiyong Park74595c12018-07-23 15:22:50 +0900241 }
242 break;
Jiyong Parke59c3682018-09-11 23:10:25 +0900243#endif
Jiyong Park8c380532018-08-30 14:55:26 +0900244 case 'I': {
245 import_dirs_.emplace(Trim(optarg));
Jiyong Park3c35e392018-08-30 13:10:30 +0900246 break;
Jiyong Park8c380532018-08-30 14:55:26 +0900247 }
248 case 'm': {
249 import_files_.emplace(Trim(optarg));
Jiyong Park74595c12018-07-23 15:22:50 +0900250 break;
Jiyong Park8c380532018-08-30 14:55:26 +0900251 }
Jiyong Park74595c12018-07-23 15:22:50 +0900252 case 'p':
Jiyong Park309668e2018-07-28 16:55:44 +0900253 preprocessed_files_.emplace_back(Trim(optarg));
Jiyong Park74595c12018-07-23 15:22:50 +0900254 break;
255 case 'd':
Jiyong Park309668e2018-07-28 16:55:44 +0900256 dependency_file_ = Trim(optarg);
Jiyong Park74595c12018-07-23 15:22:50 +0900257 break;
258 case 'o':
Jiyong Park309668e2018-07-28 16:55:44 +0900259 output_dir_ = Trim(optarg);
Jiyong Park05463732018-08-09 16:03:02 +0900260 if (output_dir_.back() != OS_PATH_SEPARATOR) {
261 output_dir_.push_back(OS_PATH_SEPARATOR);
262 }
Jiyong Park74595c12018-07-23 15:22:50 +0900263 break;
264 case 'h':
Jiyong Park309668e2018-07-28 16:55:44 +0900265 output_header_dir_ = Trim(optarg);
Jiyong Park05463732018-08-09 16:03:02 +0900266 if (output_header_dir_.back() != OS_PATH_SEPARATOR) {
267 output_header_dir_.push_back(OS_PATH_SEPARATOR);
268 }
Jiyong Park74595c12018-07-23 15:22:50 +0900269 break;
270 case 'n':
271 dependency_file_ninja_ = true;
272 break;
Steven Moreland6cee3482018-07-18 14:39:58 -0700273 case 'S':
274 structured_ = true;
275 break;
Steven Morelanda57d0a62019-07-30 09:41:14 -0700276 case 'Y': {
277 const string stability_str = Trim(optarg);
278 if (!StabilityFromString(stability_str, &stability_)) {
279 error_message_ << "Unrecognized stability level: '" << stability_str
280 << "'. Must be vintf." << endl;
281 return;
282 }
283 break;
284 }
Jiyong Park74595c12018-07-23 15:22:50 +0900285 case 't':
286 gen_traces_ = true;
287 break;
288 case 'a':
289 auto_dep_file_ = true;
290 break;
291 case 'b':
292 fail_on_parcelable_ = true;
293 break;
294 case 'c':
295 gen_transaction_names_ = true;
296 break;
Jiyong Park309668e2018-07-28 16:55:44 +0900297 case 'v': {
298 const string ver_str = Trim(optarg);
299 int ver = atoi(ver_str.c_str());
300 if (ver > 0) {
301 version_ = ver;
302 } else {
303 error_message_ << "Invalid version number: '" << ver_str << "'. "
304 << "Version must be a positive natural number." << endl;
305 return;
306 }
307 break;
308 }
Jiyong Parkce50e262018-10-29 09:54:20 +0900309 case 'L':
310 gen_log_ = true;
311 break;
Jiyong Park74595c12018-07-23 15:22:50 +0900312 case 'e':
313 std::cerr << GetUsage();
314 exit(0);
Andrei Onea8714b022019-02-01 18:55:54 +0000315 case 'i':
316 output_file_ = Trim(optarg);
317 task_ = Task::DUMP_MAPPINGS;
318 break;
Nikita Ioffe8954a0e2019-06-25 23:36:13 +0100319 case 'P':
320 gen_parcelable_to_string_ = true;
321 break;
Jiyong Park74595c12018-07-23 15:22:50 +0900322 default:
Steven Moreland4dbadf52018-08-08 17:46:10 -0700323 std::cerr << GetUsage();
324 exit(1);
Jiyong Park74595c12018-07-23 15:22:50 +0900325 }
326 } // while
327
328 // Positional arguments
329 if (!lang_option_found && task_ == Options::Task::COMPILE) {
330 // the legacy arguments format
331 if (argc - optind <= 0) {
332 error_message_ << "No input file" << endl;
333 return;
334 }
335 if (language_ == Options::Language::JAVA) {
336 input_files_.emplace_back(argv[optind++]);
337 if (argc - optind >= 1) {
338 output_file_ = argv[optind++];
Jiyong Park56f73d72019-06-11 12:20:28 +0900339 } else if (output_dir_.empty()) {
340 // when output is omitted and -o option isn't set, the output is by
341 // default set to the input file path with .aidl is replaced to .java.
342 // If -o option is set, the output path is calculated by
343 // generate_outputFileName which returns "<output_dir>/<package/name>/
344 // <typename>.java"
Jiyong Park74595c12018-07-23 15:22:50 +0900345 output_file_ = input_files_.front();
Steven Moreland4dbadf52018-08-08 17:46:10 -0700346 if (android::base::EndsWith(output_file_, ".aidl")) {
347 output_file_ = output_file_.substr(0, output_file_.length() - strlen(".aidl"));
348 }
349 output_file_ += ".java";
Jiyong Park74595c12018-07-23 15:22:50 +0900350 }
Steven Morelandc26d8142018-09-17 14:25:33 -0700351 } else if (IsCppOutput()) {
Jiyong Park74595c12018-07-23 15:22:50 +0900352 input_files_.emplace_back(argv[optind++]);
353 if (argc - optind < 2) {
354 error_message_ << "No HEADER_DIR or OUTPUT." << endl;
355 return;
356 }
357 output_header_dir_ = argv[optind++];
Jiyong Park05463732018-08-09 16:03:02 +0900358 if (output_header_dir_.back() != OS_PATH_SEPARATOR) {
359 output_header_dir_.push_back(OS_PATH_SEPARATOR);
360 }
Jiyong Park74595c12018-07-23 15:22:50 +0900361 output_file_ = argv[optind++];
362 }
363 if (argc - optind > 0) {
364 error_message_ << "Too many arguments: ";
365 for (int i = optind; i < argc; i++) {
366 error_message_ << " " << argv[i];
367 }
368 error_message_ << endl;
369 }
Jiyong Park74595c12018-07-23 15:22:50 +0900370 } else {
371 // the new arguments format
Jiyong Parke59c3682018-09-11 23:10:25 +0900372 if (task_ == Options::Task::COMPILE || task_ == Options::Task::DUMP_API) {
Jiyong Park74595c12018-07-23 15:22:50 +0900373 if (argc - optind < 1) {
374 error_message_ << "No input file." << endl;
375 return;
376 }
377 } else {
378 if (argc - optind < 2) {
379 error_message_ << "Insufficient arguments. At least 2 required, but "
380 << "got " << (argc - optind) << "." << endl;
381 return;
382 }
Andrei Onea8714b022019-02-01 18:55:54 +0000383 if (task_ != Options::Task::CHECK_API && task_ != Options::Task::DUMP_MAPPINGS) {
Jiyong Park3656c3c2018-08-01 20:02:01 +0900384 output_file_ = argv[optind++];
385 }
Jiyong Park74595c12018-07-23 15:22:50 +0900386 }
387 while (optind < argc) {
388 input_files_.emplace_back(argv[optind++]);
389 }
Christopher Wileya590de82015-09-15 15:46:28 -0700390 }
391
Jiyong Park74595c12018-07-23 15:22:50 +0900392 // filter out invalid combinations
Steven Moreland4dbadf52018-08-08 17:46:10 -0700393 if (lang_option_found) {
Steven Morelandc26d8142018-09-17 14:25:33 -0700394 if (IsCppOutput() && task_ == Options::Task::COMPILE) {
Steven Moreland4dbadf52018-08-08 17:46:10 -0700395 if (output_dir_.empty()) {
396 error_message_ << "Output directory is not set. Set with --out." << endl;
397 return;
398 }
399 if (output_header_dir_.empty()) {
400 error_message_ << "Header output directory is not set. Set with "
401 << "--header_out." << endl;
402 return;
403 }
Jiyong Park74595c12018-07-23 15:22:50 +0900404 }
Steven Moreland4dbadf52018-08-08 17:46:10 -0700405 if (language_ == Options::Language::JAVA && task_ == Options::Task::COMPILE) {
406 if (output_dir_.empty()) {
407 error_message_ << "Output directory is not set. Set with --out." << endl;
408 return;
409 }
410 if (!output_header_dir_.empty()) {
411 error_message_ << "Header output directory is set, which does not make "
412 << "sense for Java." << endl;
413 return;
414 }
Jiyong Park74595c12018-07-23 15:22:50 +0900415 }
416 }
417 if (task_ == Options::Task::COMPILE) {
Jiyong Parke59c3682018-09-11 23:10:25 +0900418 for (const string& input : input_files_) {
419 if (!android::base::EndsWith(input, ".aidl")) {
420 error_message_ << "Expected .aidl file for input but got '" << input << "'" << endl;
421 return;
422 }
423 }
Jiyong Park74595c12018-07-23 15:22:50 +0900424 if (!output_file_.empty() && input_files_.size() > 1) {
425 error_message_ << "Multiple AIDL files can't be compiled to a single "
426 << "output file '" << output_file_ << "'. "
427 << "Use --out=DIR instead for output files." << endl;
428 return;
429 }
430 if (!dependency_file_.empty() && input_files_.size() > 1) {
431 error_message_ << "-d or --dep doesn't work when compiling multiple AIDL "
432 << "files. Use '-a' to generate dependency file next to "
433 << "the output file with the name based on the input "
434 << "file." << endl;
435 return;
436 }
Jeongik Cha37e2ad52019-04-18 13:44:26 +0900437 if (gen_log_ && (language_ != Options::Language::CPP && language_ != Options::Language::NDK)) {
438 error_message_ << "--log is currently supported for either --lang=cpp or --lang=ndk" << endl;
Jiyong Parkce50e262018-10-29 09:54:20 +0900439 return;
440 }
Christopher Wileya590de82015-09-15 15:46:28 -0700441 }
Jiyong Park309668e2018-07-28 16:55:44 +0900442 if (task_ == Options::Task::PREPROCESS) {
443 if (version_ > 0) {
444 error_message_ << "--version should not be used with '--preprocess'." << endl;
445 return;
446 }
447 }
Jiyong Park3656c3c2018-08-01 20:02:01 +0900448 if (task_ == Options::Task::CHECK_API) {
449 if (input_files_.size() != 2) {
450 error_message_ << "--checkapi requires two inputs for comparing, "
451 << "but got " << input_files_.size() << "." << endl;
452 return;
453 }
454 }
Jiyong Parke59c3682018-09-11 23:10:25 +0900455 if (task_ == Options::Task::DUMP_API) {
456 if (output_dir_.empty()) {
457 error_message_ << "--dump_api requires output directory. Use --out." << endl;
458 return;
459 }
460 }
Jiyong Park05463732018-08-09 16:03:02 +0900461
462 CHECK(output_dir_.empty() || output_dir_.back() == OS_PATH_SEPARATOR);
463 CHECK(output_header_dir_.empty() || output_header_dir_.back() == OS_PATH_SEPARATOR);
Christopher Wileya590de82015-09-15 15:46:28 -0700464}
465
Christopher Wiley4427d862015-09-14 11:07:39 -0700466} // namespace aidl
Steven Morelandf4c64df2019-07-29 19:54:04 -0700467} // namespace android