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

Commit 7d9f7607 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Revert "Make FirstTarget treat HostCross separately from Host""

parents b5aa16f3 3b56c929
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -1843,23 +1843,20 @@ func getCommonTargets(targets []Target) []Target {
}

// FirstTarget takes a list of Targets and a list of multilib values and returns a list of Targets
// that contains zero or one Target for each OsType and HostCross, selecting the one that matches
// the earliest filter.
// that contains zero or one Target for each OsType, selecting the one that matches the earliest
// filter.
func FirstTarget(targets []Target, filters ...string) []Target {
	// find the first target from each OS
	var ret []Target
	type osHostCross struct {
		os        OsType
		hostCross bool
	}
	set := make(map[osHostCross]bool)
	hasHost := false
	set := make(map[OsType]bool)

	for _, filter := range filters {
		buildTargets := filterMultilibTargets(targets, filter)
		for _, t := range buildTargets {
			key := osHostCross{t.Os, t.HostCross}
			if _, found := set[key]; !found {
				set[key] = true
			if _, found := set[t.Os]; !found {
				hasHost = hasHost || (t.Os.Class == Host)
				set[t.Os] = true
				ret = append(ret, t)
			}
		}