Fix apex_test.go and add it to Android.bp
apex_test.go wasn't listed in the Android.bp file, which allowed
it to bitrot. Make the API level methods take a PathContext
so that they can be called from a test using configErrorWrapper.
Also fix an int that was converted to a string.
Test: apex_test.go
Change-Id: I1ff87134c837bd5d344d22550baabde10d1b0b2e
diff --git a/android/apex.go b/android/apex.go
index c886962..1589a17 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -42,7 +42,7 @@
InApexes []string
}
-func (i ApexInfo) mergedName(ctx EarlyModuleContext) string {
+func (i ApexInfo) mergedName(ctx PathContext) string {
name := "apex" + strconv.Itoa(i.MinSdkVersion(ctx).FinalOrFutureInt())
for _, sdk := range i.RequiredSdks {
name += "_" + sdk.Name + "_" + sdk.Version
@@ -50,7 +50,7 @@
return name
}
-func (this *ApexInfo) MinSdkVersion(ctx EarlyModuleContext) ApiLevel {
+func (this *ApexInfo) MinSdkVersion(ctx PathContext) ApiLevel {
return ApiLevelOrPanic(ctx, this.MinSdkVersionStr)
}
@@ -358,7 +358,7 @@
// mergeApexVariations deduplicates APEX variations that would build identically into a common
// variation. It returns the reduced list of variations and a list of aliases from the original
// variation names to the new variation names.
-func mergeApexVariations(ctx EarlyModuleContext, apexVariations []ApexInfo) (merged []ApexInfo, aliases [][2]string) {
+func mergeApexVariations(ctx PathContext, apexVariations []ApexInfo) (merged []ApexInfo, aliases [][2]string) {
sort.Sort(byApexName(apexVariations))
seen := make(map[string]int)
for _, apexInfo := range apexVariations {