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

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

Merge "Make Contents and Standalone_contents configurable" into main

parents 25777477 7103c4ff
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ type BootclasspathFragmentCoverageAffectedProperties struct {
	// property.
	//
	// The order of this list matters as it is the order that is used in the bootclasspath.
	Contents []string
	Contents proptools.Configurable[[]string] `android:"arch_variant"`

	// The properties for specifying the API stubs provided by this fragment.
	BootclasspathAPIProperties
@@ -295,8 +295,8 @@ func testBootclasspathFragmentFactory() android.Module {
	return m
}

func (m *BootclasspathFragmentModule) bootclasspathFragmentPropertyCheck(ctx android.EarlyModuleContext) {
	contents := m.properties.Contents
func (m *BootclasspathFragmentModule) bootclasspathFragmentPropertyCheck(ctx android.ModuleContext) {
	contents := m.properties.Contents.GetOrDefault(ctx, nil)
	if len(contents) == 0 {
		ctx.PropertyErrorf("contents", "required property is missing")
		return
@@ -434,7 +434,7 @@ func (b *BootclasspathFragmentModule) ComponentDepsMutator(ctx android.BottomUpM
	module := ctx.Module()
	_, isSourceModule := module.(*BootclasspathFragmentModule)

	for _, name := range b.properties.Contents {
	for _, name := range b.properties.Contents.GetOrDefault(ctx, nil) {
		// A bootclasspath_fragment must depend only on other source modules, while the
		// prebuilt_bootclasspath_fragment must only depend on other prebuilt modules.
		//
@@ -588,7 +588,7 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext)
		return global.ArtApexJars
	}

	possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, b.properties.Contents, bootclasspathFragmentContentDepTag)
	possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, b.properties.Contents.GetOrDefault(ctx, nil), bootclasspathFragmentContentDepTag)
	jars, unknown := global.ApexBootJars.Filter(possibleUpdatableModules)

	// TODO(satayev): for apex_test we want to include all contents unconditionally to classpaths
@@ -600,7 +600,7 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext)
	} else if android.InList("test_framework-apexd", possibleUpdatableModules) {
		jars = jars.Append("com.android.apex.test_package", "test_framework-apexd")
	} else if global.ApexBootJars.Len() != 0 {
		unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents)
		unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents.GetOrDefault(ctx, nil))
		_, unknown = android.RemoveFromList("core-icu4j", unknown)
		// This module only exists in car products.
		// So ignore it even if it is not in PRODUCT_APEX_BOOT_JARS.
@@ -847,7 +847,7 @@ func (b *BootclasspathFragmentModule) getProfilePath() android.Path {

// Collect information for opening IDE project files in java/jdeps.go.
func (b *BootclasspathFragmentModule) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
	dpInfo.Deps = append(dpInfo.Deps, b.properties.Contents...)
	dpInfo.Deps = append(dpInfo.Deps, b.properties.Contents.GetOrDefault(ctx, nil)...)
}

type bootclasspathFragmentMemberType struct {
@@ -923,7 +923,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
	module := variant.(*BootclasspathFragmentModule)

	b.Image_name = module.properties.Image_name
	b.Contents = module.properties.Contents
	b.Contents = module.properties.Contents.GetOrDefault(ctx.SdkModuleContext(), nil)

	// Get the hidden API information from the module.
	mctx := ctx.SdkModuleContext()
+2 −1
Original line number Diff line number Diff line
@@ -191,7 +191,8 @@ func TestBootclasspathFragment_Coverage(t *testing.T) {

	checkContents := func(t *testing.T, result *android.TestResult, expected ...string) {
		module := result.Module("myfragment", "android_common").(*BootclasspathFragmentModule)
		android.AssertArrayString(t, "contents property", expected, module.properties.Contents)
		eval := module.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
		android.AssertArrayString(t, "contents property", expected, module.properties.Contents.GetOrDefault(eval, nil))
	}

	preparer := android.GroupFixturePreparers(
+12 −11
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import (
	"android/soong/dexpreopt"

	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"
)

func init() {
@@ -98,12 +99,12 @@ type systemServerClasspathFragmentProperties struct {
	// List of system_server classpath jars, could be either java_library, or java_sdk_library.
	//
	// The order of this list matters as it is the order that is used in the SYSTEMSERVERCLASSPATH.
	Contents []string
	Contents proptools.Configurable[[]string] `android:"arch_variant"`

	// List of jars that system_server loads dynamically using separate classloaders.
	//
	// The order does not matter.
	Standalone_contents []string
	Standalone_contents proptools.Configurable[[]string] `android:"arch_variant"`
}

func systemServerClasspathFactory() android.Module {
@@ -116,7 +117,7 @@ func systemServerClasspathFactory() android.Module {
}

func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	if len(s.properties.Contents) == 0 && len(s.properties.Standalone_contents) == 0 {
	if len(s.properties.Contents.GetOrDefault(ctx, nil)) == 0 && len(s.properties.Standalone_contents.GetOrDefault(ctx, nil)) == 0 {
		ctx.PropertyErrorf("contents", "Either contents or standalone_contents needs to be non-empty")
	}

@@ -152,7 +153,7 @@ func (s *SystemServerClasspathModule) setPartitionInfoOfLibraries(ctx android.Mo
func (s *SystemServerClasspathModule) configuredJars(ctx android.ModuleContext) android.ConfiguredJarList {
	global := dexpreopt.GetGlobalConfig(ctx)

	possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Contents, systemServerClasspathFragmentContentDepTag)
	possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Contents.GetOrDefault(ctx, nil), systemServerClasspathFragmentContentDepTag)
	jars, unknown := global.ApexSystemServerJars.Filter(possibleUpdatableModules)
	// TODO(satayev): remove geotz ssc_fragment, since geotz is not part of SSCP anymore.
	_, unknown = android.RemoveFromList("geotz", unknown)
@@ -184,7 +185,7 @@ func (s *SystemServerClasspathModule) configuredJars(ctx android.ModuleContext)
func (s *SystemServerClasspathModule) standaloneConfiguredJars(ctx android.ModuleContext) android.ConfiguredJarList {
	global := dexpreopt.GetGlobalConfig(ctx)

	possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Standalone_contents, systemServerClasspathFragmentContentDepTag)
	possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Standalone_contents.GetOrDefault(ctx, nil), systemServerClasspathFragmentContentDepTag)
	jars, _ := global.ApexStandaloneSystemServerJars.Filter(possibleUpdatableModules)

	// TODO(jiakaiz): add a check to ensure that the contents are declared in make.
@@ -245,8 +246,8 @@ func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpM
	module := ctx.Module()
	_, isSourceModule := module.(*SystemServerClasspathModule)
	var deps []string
	deps = append(deps, s.properties.Contents...)
	deps = append(deps, s.properties.Standalone_contents...)
	deps = append(deps, s.properties.Contents.GetOrDefault(ctx, nil)...)
	deps = append(deps, s.properties.Standalone_contents.GetOrDefault(ctx, nil)...)

	for _, name := range deps {
		// A systemserverclasspath_fragment must depend only on other source modules, while the
@@ -260,8 +261,8 @@ func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpM

// Collect information for opening IDE project files in java/jdeps.go.
func (s *SystemServerClasspathModule) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
	dpInfo.Deps = append(dpInfo.Deps, s.properties.Contents...)
	dpInfo.Deps = append(dpInfo.Deps, s.properties.Standalone_contents...)
	dpInfo.Deps = append(dpInfo.Deps, s.properties.Contents.GetOrDefault(ctx, nil)...)
	dpInfo.Deps = append(dpInfo.Deps, s.properties.Standalone_contents.GetOrDefault(ctx, nil)...)
}

type systemServerClasspathFragmentMemberType struct {
@@ -302,8 +303,8 @@ type systemServerClasspathFragmentSdkMemberProperties struct {
func (s *systemServerClasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
	module := variant.(*SystemServerClasspathModule)

	s.Contents = module.properties.Contents
	s.Standalone_contents = module.properties.Standalone_contents
	s.Contents = module.properties.Contents.GetOrDefault(ctx.SdkModuleContext(), nil)
	s.Standalone_contents = module.properties.Standalone_contents.GetOrDefault(ctx.SdkModuleContext(), nil)
}

func (s *systemServerClasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {