Output correct dependency file with only output dir
There are three ways aidl can decide on the path to write
generated java:
- A literal output path
- Writing output next to the input (no output directory given)
- Writing output to an output directory
Fix a bug where we were writing an incorrect dependency file in the
last case, where we are given an output directory, but no output path.
Bug: 28091660
Change-Id: I7fa743c6f32292e44439b7dc3ce7e49421b93d05
Test: added a unittest
diff --git a/aidl.cpp b/aidl.cpp
index c60626f..d7883b9 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -275,7 +275,8 @@
bool write_java_dep_file(const JavaOptions& options,
const vector<unique_ptr<AidlImport>>& imports,
- const IoDelegate& io_delegate) {
+ const IoDelegate& io_delegate,
+ const string& output_file_name) {
string dep_file_name = options.DependencyFilePath();
if (dep_file_name.empty()) {
return true; // nothing to do
@@ -293,7 +294,7 @@
}
}
- write_common_dep_file(options.output_file_name_, source_aidl, writer.get());
+ write_common_dep_file(output_file_name, source_aidl, writer.get());
return true;
}
@@ -707,7 +708,7 @@
return 1;
}
- if (!write_java_dep_file(options, imports, io_delegate)) {
+ if (!write_java_dep_file(options, imports, io_delegate, output_file_name)) {
return 1;
}