Fix ChooseSdkVersion after api levels
I2954bb21c1cfdeb305f25cfb6c8711c930f6ed50 switched normalizeVersions
to work on ApiLevels, which inadvertantly caused it to return "current"
instead of "10000" for libraries that specify "current" in their stubs
property. ChooseSdkVersion couldn't handle "current" because it was
manually converting the version to an int. Switch ChooseSdkVersion
to use ApiLevels instead so that it can handle "current".
Test: m checkbuild
Change-Id: Id412359e092483ba419118dd03bc206fae702a96
diff --git a/cc/cc.go b/cc/cc.go
index fb7c8cf..3d4545d 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2465,7 +2465,7 @@
// when to use (unspecified) stubs, check min_sdk_version and choose the right one
if useThisDep && depIsStubs && !libDepTag.explicitlyVersioned {
- versionToUse, err := c.ChooseSdkVersion(ccDep.StubsVersions(), c.apexSdkVersion.FinalOrFutureInt())
+ versionToUse, err := c.ChooseSdkVersion(ctx, ccDep.StubsVersions(), c.apexSdkVersion)
if err != nil {
ctx.OtherModuleErrorf(dep, err.Error())
return
@@ -2488,7 +2488,7 @@
// if this is for use_vendor apex && dep has stubsVersions
// apply the same rule of apex sdk enforcement to choose right version
var err error
- versionToUse, err = c.ChooseSdkVersion(versions, c.apexSdkVersion.FinalOrFutureInt())
+ versionToUse, err = c.ChooseSdkVersion(ctx, versions, c.apexSdkVersion)
if err != nil {
ctx.OtherModuleErrorf(dep, err.Error())
return