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

Commit 051ea998 authored by Colin Cross's avatar Colin Cross Committed by Automerger Merge Worker
Browse files

Merge "Start using Providers instead of direct module access" am: d4620701

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1439475

Change-Id: I27cacc976cd2136965df0aac6052c011ba32ef8d
parents e3d0a6f1 d4620701
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -145,11 +145,6 @@ type ApexModule interface {
	// check-platform-availability mutator in the apex package.
	SetNotAvailableForPlatform()

	// Returns the highest version which is <= maxSdkVersion.
	// For example, with maxSdkVersion is 10 and versionList is [9,11]
	// it returns 9 as string
	ChooseSdkVersion(ctx BaseModuleContext, versionList []string, maxSdkVersion ApiLevel) (string, error)

	// List of APEXes that this module tests. The module has access to
	// the private part of the listed APEXes even when it is not included in the
	// APEXes.
@@ -310,20 +305,6 @@ func (m *ApexModuleBase) DepIsInSameApex(ctx BaseModuleContext, dep Module) bool
	return true
}

func (m *ApexModuleBase) ChooseSdkVersion(ctx BaseModuleContext, versionList []string, maxSdkVersion ApiLevel) (string, error) {
	for i := range versionList {
		version := versionList[len(versionList)-i-1]
		ver, err := ApiLevelFromUser(ctx, version)
		if err != nil {
			return "", err
		}
		if ver.LessThanOrEqualTo(maxSdkVersion) {
			return version, nil
		}
	}
	return "", fmt.Errorf("not found a version(<=%s) in versionList: %v", maxSdkVersion, versionList)
}

func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
	for _, n := range m.ApexProperties.Apex_available {
		if n == AvailableToPlatform || n == AvailableToAnyApex || n == AvailableToGkiApex {
+20 −16
Original line number Diff line number Diff line
@@ -71,24 +71,26 @@ func (o DepSetOrder) String() string {
// NewDepSet returns an immutable DepSet with the given order, direct and transitive contents.
func NewDepSet(order DepSetOrder, direct Paths, transitive []*DepSet) *DepSet {
	var directCopy Paths
	var transitiveCopy []*DepSet
	transitiveCopy := make([]*DepSet, 0, len(transitive))

	for _, dep := range transitive {
		if dep != nil {
			if dep.order != order {
				panic(fmt.Errorf("incompatible order, new DepSet is %s but transitive DepSet is %s",
					order, dep.order))
			}
			transitiveCopy = append(transitiveCopy, dep)
		}
	}

	if order == TOPOLOGICAL {
		directCopy = ReversePaths(direct)
		transitiveCopy = reverseDepSets(transitive)
		reverseDepSetsInPlace(transitiveCopy)
	} else {
		// Use copy instead of append(nil, ...) to make a slice that is exactly the size of the input
		// slice.  The DepSet is immutable, there is no need for additional capacity.
		directCopy = make(Paths, len(direct))
		copy(directCopy, direct)
		transitiveCopy = make([]*DepSet, len(transitive))
		copy(transitiveCopy, transitive)
	}

	for _, dep := range transitive {
		if dep.order != order {
			panic(fmt.Errorf("incompatible order, new DepSet is %s but transitive DepSet is %s",
				order, dep.order))
		}
	}

	return &DepSet{
@@ -157,6 +159,9 @@ func (d *DepSet) walk(visit func(Paths)) {
// its transitive dependencies, in which case the ordering of the duplicated element is not
// guaranteed).
func (d *DepSet) ToList() Paths {
	if d == nil {
		return nil
	}
	var list Paths
	d.walk(func(paths Paths) {
		list = append(list, paths...)
@@ -181,10 +186,9 @@ func reversePathsInPlace(list Paths) {
	}
}

func reverseDepSets(list []*DepSet) []*DepSet {
	ret := make([]*DepSet, len(list))
	for i := range list {
		ret[i] = list[len(list)-1-i]
func reverseDepSetsInPlace(list []*DepSet) {
	for i, j := 0, len(list)-1; i < j; i, j = i+1, j-1 {
		list[i], list[j] = list[j], list[i]
	}
	return ret

}
+1 −0
Original line number Diff line number Diff line
@@ -1319,6 +1319,7 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
		cc_library {
			name: "mylib",
			srcs: ["mylib.cpp"],
			system_shared_libs: ["libc", "libm"],
			shared_libs: ["libdl#27"],
			stl: "none",
			apex_available: [ "myapex" ],
+4 −4
Original line number Diff line number Diff line
@@ -186,17 +186,17 @@ func makeOverrideModuleNames(ctx AndroidMkContext, overrides []string) []string
}

func (library *libraryDecorator) androidMkWriteExportedFlags(entries *android.AndroidMkEntries) {
	exportedFlags := library.exportedFlags()
	for _, dir := range library.exportedDirs() {
	exportedFlags := library.flagExporter.flags
	for _, dir := range library.flagExporter.dirs {
		exportedFlags = append(exportedFlags, "-I"+dir.String())
	}
	for _, dir := range library.exportedSystemDirs() {
	for _, dir := range library.flagExporter.systemDirs {
		exportedFlags = append(exportedFlags, "-isystem "+dir.String())
	}
	if len(exportedFlags) > 0 {
		entries.AddStrings("LOCAL_EXPORT_CFLAGS", exportedFlags...)
	}
	exportedDeps := library.exportedDeps()
	exportedDeps := library.flagExporter.deps
	if len(exportedDeps) > 0 {
		entries.AddStrings("LOCAL_EXPORT_C_INCLUDE_DEPS", exportedDeps.Strings()...)
	}
+188 −306

File changed.

Preview size limit exceeded, changes collapsed.

Loading