From 2e5d7d41f483d46508d7d7b23f65219fc8821000 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 29 Mar 2017 18:22:39 -0700 Subject: [PATCH] Add `sdk_version: "minimum"`. This maps to the lowest supported API level for the given architecture. Test: make checkbuild # after setting some things to use this Bug: None Change-Id: Ied6d44cb2719b73f35dde38a2dca6d3c87c7c924 --- cc/ndk_library.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cc/ndk_library.go b/cc/ndk_library.go index 6ebd0c461..c28b411d8 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -130,6 +130,16 @@ func normalizeNdkApiLevel(apiLevel string, arch android.Arch) (string, error) { "x86_64": 21, } + archStr := arch.ArchType.String() + firstArchVersion, ok := firstArchVersions[archStr] + if !ok { + panic(fmt.Errorf("Arch %q not found in firstArchVersions", archStr)) + } + + if apiLevel == "minimum" { + return strconv.Itoa(firstArchVersion), nil + } + // If the NDK drops support for a platform version, we don't want to have to // fix up every module that was using it as its SDK version. Clip to the // supported version here instead. @@ -139,12 +149,6 @@ func normalizeNdkApiLevel(apiLevel string, arch android.Arch) (string, error) { } version = intMax(version, minVersion) - archStr := arch.ArchType.String() - firstArchVersion, ok := firstArchVersions[archStr] - if !ok { - panic(fmt.Errorf("Arch %q not found in firstArchVersions", archStr)) - } - return strconv.Itoa(intMax(version, firstArchVersion)), nil }