Add --apicheck that tells whether two API dumps are incompatible or not
aidl --apicheck old.aidl new.aidl
checks whether the API dump new.aidl is backwards compatible with the
old API dump old.aidl. Backwards compatible changes are ...
1) new package
2) new type (interface / parcelable)
3) new method at the end of the interface
4) new field at the end of the parcelable
5) argument name change
Any other change is considered as incompatible change. For example,
re-ordering methods or fields is an incompatible change.
Bug: 110758635
Test: m -j
Test: runtests.sh
Change-Id: I3deb66044823929768940cf8592ac030d33b719c
diff --git a/main.cpp b/main.cpp
index daaa6b5..c933ac0 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,6 +15,7 @@
*/
#include "aidl.h"
+#include "aidl_apicheck.h"
#include "io_delegate.h"
#include "logging.h"
#include "options.h"
@@ -45,8 +46,10 @@
return android::aidl::compile_aidl(options, io_delegate);
case Options::Task::PREPROCESS:
return android::aidl::preprocess_aidl(options, io_delegate) ? 0 : 1;
- case Options::Task::DUMPAPI:
+ case Options::Task::DUMP_API:
return android::aidl::dump_api(options, io_delegate) ? 0 : 1;
+ case Options::Task::CHECK_API:
+ return android::aidl::check_api(options, io_delegate);
default:
LOG(FATAL) << "aidl: internal error" << std::endl;
return 1;