Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33128360 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Make stub_libs property configurable" into main

parents be891d5a aaff782c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ var platformBootclasspathDepTag = bootclasspathDependencyTag{name: "platform"}
type BootclasspathNestedAPIProperties struct {
	// java_library or preferably, java_sdk_library modules providing stub classes that define the
	// APIs provided by this bootclasspath_fragment.
	Stub_libs []string
	Stub_libs proptools.Configurable[[]string]
}

// BootclasspathAPIProperties defines properties for defining the API provided by parts of the
@@ -229,11 +229,11 @@ type BootclasspathAPIProperties struct {

// apiScopeToStubLibs calculates the stub library modules for each relevant *HiddenAPIScope from the
// Stub_libs properties.
func (p BootclasspathAPIProperties) apiScopeToStubLibs() map[*HiddenAPIScope][]string {
func (p BootclasspathAPIProperties) apiScopeToStubLibs(ctx android.BaseModuleContext) map[*HiddenAPIScope][]string {
	m := map[*HiddenAPIScope][]string{}
	for _, apiScope := range hiddenAPISdkLibrarySupportedScopes {
		m[apiScope] = p.Api.Stub_libs
		m[apiScope] = p.Api.Stub_libs.GetOrDefault(ctx, nil)
	}
	m[CorePlatformHiddenAPIScope] = p.Core_platform_api.Stub_libs
	m[CorePlatformHiddenAPIScope] = p.Core_platform_api.Stub_libs.GetOrDefault(ctx, nil)
	return m
}
+3 −3
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ func (b *BootclasspathFragmentModule) ComponentDepsMutator(ctx android.BottomUpM
func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorContext) {
	// Add dependencies onto all the modules that provide the API stubs for classes on this
	// bootclasspath fragment.
	hiddenAPIAddStubLibDependencies(ctx, b.properties.apiScopeToStubLibs())
	hiddenAPIAddStubLibDependencies(ctx, b.properties.apiScopeToStubLibs(ctx))

	for _, additionalStubModule := range b.properties.Additional_stubs {
		for _, apiScope := range hiddenAPISdkLibrarySupportedScopes {
@@ -933,8 +933,8 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
	b.Filtered_flags_path = android.OptionalPathForPath(hiddenAPIInfo.FilteredFlagsPath)

	// Copy stub_libs properties.
	b.Stub_libs = module.properties.Api.Stub_libs
	b.Core_platform_stub_libs = module.properties.Core_platform_api.Stub_libs
	b.Stub_libs = module.properties.Api.Stub_libs.GetOrDefault(mctx, nil)
	b.Core_platform_stub_libs = module.properties.Core_platform_api.Stub_libs.GetOrDefault(mctx, nil)

	// Copy fragment properties.
	b.Fragments = module.properties.Fragments