Merge "Simplify logic in Soong ApiLevelFromUserWithConfig"
This commit is contained in:
@@ -344,14 +344,17 @@ func ApiLevelFromUserWithConfig(config Config, raw string) (ApiLevel, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
canonical := ReplaceFinalizedCodenames(config, raw)
|
canonical, ok := getApiLevelsMapReleasedVersions()[raw]
|
||||||
asInt, err := strconv.Atoi(canonical)
|
if !ok {
|
||||||
if err != nil {
|
asInt, err := strconv.Atoi(raw)
|
||||||
return NoneApiLevel, fmt.Errorf("%q could not be parsed as an integer and is not a recognized codename", canonical)
|
if err != nil {
|
||||||
|
return NoneApiLevel, fmt.Errorf("%q could not be parsed as an integer and is not a recognized codename", raw)
|
||||||
|
}
|
||||||
|
return uncheckedFinalApiLevel(asInt), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
apiLevel := uncheckedFinalApiLevel(asInt)
|
return uncheckedFinalApiLevel(canonical), nil
|
||||||
return apiLevel, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ApiLevelForTest returns an ApiLevel constructed from the supplied raw string.
|
// ApiLevelForTest returns an ApiLevel constructed from the supplied raw string.
|
||||||
|
Reference in New Issue
Block a user