Better error for empty -Ljava-constants
If someone accidentally includes gen_java_constants (-Ljava-constants)
in their Android.bp file, this used to emit a cryptic error about
depfiles since hidl-gen didn't make the expected dir hierarchy). Even
if that were fixed, we would have to emit an empty/bare Constants.java
file, which isn't so nice (and anyway, -Ljava-constants is not needed at
all - it was to work around a frameworks.jar dependency loop which is
now fixed via hwbinder.stubs). So now instead of doing nothing,
explicitly returning an error.
Bug: 180023307
Test: manual
Change-Id: I7ddc9e520ccd107d03a6073b94dbc2a44f206e7d
diff --git a/main.cpp b/main.cpp
index f24affc..f262951 100644
--- a/main.cpp
+++ b/main.cpp
@@ -891,7 +891,11 @@
}
if (exportedTypes.empty()) {
- return OK;
+ fprintf(stderr,
+ "ERROR: -Ljava-constants (Android.bp: gen_java_constants) requested for %s, "
+ "but no types declare @export.",
+ packageFQName.string().c_str());
+ return UNKNOWN_ERROR;
}
Formatter out = getFormatter();