Allow PrevVendorApiLevel to be less than 34

Some developers need to set VendorApiLevel to 34. Though the
configuration is not officially supported, the ABI checker supports it
on a best-effort basis.

Test: make
Bug: 320347314
Change-Id: Ic3f5ea2028329f5d04606760b07947b7c98b2e51
This commit is contained in:
Hsin-Yi Chen
2024-03-05 15:56:44 +08:00
parent 3ce80aef7f
commit 890e7722e7

View File

@@ -1348,13 +1348,16 @@ func (c *config) PrevVendorApiLevel() string {
panic(fmt.Errorf("Cannot parse vendor API level %s to an integer: %s",
c.VendorApiLevel(), err))
}
if vendorApiLevel < 202404 || vendorApiLevel%100 != 4 {
panic("Unknown vendor API level " + c.VendorApiLevel())
}
// The version before trunk stable is 34.
if vendorApiLevel == 202404 {
return "34"
}
if vendorApiLevel >= 1 && vendorApiLevel <= 34 {
return strconv.Itoa(vendorApiLevel - 1)
}
if vendorApiLevel < 202404 || vendorApiLevel%100 != 4 {
panic("Unknown vendor API level " + c.VendorApiLevel())
}
return strconv.Itoa(vendorApiLevel - 100)
}