summaryrefslogtreecommitdiff
path: root/api/api.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2024-07-18 18:52:03 +0000
committer Jihoon Kang <jihoonkang@google.com> 2024-07-18 18:55:26 +0000
commitcc4c8f9f9c415a234fe9852a276e2bf6c654cae8 (patch)
treeb6cc5481a4135f25e1c262a247718178a3a81cf3 /api/api.go
parent4c5fbae087f40088523089993abe4249fdb98fb7 (diff)
Support select in combined_apis properties
This change allows combined_apis.bootclasspath and combined_apis.system_server_classpath properties to be modified based on configuration using select statements. Bug: 349800749 Test: m nothing --no-skip-soong-tests Change-Id: I08bf4200738268fe833389f15e24271058528944
Diffstat (limited to 'api/api.go')
-rw-r--r--api/api.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/api/api.go b/api/api.go
index d4db49e90a01..f0d1f42f61d4 100644
--- a/api/api.go
+++ b/api/api.go
@@ -54,11 +54,11 @@ var non_updatable_modules = []string{virtualization, location}
// The properties of the combined_apis module type.
type CombinedApisProperties struct {
// Module libraries in the bootclasspath
- Bootclasspath []string
+ Bootclasspath proptools.Configurable[[]string]
// Module libraries on the bootclasspath if include_nonpublic_framework_api is true.
Conditional_bootclasspath []string
// Module libraries in system server
- System_server_classpath []string
+ System_server_classpath proptools.Configurable[[]string]
}
type CombinedApis struct {
@@ -79,29 +79,37 @@ func registerBuildComponents(ctx android.RegistrationContext) {
var PrepareForCombinedApisTest = android.FixtureRegisterWithContext(registerBuildComponents)
-func (a *CombinedApis) apiFingerprintStubDeps() []string {
+func (a *CombinedApis) bootclasspath(ctx android.ConfigAndErrorContext) []string {
+ return a.properties.Bootclasspath.GetOrDefault(a.ConfigurableEvaluator(ctx), nil)
+}
+
+func (a *CombinedApis) systemServerClasspath(ctx android.ConfigAndErrorContext) []string {
+ return a.properties.System_server_classpath.GetOrDefault(a.ConfigurableEvaluator(ctx), nil)
+}
+
+func (a *CombinedApis) apiFingerprintStubDeps(ctx android.BottomUpMutatorContext) []string {
ret := []string{}
ret = append(
ret,
- transformArray(a.properties.Bootclasspath, "", ".stubs")...,
+ transformArray(a.bootclasspath(ctx), "", ".stubs")...,
)
ret = append(
ret,
- transformArray(a.properties.Bootclasspath, "", ".stubs.system")...,
+ transformArray(a.bootclasspath(ctx), "", ".stubs.system")...,
)
ret = append(
ret,
- transformArray(a.properties.Bootclasspath, "", ".stubs.module_lib")...,
+ transformArray(a.bootclasspath(ctx), "", ".stubs.module_lib")...,
)
ret = append(
ret,
- transformArray(a.properties.System_server_classpath, "", ".stubs.system_server")...,
+ transformArray(a.systemServerClasspath(ctx), "", ".stubs.system_server")...,
)
return ret
}
func (a *CombinedApis) DepsMutator(ctx android.BottomUpMutatorContext) {
- ctx.AddDependency(ctx.Module(), nil, a.apiFingerprintStubDeps()...)
+ ctx.AddDependency(ctx.Module(), nil, a.apiFingerprintStubDeps(ctx)...)
}
func (a *CombinedApis) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -532,8 +540,8 @@ func createFullExportableApiLibraries(ctx android.LoadHookContext) {
}
func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
- bootclasspath := a.properties.Bootclasspath
- system_server_classpath := a.properties.System_server_classpath
+ bootclasspath := a.bootclasspath(ctx)
+ system_server_classpath := a.systemServerClasspath(ctx)
if ctx.Config().VendorConfig("ANDROID").Bool("include_nonpublic_framework_api") {
bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...)
sort.Strings(bootclasspath)