2021-03-29 13:11:58 +02:00
|
|
|
// Copyright 2021 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package android
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2024-01-05 00:20:42 +01:00
|
|
|
"reflect"
|
2021-03-29 13:11:58 +02:00
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
type SdkContext interface {
|
|
|
|
// SdkVersion returns SdkSpec that corresponds to the sdk_version property of the current module
|
2021-04-02 01:45:46 +02:00
|
|
|
SdkVersion(ctx EarlyModuleContext) SdkSpec
|
2021-03-29 13:11:58 +02:00
|
|
|
// SystemModules returns the system_modules property of the current module, or an empty string if it is not set.
|
|
|
|
SystemModules() string
|
2023-03-03 22:20:36 +01:00
|
|
|
// MinSdkVersion returns ApiLevel that corresponds to the min_sdk_version property of the current module,
|
2021-03-29 13:11:58 +02:00
|
|
|
// or from sdk_version if it is not set.
|
2023-03-03 22:20:36 +01:00
|
|
|
MinSdkVersion(ctx EarlyModuleContext) ApiLevel
|
2023-03-02 01:56:06 +01:00
|
|
|
// ReplaceMaxSdkVersionPlaceholder returns Apilevel to replace the maxSdkVersion property of permission and
|
2022-05-17 22:21:50 +02:00
|
|
|
// uses-permission tags if it is set.
|
2023-03-02 01:56:06 +01:00
|
|
|
ReplaceMaxSdkVersionPlaceholder(ctx EarlyModuleContext) ApiLevel
|
2023-03-02 00:38:49 +01:00
|
|
|
// TargetSdkVersion returns the ApiLevel that corresponds to the target_sdk_version property of the current module,
|
2021-03-29 13:11:58 +02:00
|
|
|
// or from sdk_version if it is not set.
|
2023-03-02 00:38:49 +01:00
|
|
|
TargetSdkVersion(ctx EarlyModuleContext) ApiLevel
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SdkKind represents a particular category of an SDK spec like public, system, test, etc.
|
|
|
|
type SdkKind int
|
|
|
|
|
2024-05-04 01:08:12 +02:00
|
|
|
// These are generally ordered from the narrower sdk version to the wider sdk version,
|
|
|
|
// but not all entries have a strict subset/superset relationship.
|
|
|
|
// For example, SdkTest and SdkModule do not have a strict subset/superset relationship but both
|
|
|
|
// are supersets of SdkSystem.
|
|
|
|
// The general trend should be kept when an additional sdk kind is added.
|
2021-03-29 13:11:58 +02:00
|
|
|
const (
|
|
|
|
SdkInvalid SdkKind = iota
|
|
|
|
SdkNone
|
2024-05-04 01:08:12 +02:00
|
|
|
SdkToolchain // API surface provided by ART to compile other API domains
|
2021-03-29 13:11:58 +02:00
|
|
|
SdkCore
|
|
|
|
SdkCorePlatform
|
2022-11-28 19:48:51 +01:00
|
|
|
SdkIntraCore // API surface provided by one core module to another
|
2021-03-29 13:11:58 +02:00
|
|
|
SdkPublic
|
|
|
|
SdkSystem
|
|
|
|
SdkTest
|
2023-08-10 02:07:03 +02:00
|
|
|
SdkTestFrameworksCore
|
2021-03-29 13:11:58 +02:00
|
|
|
SdkModule
|
|
|
|
SdkSystemServer
|
|
|
|
SdkPrivate
|
|
|
|
)
|
|
|
|
|
|
|
|
// String returns the string representation of this SdkKind
|
|
|
|
func (k SdkKind) String() string {
|
|
|
|
switch k {
|
|
|
|
case SdkPrivate:
|
|
|
|
return "private"
|
|
|
|
case SdkNone:
|
|
|
|
return "none"
|
|
|
|
case SdkPublic:
|
|
|
|
return "public"
|
|
|
|
case SdkSystem:
|
|
|
|
return "system"
|
|
|
|
case SdkTest:
|
|
|
|
return "test"
|
2023-08-10 02:07:03 +02:00
|
|
|
case SdkTestFrameworksCore:
|
|
|
|
return "test_frameworks_core"
|
2021-03-29 13:11:58 +02:00
|
|
|
case SdkCore:
|
|
|
|
return "core"
|
|
|
|
case SdkCorePlatform:
|
|
|
|
return "core_platform"
|
2022-11-28 19:48:51 +01:00
|
|
|
case SdkIntraCore:
|
|
|
|
return "intracore"
|
2021-03-29 13:11:58 +02:00
|
|
|
case SdkModule:
|
|
|
|
return "module-lib"
|
|
|
|
case SdkSystemServer:
|
|
|
|
return "system-server"
|
2022-12-28 02:54:29 +01:00
|
|
|
case SdkToolchain:
|
|
|
|
return "toolchain"
|
2021-03-29 13:11:58 +02:00
|
|
|
default:
|
|
|
|
return "invalid"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-05 23:08:08 +02:00
|
|
|
func (k SdkKind) DefaultJavaLibraryName() string {
|
2023-03-20 19:52:50 +01:00
|
|
|
switch k {
|
|
|
|
case SdkPublic:
|
|
|
|
return "android_stubs_current"
|
|
|
|
case SdkSystem:
|
|
|
|
return "android_system_stubs_current"
|
|
|
|
case SdkTest:
|
|
|
|
return "android_test_stubs_current"
|
2023-08-10 02:07:03 +02:00
|
|
|
case SdkTestFrameworksCore:
|
|
|
|
return "android_test_frameworks_core_stubs_current"
|
2023-03-20 19:52:50 +01:00
|
|
|
case SdkCore:
|
|
|
|
return "core.current.stubs"
|
|
|
|
case SdkModule:
|
|
|
|
return "android_module_lib_stubs_current"
|
|
|
|
case SdkSystemServer:
|
|
|
|
return "android_system_server_stubs_current"
|
|
|
|
default:
|
|
|
|
panic(fmt.Errorf("APIs of API surface %v cannot be provided by a single Soong module\n", k))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-26 20:08:01 +01:00
|
|
|
func (k SdkKind) DefaultExportableJavaLibraryName() string {
|
|
|
|
switch k {
|
|
|
|
case SdkPublic, SdkSystem, SdkTest, SdkModule, SdkSystemServer:
|
|
|
|
return k.DefaultJavaLibraryName() + "_exportable"
|
|
|
|
case SdkCore:
|
|
|
|
return k.DefaultJavaLibraryName() + ".exportable"
|
|
|
|
default:
|
|
|
|
panic(fmt.Errorf("API surface %v does not provide exportable stubs", k))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-29 13:11:58 +02:00
|
|
|
// SdkSpec represents the kind and the version of an SDK for a module to build against
|
|
|
|
type SdkSpec struct {
|
2021-03-31 11:17:53 +02:00
|
|
|
Kind SdkKind
|
|
|
|
ApiLevel ApiLevel
|
|
|
|
Raw string
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s SdkSpec) String() string {
|
2021-03-31 11:17:53 +02:00
|
|
|
return fmt.Sprintf("%s_%s", s.Kind, s.ApiLevel)
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Valid checks if this SdkSpec is well-formed. Note however that true doesn't mean that the
|
|
|
|
// specified SDK actually exists.
|
|
|
|
func (s SdkSpec) Valid() bool {
|
|
|
|
return s.Kind != SdkInvalid
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specified checks if this SdkSpec is well-formed and is not "".
|
|
|
|
func (s SdkSpec) Specified() bool {
|
|
|
|
return s.Valid() && s.Kind != SdkPrivate
|
|
|
|
}
|
|
|
|
|
|
|
|
// whether the API surface is managed and versioned, i.e. has .txt file that
|
|
|
|
// get frozen on SDK freeze and changes get reviewed by API council.
|
|
|
|
func (s SdkSpec) Stable() bool {
|
|
|
|
if !s.Specified() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
switch s.Kind {
|
|
|
|
case SdkNone:
|
|
|
|
// there is nothing to manage and version in this case; de facto stable API.
|
|
|
|
return true
|
|
|
|
case SdkCore, SdkPublic, SdkSystem, SdkModule, SdkSystemServer:
|
|
|
|
return true
|
2023-08-10 02:07:03 +02:00
|
|
|
case SdkCorePlatform, SdkTest, SdkTestFrameworksCore, SdkPrivate:
|
2021-03-29 13:11:58 +02:00
|
|
|
return false
|
|
|
|
default:
|
|
|
|
panic(fmt.Errorf("unknown SdkKind=%v", s.Kind))
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2021-12-01 18:39:48 +01:00
|
|
|
// PrebuiltSdkAvailableForUnbundledBuild tells whether this SdkSpec can have a prebuilt SDK
|
2021-03-29 13:11:58 +02:00
|
|
|
// that can be used for unbundled builds.
|
|
|
|
func (s SdkSpec) PrebuiltSdkAvailableForUnbundledBuild() bool {
|
|
|
|
// "", "none", and "core_platform" are not available for unbundled build
|
|
|
|
// as we don't/can't have prebuilt stub for the versions
|
|
|
|
return s.Kind != SdkPrivate && s.Kind != SdkNone && s.Kind != SdkCorePlatform
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s SdkSpec) ForVendorPartition(ctx EarlyModuleContext) SdkSpec {
|
|
|
|
// If BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES has a numeric value,
|
|
|
|
// use it instead of "current" for the vendor partition.
|
|
|
|
currentSdkVersion := ctx.DeviceConfig().CurrentApiLevelForVendorModules()
|
2024-01-05 00:20:42 +01:00
|
|
|
// b/314011075: special case for Java modules in vendor partition. They can no longer use
|
|
|
|
// SDK 35 or later. Their maximum API level is limited to 34 (Android U). This is to
|
|
|
|
// discourage the use of Java APIs in the vendor partition which hasn't been officially
|
|
|
|
// supported since the Project Treble back in Android 10. We would like to eventually
|
|
|
|
// evacuate all Java modules from the partition, but that shall be done progressively.
|
|
|
|
// Note that the check for the availability of SDK 34 is to not break existing tests where
|
|
|
|
// any of the frozen SDK version is unavailable.
|
|
|
|
if isJava(ctx.Module()) && isSdkVersion34AvailableIn(ctx.Config()) {
|
|
|
|
currentSdkVersion = "34"
|
|
|
|
}
|
|
|
|
|
2021-03-29 13:11:58 +02:00
|
|
|
if currentSdkVersion == "current" {
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
if s.Kind == SdkPublic || s.Kind == SdkSystem {
|
2021-03-31 11:17:53 +02:00
|
|
|
if s.ApiLevel.IsCurrent() {
|
2021-03-29 13:11:58 +02:00
|
|
|
if i, err := strconv.Atoi(currentSdkVersion); err == nil {
|
2021-03-31 11:17:53 +02:00
|
|
|
apiLevel := uncheckedFinalApiLevel(i)
|
|
|
|
return SdkSpec{s.Kind, apiLevel, s.Raw}
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
panic(fmt.Errorf("BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES must be either \"current\" or a number, but was %q", currentSdkVersion))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
// UsePrebuilt determines whether prebuilt SDK should be used for this SdkSpec with the given context.
|
|
|
|
func (s SdkSpec) UsePrebuilt(ctx EarlyModuleContext) bool {
|
2021-04-15 09:53:05 +02:00
|
|
|
switch s {
|
|
|
|
case SdkSpecNone, SdkSpecCorePlatform, SdkSpecPrivate:
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2021-03-31 11:17:53 +02:00
|
|
|
if s.ApiLevel.IsCurrent() {
|
2021-03-29 13:11:58 +02:00
|
|
|
// "current" can be built from source and be from prebuilt SDK
|
|
|
|
return ctx.Config().AlwaysUsePrebuiltSdks()
|
2021-03-31 11:17:53 +02:00
|
|
|
} else if !s.ApiLevel.IsPreview() {
|
2021-03-29 13:11:58 +02:00
|
|
|
// validation check
|
2023-08-10 02:07:03 +02:00
|
|
|
if s.Kind != SdkPublic && s.Kind != SdkSystem && s.Kind != SdkTest &&
|
|
|
|
s.Kind != SdkTestFrameworksCore && s.Kind != SdkModule && s.Kind != SdkSystemServer {
|
2021-03-29 13:11:58 +02:00
|
|
|
panic(fmt.Errorf("prebuilt SDK is not not available for SdkKind=%q", s.Kind))
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
// numbered SDKs are always from prebuilt
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2021-03-31 11:17:53 +02:00
|
|
|
// EffectiveVersion converts an SdkSpec into the concrete ApiLevel that the module should use. For
|
|
|
|
// modules targeting an unreleased SDK (meaning it does not yet have a number) it returns
|
|
|
|
// FutureApiLevel(10000).
|
|
|
|
func (s SdkSpec) EffectiveVersion(ctx EarlyModuleContext) (ApiLevel, error) {
|
2021-03-29 13:11:58 +02:00
|
|
|
if !s.Valid() {
|
2021-03-31 11:17:53 +02:00
|
|
|
return s.ApiLevel, fmt.Errorf("invalid sdk version %q", s.Raw)
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ctx.DeviceSpecific() || ctx.SocSpecific() {
|
|
|
|
s = s.ForVendorPartition(ctx)
|
|
|
|
}
|
2023-01-05 02:03:47 +01:00
|
|
|
return s.ApiLevel.EffectiveVersion(ctx)
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// EffectiveVersionString converts an SdkSpec into the concrete version string that the module
|
|
|
|
// should use. For modules targeting an unreleased SDK (meaning it does not yet have a number)
|
|
|
|
// it returns the codename (P, Q, R, etc.)
|
|
|
|
func (s SdkSpec) EffectiveVersionString(ctx EarlyModuleContext) (string, error) {
|
2021-03-31 11:17:53 +02:00
|
|
|
if !s.Valid() {
|
|
|
|
return s.ApiLevel.String(), fmt.Errorf("invalid sdk version %q", s.Raw)
|
|
|
|
}
|
|
|
|
|
|
|
|
if ctx.DeviceSpecific() || ctx.SocSpecific() {
|
|
|
|
s = s.ForVendorPartition(ctx)
|
|
|
|
}
|
2023-01-05 02:03:47 +01:00
|
|
|
return s.ApiLevel.EffectiveVersionString(ctx)
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
|
2021-04-02 01:45:46 +02:00
|
|
|
var (
|
2021-04-15 09:53:05 +02:00
|
|
|
SdkSpecNone = SdkSpec{SdkNone, NoneApiLevel, "(no version)"}
|
2023-03-03 00:36:39 +01:00
|
|
|
SdkSpecPrivate = SdkSpec{SdkPrivate, PrivateApiLevel, ""}
|
2021-04-15 09:53:05 +02:00
|
|
|
SdkSpecCorePlatform = SdkSpec{SdkCorePlatform, FutureApiLevel, "core_platform"}
|
2021-04-02 01:45:46 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func SdkSpecFrom(ctx EarlyModuleContext, str string) SdkSpec {
|
2021-12-01 18:39:48 +01:00
|
|
|
return SdkSpecFromWithConfig(ctx.Config(), str)
|
|
|
|
}
|
|
|
|
|
|
|
|
func SdkSpecFromWithConfig(config Config, str string) SdkSpec {
|
2021-03-29 13:11:58 +02:00
|
|
|
switch str {
|
|
|
|
// special cases first
|
|
|
|
case "":
|
2021-04-02 01:45:46 +02:00
|
|
|
return SdkSpecPrivate
|
2021-03-29 13:11:58 +02:00
|
|
|
case "none":
|
2021-04-02 01:45:46 +02:00
|
|
|
return SdkSpecNone
|
2021-03-29 13:11:58 +02:00
|
|
|
case "core_platform":
|
2021-04-02 01:45:46 +02:00
|
|
|
return SdkSpecCorePlatform
|
2021-03-29 13:11:58 +02:00
|
|
|
default:
|
|
|
|
// the syntax is [kind_]version
|
|
|
|
sep := strings.LastIndex(str, "_")
|
|
|
|
|
|
|
|
var kindString string
|
|
|
|
if sep == 0 {
|
2023-03-03 00:36:39 +01:00
|
|
|
return SdkSpec{SdkInvalid, NewInvalidApiLevel(str), str}
|
2021-03-29 13:11:58 +02:00
|
|
|
} else if sep == -1 {
|
|
|
|
kindString = ""
|
|
|
|
} else {
|
|
|
|
kindString = str[0:sep]
|
|
|
|
}
|
|
|
|
versionString := str[sep+1 : len(str)]
|
|
|
|
|
|
|
|
var kind SdkKind
|
|
|
|
switch kindString {
|
|
|
|
case "":
|
|
|
|
kind = SdkPublic
|
|
|
|
case "core":
|
|
|
|
kind = SdkCore
|
|
|
|
case "system":
|
|
|
|
kind = SdkSystem
|
|
|
|
case "test":
|
|
|
|
kind = SdkTest
|
2023-08-10 02:07:03 +02:00
|
|
|
case "test_frameworks_core":
|
|
|
|
kind = SdkTestFrameworksCore
|
2021-03-29 13:11:58 +02:00
|
|
|
case "module":
|
|
|
|
kind = SdkModule
|
|
|
|
case "system_server":
|
|
|
|
kind = SdkSystemServer
|
|
|
|
default:
|
2021-03-31 11:17:53 +02:00
|
|
|
return SdkSpec{SdkInvalid, NoneApiLevel, str}
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
|
2021-12-01 18:39:48 +01:00
|
|
|
apiLevel, err := ApiLevelFromUserWithConfig(config, versionString)
|
2021-04-02 01:45:46 +02:00
|
|
|
if err != nil {
|
2023-03-03 00:36:39 +01:00
|
|
|
return SdkSpec{SdkInvalid, NewInvalidApiLevel(versionString), str}
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
2021-03-31 11:17:53 +02:00
|
|
|
return SdkSpec{kind, apiLevel, str}
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-05 00:20:42 +01:00
|
|
|
// Checks if the use of this SDK `s` is valid for the given module context `ctx`.
|
2021-03-29 13:11:58 +02:00
|
|
|
func (s SdkSpec) ValidateSystemSdk(ctx EarlyModuleContext) bool {
|
2024-01-05 00:20:42 +01:00
|
|
|
// Do some early checks. This check is currently only for Java modules. And our only concern
|
|
|
|
// is the use of "system" SDKs.
|
2024-01-05 00:21:26 +01:00
|
|
|
if !isJava(ctx.Module()) || s.Kind != SdkSystem || ctx.DeviceConfig().BuildBrokenDontCheckSystemSdk() {
|
2021-03-29 13:11:58 +02:00
|
|
|
return true
|
|
|
|
}
|
2024-01-05 00:20:42 +01:00
|
|
|
|
|
|
|
inVendor := ctx.DeviceSpecific() || ctx.SocSpecific()
|
|
|
|
inProduct := ctx.ProductSpecific()
|
|
|
|
isProductUnbundled := ctx.Config().EnforceProductPartitionInterface()
|
|
|
|
inApex := false
|
|
|
|
if am, ok := ctx.Module().(ApexModule); ok {
|
|
|
|
inApex = am.InAnyApex()
|
|
|
|
}
|
|
|
|
isUnbundled := inVendor || (inProduct && isProductUnbundled) || inApex
|
|
|
|
|
|
|
|
// Bundled modules can use any SDK
|
|
|
|
if !isUnbundled {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unbundled modules are allowed to use BOARD_SYSTEMSDK_VERSIONS
|
|
|
|
supportedVersions := ctx.DeviceConfig().SystemSdkVersions()
|
|
|
|
|
|
|
|
// b/314011075: special case for vendor modules. Java modules in the vendor partition can
|
|
|
|
// not use SDK 35 or later. This is to discourage the use of Java APIs in the vendor
|
|
|
|
// partition which hasn't been officially supported since the Project Treble back in Android
|
|
|
|
// 10. We would like to eventually evacuate all Java modules from the partition, but that
|
|
|
|
// shall be done progressively.
|
|
|
|
if inVendor {
|
|
|
|
// 28 was the API when BOARD_SYSTEMSDK_VERSIONS was introduced, so that's the oldest
|
|
|
|
// we should allow.
|
|
|
|
supportedVersions = []string{}
|
|
|
|
for v := 28; v <= 34; v++ {
|
|
|
|
supportedVersions = append(supportedVersions, strconv.Itoa(v))
|
2021-03-29 13:11:58 +02:00
|
|
|
}
|
|
|
|
}
|
2024-01-05 00:20:42 +01:00
|
|
|
|
|
|
|
// APEXes in the system partition are still considered as part of the platform, thus can use
|
|
|
|
// more SDKs from PLATFORM_SYSTEMSDK_VERSIONS
|
|
|
|
if inApex && !inVendor {
|
|
|
|
supportedVersions = ctx.DeviceConfig().PlatformSystemSdkVersions()
|
|
|
|
}
|
|
|
|
|
|
|
|
thisVer, err := s.EffectiveVersion(ctx)
|
|
|
|
if err != nil {
|
|
|
|
ctx.PropertyErrorf("sdk_version", "invalid sdk version %q", s.Raw)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
thisVerString := strconv.Itoa(thisVer.FinalOrPreviewInt())
|
|
|
|
if thisVer.IsPreview() {
|
|
|
|
thisVerString = *ctx.Config().productVariables.Platform_sdk_version_or_codename
|
|
|
|
}
|
|
|
|
|
|
|
|
if !InList(thisVerString, supportedVersions) {
|
2021-03-29 13:11:58 +02:00
|
|
|
ctx.PropertyErrorf("sdk_version", "incompatible sdk version %q. System SDK version should be one of %q",
|
2024-01-05 00:20:42 +01:00
|
|
|
s.Raw, supportedVersions)
|
2021-03-29 13:11:58 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
2023-03-20 21:20:58 +01:00
|
|
|
|
2024-01-05 00:20:42 +01:00
|
|
|
func isJava(m Module) bool {
|
|
|
|
moduleType := reflect.TypeOf(m).String()
|
|
|
|
return strings.HasPrefix(moduleType, "*java.")
|
|
|
|
}
|
|
|
|
|
|
|
|
func isSdkVersion34AvailableIn(c Config) bool {
|
|
|
|
return c.PlatformSdkVersion().FinalInt() >= 34
|
|
|
|
}
|
|
|
|
|
2023-03-20 21:20:58 +01:00
|
|
|
func init() {
|
|
|
|
RegisterMakeVarsProvider(pctx, javaSdkMakeVars)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Export the name of the soong modules representing the various Java API surfaces.
|
|
|
|
func javaSdkMakeVars(ctx MakeVarsContext) {
|
2023-05-30 21:12:28 +02:00
|
|
|
ctx.Strict("ANDROID_PUBLIC_STUBS", SdkPublic.DefaultJavaLibraryName())
|
2024-02-05 23:45:24 +01:00
|
|
|
ctx.Strict("ANDROID_PUBLIC_EXPORTABLE_STUBS", SdkPublic.DefaultExportableJavaLibraryName())
|
2023-05-30 21:12:28 +02:00
|
|
|
ctx.Strict("ANDROID_SYSTEM_STUBS", SdkSystem.DefaultJavaLibraryName())
|
|
|
|
ctx.Strict("ANDROID_TEST_STUBS", SdkTest.DefaultJavaLibraryName())
|
|
|
|
ctx.Strict("ANDROID_MODULE_LIB_STUBS", SdkModule.DefaultJavaLibraryName())
|
|
|
|
ctx.Strict("ANDROID_SYSTEM_SERVER_STUBS", SdkSystemServer.DefaultJavaLibraryName())
|
|
|
|
ctx.Strict("ANDROID_CORE_STUBS", SdkCore.DefaultJavaLibraryName())
|
2023-03-20 21:20:58 +01:00
|
|
|
}
|