aboutsummaryrefslogtreecommitdiff
path: root/Coordinator.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2017-11-09 08:57:59 -0800
committerSteven Moreland <smoreland@google.com>2017-11-09 09:08:12 -0800
commit8775715b80249be323586dbacf01713e51546e38 (patch)
treebf361d0b1d259f654931d5a5128beba78a11a395 /Coordinator.cpp
parent5dabdfeabe150f03cea7d321eb97d94b9c24bc0b (diff)
downloadhidl-8775715b80249be323586dbacf01713e51546e38.tar.gz
Fix bug in enforceMinorVersionUprevs.
Every minor version uprev should extend the top-level interfaces from the previous minor version. In hidl-gen, we check that at least one interface is extended. Here, there was a problem where if the minor version upgrade contains an interface which is not in the previous package, then this was counted as an extended interface. The exact problem was that this statement: lastFQName.getPackageAndVersion() == prevPackage.getPackageAndVersion() considered an interface extended even if !lastFQNameExists. Since lastFQName was always constructed from prevPackage, this statement is always true. Test: problematic interface fails Test: hidl_version_test Change-Id: I41983ad5c44eae1903123d49a9106509e4005f7b
Diffstat (limited to 'Coordinator.cpp')
-rw-r--r--Coordinator.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Coordinator.cpp b/Coordinator.cpp
index b20b2a85..bd258a2f 100644
--- a/Coordinator.cpp
+++ b/Coordinator.cpp
@@ -580,7 +580,11 @@ status_t Coordinator::enforceMinorVersionUprevs(const FQName &currentPackage) co
bool lastFQNameExists = lastAST != nullptr && lastAST->getInterface() != nullptr;
- if (iface->superType()->fqName() != lastFQName && lastFQNameExists) {
+ if (!lastFQNameExists) {
+ continue;
+ }
+
+ if (iface->superType()->fqName() != lastFQName) {
std::cerr << "ERROR: Cannot enforce minor version uprevs for "
<< currentPackage.string() << ": " << iface->fqName().string() << " extends "
<< iface->superType()->fqName().string()
@@ -590,6 +594,7 @@ status_t Coordinator::enforceMinorVersionUprevs(const FQName &currentPackage) co
}
// at least one interface must extend the previous version
+ // @2.0::IFoo does not work. It must be @2.1::IFoo for at least one interface.
if (lastFQName.getPackageAndVersion() == prevPackage.getPackageAndVersion()) {
extendedInterface = true;
}