From fb7f7b99ffe95ab32cf8905d6815c81e991a0de3 Mon Sep 17 00:00:00 2001 From: Alix Date: Thu, 2 Mar 2023 19:35:02 +0000 Subject: [PATCH] Comments to keep Starlark/soong api logic in sync Test: none, added comments Change-Id: I706c516a3601716a439bd775666a93b63c5c4f27 --- android/api_levels.go | 6 ++++++ android/config.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/android/api_levels.go b/android/api_levels.go index 6d7552ff7..9440ee9e7 100644 --- a/android/api_levels.go +++ b/android/api_levels.go @@ -225,6 +225,8 @@ func ApiLevelFromUser(ctx PathContext, raw string) (ApiLevel, error) { // ApiLevelFromUserWithConfig implements ApiLevelFromUser, see comments for // ApiLevelFromUser for more details. func ApiLevelFromUserWithConfig(config Config, raw string) (ApiLevel, error) { + // This logic is replicated in starlark, if changing logic here update starlark code too + // https://cs.android.com/android/platform/superproject/+/master:build/bazel/rules/common/api.bzl;l=42;drc=231c7e8c8038fd478a79eb68aa5b9f5c64e0e061 if raw == "" { panic("API level string must be non-empty") } @@ -329,6 +331,8 @@ func getApiLevelsMapReleasedVersions() map[string]int { var finalCodenamesMapKey = NewOnceKey("FinalCodenamesMap") func getFinalCodenamesMap(config Config) map[string]int { + // This logic is replicated in starlark, if changing logic here update starlark code too + // https://cs.android.com/android/platform/superproject/+/master:build/bazel/rules/common/api.bzl;l=30;drc=231c7e8c8038fd478a79eb68aa5b9f5c64e0e061 return config.Once(finalCodenamesMapKey, func() interface{} { apiLevelsMap := getApiLevelsMapReleasedVersions() @@ -355,6 +359,8 @@ var apiLevelsMapKey = NewOnceKey("ApiLevelsMap") // ApiLevelsMap has entries for preview API levels func GetApiLevelsMap(config Config) map[string]int { + // This logic is replicated in starlark, if changing logic here update starlark code too + // https://cs.android.com/android/platform/superproject/+/master:build/bazel/rules/common/api.bzl;l=23;drc=231c7e8c8038fd478a79eb68aa5b9f5c64e0e061 return config.Once(apiLevelsMapKey, func() interface{} { apiLevelsMap := getApiLevelsMapReleasedVersions() for i, codename := range config.PlatformVersionActiveCodenames() { diff --git a/android/config.go b/android/config.go index 78da32036..8886f554d 100644 --- a/android/config.go +++ b/android/config.go @@ -875,6 +875,8 @@ func (c *config) AllSupportedApiLevels() []ApiLevel { // DefaultAppTargetSdk returns the API level that platform apps are targeting. // This converts a codename to the exact ApiLevel it represents. func (c *config) DefaultAppTargetSdk(ctx EarlyModuleContext) ApiLevel { + // This logic is replicated in starlark, if changing logic here update starlark code too + // https://cs.android.com/android/platform/superproject/+/master:build/bazel/rules/common/api.bzl;l=72;drc=231c7e8c8038fd478a79eb68aa5b9f5c64e0e061 if Bool(c.productVariables.Platform_sdk_final) { return c.PlatformSdkVersion() }