Support handling ModuleMakeVarsProvider and SingletonMakeVarsProvider in soong only dist

This change allows modules that set dist goals via `MakeVars(...)` to be
properly handled in collecting dist contributions in Soong only build.

Test: compare dist directories with/without change in soong+make build and soong only build
Bug: 394365683
Change-Id: I8a81ab17195b687297961dc6f1ee7b4b97cec24c
diff --git a/android/makevars.go b/android/makevars.go
index 8305d8e..d4389cf 100644
--- a/android/makevars.go
+++ b/android/makevars.go
@@ -220,7 +220,7 @@
 
 type dist struct {
 	goals []string
-	paths []string
+	paths distCopies
 }
 
 func (s *makeVarsSingleton) GenerateBuildActions(ctx SingletonContext) {
@@ -330,7 +330,7 @@
 		return len(a) < len(b)
 	}
 	sort.Slice(dists, func(i, j int) bool {
-		return lessArr(dists[i].goals, dists[j].goals) || lessArr(dists[i].paths, dists[j].paths)
+		return lessArr(dists[i].goals, dists[j].goals) || lessArr(dists[i].paths.Strings(), dists[j].paths.Strings())
 	})
 
 	outBytes := s.writeVars(vars)
@@ -458,7 +458,7 @@
 	for _, dist := range dists {
 		fmt.Fprintf(buf, ".PHONY: %s\n", strings.Join(dist.goals, " "))
 		fmt.Fprintf(buf, "$(call dist-for-goals,%s,%s)\n",
-			strings.Join(dist.goals, " "), strings.Join(dist.paths, " "))
+			strings.Join(dist.goals, " "), strings.Join(dist.paths.Strings(), " "))
 	}
 
 	return buf.Bytes()
@@ -607,7 +607,7 @@
 	c.phonies = append(c.phonies, phony{name, deps})
 }
 
-func (c *makeVarsContext) addDist(goals []string, paths []string) {
+func (c *makeVarsContext) addDist(goals []string, paths []distCopy) {
 	c.dists = append(c.dists, dist{
 		goals: goals,
 		paths: paths,
@@ -647,9 +647,15 @@
 }
 
 func (c *makeVarsContext) DistForGoals(goals []string, paths ...Path) {
-	c.addDist(goals, Paths(paths).Strings())
+	var copies distCopies
+	for _, path := range paths {
+		copies = append(copies, distCopy{
+			from: path,
+		})
+	}
+	c.addDist(goals, copies)
 }
 
 func (c *makeVarsContext) DistForGoalsWithFilename(goals []string, path Path, filename string) {
-	c.addDist(goals, []string{path.String() + ":" + filename})
+	c.addDist(goals, distCopies{{from: path, dest: filename}})
 }