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

Commit fea71752 authored by Sam Delmerico's avatar Sam Delmerico Committed by Automerger Merge Worker
Browse files

Merge "Use stubs for system_dynamic_deps" am: 969e375d am: 00dd119d am: 84665c0c

parents 62e927fc 84665c0c
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -1123,8 +1123,11 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
		// having stubs or not, so Bazel select() statement can be used to choose
		// having stubs or not, so Bazel select() statement can be used to choose
		// source/stub variants of them.
		// source/stub variants of them.
		apexAvailable := module.ApexAvailable()
		apexAvailable := module.ApexAvailable()
		setStubsForDynamicDeps(ctx, axis, config, apexAvailable, sharedDeps.export, &la.dynamicDeps, 0)
		setStubsForDynamicDeps(ctx, axis, config, apexAvailable, sharedDeps.export, &la.dynamicDeps, 0, false)
		setStubsForDynamicDeps(ctx, axis, config, apexAvailable, sharedDeps.implementation, &la.implementationDynamicDeps, 1)
		setStubsForDynamicDeps(ctx, axis, config, apexAvailable, sharedDeps.implementation, &la.implementationDynamicDeps, 1, false)
		if len(systemSharedLibs) > 0 {
			setStubsForDynamicDeps(ctx, axis, config, apexAvailable, bazelLabelForSharedDeps(ctx, systemSharedLibs), &la.systemDynamicDeps, 2, true)
		}
	}
	}


	if !BoolDefault(props.Pack_relocations, packRelocationsDefault) {
	if !BoolDefault(props.Pack_relocations, packRelocationsDefault) {
@@ -1194,7 +1197,7 @@ func availableToSameApexes(a, b []string) bool {
}
}


func setStubsForDynamicDeps(ctx android.BazelConversionPathContext, axis bazel.ConfigurationAxis,
func setStubsForDynamicDeps(ctx android.BazelConversionPathContext, axis bazel.ConfigurationAxis,
	config string, apexAvailable []string, dynamicLibs bazel.LabelList, dynamicDeps *bazel.LabelListAttribute, ind int) {
	config string, apexAvailable []string, dynamicLibs bazel.LabelList, dynamicDeps *bazel.LabelListAttribute, ind int, buildNonApexWithStubs bool) {


	depsWithStubs := []bazel.Label{}
	depsWithStubs := []bazel.Label{}
	for _, l := range dynamicLibs.Includes {
	for _, l := range dynamicLibs.Includes {
@@ -1220,16 +1223,20 @@ func setStubsForDynamicDeps(ctx android.BazelConversionPathContext, axis bazel.C
		inApexSelectValue := dynamicDeps.SelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex)
		inApexSelectValue := dynamicDeps.SelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex)
		nonApexSelectValue := dynamicDeps.SelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex)
		nonApexSelectValue := dynamicDeps.SelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex)
		defaultSelectValue := dynamicDeps.SelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey)
		defaultSelectValue := dynamicDeps.SelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey)
		nonApexDeps := depsWithStubs
		if buildNonApexWithStubs {
			nonApexDeps = stubLibLabels
		}
		if axis == bazel.NoConfigAxis {
		if axis == bazel.NoConfigAxis {
			(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
			(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
			(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
			(&nonApexSelectValue).Append(bazel.MakeLabelList(nonApexDeps))
			(&defaultSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
			(&defaultSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey, bazel.FirstUniqueBazelLabelList(defaultSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey, bazel.FirstUniqueBazelLabelList(defaultSelectValue))
		} else if config == bazel.OsAndroid {
		} else if config == bazel.OsAndroid {
			(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
			(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
			(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
			(&nonApexSelectValue).Append(bazel.MakeLabelList(nonApexDeps))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
			dynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
		}
		}