AAPT2: always say which file failed to compile
Sometimes AAPT2 doesn't include the path of the file in the error
message, or just outputs a warning where an error should be printed
(but the overall build still fails without an error message). Let's
always include the file path to make it easier for the users to find out
the source of the failure.
Fixes: 122856772
Test: manual
Change-Id: Ibbbfd21b372792e5eaa40278186eb64cdfb0f60e
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index 52375a3..92beb4e 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -701,7 +701,10 @@
}
const std::string out_path = BuildIntermediateContainerFilename(path_data);
- error |= !compile_func(context, options, path_data, file, output_writer, out_path);
+ if (!compile_func(context, options, path_data, file, output_writer, out_path)) {
+ context->GetDiagnostics()->Error(DiagMessage(file->GetSource()) << "file failed to compile");
+ error = true;
+ }
}
return error ? 1 : 0;