Loading android/api_levels.go +3 −11 Original line number Diff line number Diff line Loading @@ -184,17 +184,9 @@ var FirstNonLibAndroidSupportVersion = uncheckedFinalApiLevel(21) // a core-for-system-modules.jar for the module-lib API scope. var LastWithoutModuleLibCoreSystemModules = uncheckedFinalApiLevel(31) // If the `raw` input is the codename of an API level has been finalized, this // function returns the API level number associated with that API level. If the // input is *not* a finalized codename, the input is returned unmodified. // // For example, at the time of writing, R has been finalized as API level 30, // but S is in development so it has no number assigned. For the following // inputs: // // * "30" -> "30" // * "R" -> "30" // * "S" -> "S" // ReplaceFinalizedCodenames returns the API level number associated with that API level // if the `raw` input is the codename of an API level has been finalized. // If the input is *not* a finalized codename, the input is returned unmodified. func ReplaceFinalizedCodenames(config Config, raw string) string { num, ok := getFinalCodenamesMap(config)[raw] if !ok { Loading cc/cc_test.go +19 −0 Original line number Diff line number Diff line Loading @@ -3722,6 +3722,25 @@ func TestMinSdkVersionInClangTriple(t *testing.T) { android.AssertStringDoesContain(t, "min sdk version", cFlags, "-target aarch64-linux-android29") } func TestNonDigitMinSdkVersionInClangTriple(t *testing.T) { bp := ` cc_library_shared { name: "libfoo", srcs: ["foo.c"], min_sdk_version: "S", } ` result := android.GroupFixturePreparers( prepareForCcTest, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { variables.Platform_version_active_codenames = []string{"UpsideDownCake", "Tiramisu"} }), ).RunTestWithBp(t, bp) ctx := result.TestContext cFlags := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"] android.AssertStringDoesContain(t, "min sdk version", cFlags, "-target aarch64-linux-android31") } func TestIncludeDirsExporting(t *testing.T) { // Trim spaces from the beginning, end and immediately after any newline characters. Leaves Loading cc/compiler.go +2 −1 Original line number Diff line number Diff line Loading @@ -457,7 +457,8 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps if version == "" || version == "current" { target += strconv.Itoa(android.FutureApiLevelInt) } else { target += version apiLevel := nativeApiLevelOrPanic(ctx, version) target += apiLevel.String() } } Loading Loading
android/api_levels.go +3 −11 Original line number Diff line number Diff line Loading @@ -184,17 +184,9 @@ var FirstNonLibAndroidSupportVersion = uncheckedFinalApiLevel(21) // a core-for-system-modules.jar for the module-lib API scope. var LastWithoutModuleLibCoreSystemModules = uncheckedFinalApiLevel(31) // If the `raw` input is the codename of an API level has been finalized, this // function returns the API level number associated with that API level. If the // input is *not* a finalized codename, the input is returned unmodified. // // For example, at the time of writing, R has been finalized as API level 30, // but S is in development so it has no number assigned. For the following // inputs: // // * "30" -> "30" // * "R" -> "30" // * "S" -> "S" // ReplaceFinalizedCodenames returns the API level number associated with that API level // if the `raw` input is the codename of an API level has been finalized. // If the input is *not* a finalized codename, the input is returned unmodified. func ReplaceFinalizedCodenames(config Config, raw string) string { num, ok := getFinalCodenamesMap(config)[raw] if !ok { Loading
cc/cc_test.go +19 −0 Original line number Diff line number Diff line Loading @@ -3722,6 +3722,25 @@ func TestMinSdkVersionInClangTriple(t *testing.T) { android.AssertStringDoesContain(t, "min sdk version", cFlags, "-target aarch64-linux-android29") } func TestNonDigitMinSdkVersionInClangTriple(t *testing.T) { bp := ` cc_library_shared { name: "libfoo", srcs: ["foo.c"], min_sdk_version: "S", } ` result := android.GroupFixturePreparers( prepareForCcTest, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { variables.Platform_version_active_codenames = []string{"UpsideDownCake", "Tiramisu"} }), ).RunTestWithBp(t, bp) ctx := result.TestContext cFlags := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"] android.AssertStringDoesContain(t, "min sdk version", cFlags, "-target aarch64-linux-android31") } func TestIncludeDirsExporting(t *testing.T) { // Trim spaces from the beginning, end and immediately after any newline characters. Leaves Loading
cc/compiler.go +2 −1 Original line number Diff line number Diff line Loading @@ -457,7 +457,8 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps if version == "" || version == "current" { target += strconv.Itoa(android.FutureApiLevelInt) } else { target += version apiLevel := nativeApiLevelOrPanic(ctx, version) target += apiLevel.String() } } Loading