aboutsummaryrefslogtreecommitdiff
path: root/android/api_levels.go
diff options
context:
space:
mode:
authormosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
committermosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
commitc7bade461dc55726f62997d13a48582f7c4b4655 (patch)
treeea0588da76060a2038f54f67efd046ca77634b10 /android/api_levels.go
parent0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff)
parent89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff)
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits) Revert "install_symlink: Make symlink target configurable" Reapply "Clear as much of cc.Module as possible after GenerateBuildActions" Revert "rust: config: Fix missing CPU variant LD flags in Rust" Rename build-flag in outdir Revert^4 "cipd: Default CIPD proxy server to on, add opt-out" Convert check-vintf-all to phony with actions Create a partial implementation of check-vintf-all for soong-only Configure RBE rust pool based on build variant Revert^3 "Add sdk version check to arr" Add jdk.internal.invoke to the allowlist Make droid always depend on symbols zip Import Device and Odm skus Don't install gob_gen in Soong Remove bazel reference from run_integration_tests.sh Fix bootstrap_test.sh Don't panic in aconfig libraries when AllowMissingDependencies is set Avoid returning nil paths from PathForModuleSrc Revert "Flag controled clang version" Rework module target dependencies on required deps Revert^2 "Add sdk version check to arr" ... Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'android/api_levels.go')
-rw-r--r--android/api_levels.go57
1 files changed, 15 insertions, 42 deletions
diff --git a/android/api_levels.go b/android/api_levels.go
index c83fae878..8f0fe458e 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -19,10 +19,10 @@ import (
"fmt"
"strconv"
"strings"
-
- "github.com/google/blueprint/gobtools"
)
+//go:generate go run ../../blueprint/gobtools/codegen/gob_gen.go
+
func init() {
RegisterParallelSingletonType("api_levels", ApiLevelsSingleton)
}
@@ -37,6 +37,7 @@ const previewAPILevelBase = 9000
// Java has these, and they're managed with the SdkKind enum of the SdkSpec. A
// future cleanup should be to migrate SdkSpec to using ApiLevel instead of its
// SdkVersion int, and to move SdkSpec into this package.
+// @auto-generate: gob
type ApiLevel struct {
// The string representation of the API level.
value string
@@ -54,34 +55,6 @@ type ApiLevel struct {
isPreview bool
}
-type apiLevelGob struct {
- Value string
- Number int
- IsPreview bool
-}
-
-func (a *ApiLevel) ToGob() *apiLevelGob {
- return &apiLevelGob{
- Value: a.value,
- Number: a.number,
- IsPreview: a.isPreview,
- }
-}
-
-func (a *ApiLevel) FromGob(data *apiLevelGob) {
- a.value = data.Value
- a.number = data.Number
- a.isPreview = data.IsPreview
-}
-
-func (a ApiLevel) GobEncode() ([]byte, error) {
- return gobtools.CustomGobEncode[apiLevelGob](&a)
-}
-
-func (a *ApiLevel) GobDecode(data []byte) error {
- return gobtools.CustomGobDecode[apiLevelGob](data, a)
-}
-
func (this ApiLevel) FinalInt() int {
if this.IsInvalid() {
panic(fmt.Errorf("%v is not a recognized api_level\n", this))
@@ -259,7 +232,7 @@ func (this ApiLevel) LessThanOrEqualTo(other ApiLevel) bool {
return this.CompareTo(other) <= 0
}
-func uncheckedFinalApiLevel(num int) ApiLevel {
+func UncheckedFinalApiLevel(num int) ApiLevel {
return ApiLevel{
value: strconv.Itoa(num),
number: num,
@@ -299,32 +272,32 @@ func NewInvalidApiLevel(raw string) ApiLevel {
}
// The first version that introduced 64-bit ABIs.
-var FirstLp64Version = uncheckedFinalApiLevel(21)
+var FirstLp64Version = UncheckedFinalApiLevel(21)
// Android has had various kinds of packed relocations over the years
// (http://b/187907243).
//
// API level 30 is where the now-standard SHT_RELR is available.
-var FirstShtRelrVersion = uncheckedFinalApiLevel(30)
+var FirstShtRelrVersion = UncheckedFinalApiLevel(30)
// API level 28 introduced SHT_RELR when it was still Android-only, and used an
// Android-specific relocation.
-var FirstAndroidRelrVersion = uncheckedFinalApiLevel(28)
+var FirstAndroidRelrVersion = UncheckedFinalApiLevel(28)
// API level 23 was when we first had the Chrome relocation packer, which is
// obsolete and has been removed, but lld can now generate compatible packed
// relocations itself.
-var FirstPackedRelocationsVersion = uncheckedFinalApiLevel(23)
+var FirstPackedRelocationsVersion = UncheckedFinalApiLevel(23)
// LastWithoutModuleLibCoreSystemModules is the last API level where prebuilts/sdk does not contain
// a core-for-system-modules.jar for the module-lib API scope.
-var LastWithoutModuleLibCoreSystemModules = uncheckedFinalApiLevel(31)
+var LastWithoutModuleLibCoreSystemModules = UncheckedFinalApiLevel(31)
-var ApiLevelR = uncheckedFinalApiLevel(30)
+var ApiLevelR = UncheckedFinalApiLevel(30)
-var ApiLevelUpsideDownCake = uncheckedFinalApiLevel(34)
+var ApiLevelUpsideDownCake = UncheckedFinalApiLevel(34)
-var ApiLevelVanillaIceCream = uncheckedFinalApiLevel(35)
+var ApiLevelVanillaIceCream = UncheckedFinalApiLevel(35)
// 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.
@@ -399,10 +372,10 @@ func ApiLevelFromUserWithConfig(config Config, raw string) (ApiLevel, error) {
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
+ return UncheckedFinalApiLevel(asInt), nil
}
- return uncheckedFinalApiLevel(canonical), nil
+ return UncheckedFinalApiLevel(canonical), nil
}
@@ -439,7 +412,7 @@ func ApiLevelForTest(raw string) ApiLevel {
panic(fmt.Errorf("%q could not be parsed as an integer and is not a recognized codename", raw))
}
- apiLevel := uncheckedFinalApiLevel(asInt)
+ apiLevel := UncheckedFinalApiLevel(asInt)
return apiLevel
}