Remove DistFiles from AndroidMk datastructures
The code that collects dists also supports getting them from
OutputFiles. Switch the few remaining usages of AndroidMk-based
disted files over to OutputFiles, and remove DistFiles from the
AndroidMk datastructures.
This should allow us to clean up more AndroidMk code in a followup
cl.
Bug: 398938465
Test: Confirmed that the ninja files for "m nothing dist" don't change after this cl.
Change-Id: I9eaed21018ef73ec36276556e7daa7201b272009
diff --git a/android/androidmk.go b/android/androidmk.go
index d9d78f3..5cb5a66 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -107,8 +107,6 @@
SubName string
// If set, this value overrides the base module name. SubName is still appended.
OverrideName string
- // Dist files to output
- DistFiles TaggedDistFiles
// The output file for Kati to process and/or install. If absent, the module is skipped.
OutputFile OptionalPath
// If true, the module is skipped and does not appear on the final Android-<product name>.mk
@@ -360,15 +358,9 @@
// Start with an empty (nil) set.
var availableTaggedDists TaggedDistFiles
- // Then merge in any that are provided explicitly by the module.
- if a.DistFiles != nil {
- // Merge the DistFiles into the set.
- availableTaggedDists = availableTaggedDists.merge(a.DistFiles)
- }
-
// If no paths have been provided for the DefaultDistTag and the output file is
// valid then add that as the default dist path.
- if _, ok := availableTaggedDists[DefaultDistTag]; !ok && a.OutputFile.Valid() {
+ if a.OutputFile.Valid() {
availableTaggedDists = availableTaggedDists.addPathsForTag(DefaultDistTag, a.OutputFile.Path())
}
@@ -1295,8 +1287,6 @@
SubName string
// If set, this value overrides the base module name. SubName is still appended.
OverrideName string
- // Dist files to output
- DistFiles TaggedDistFiles
// The output file for Kati to process and/or install. If absent, the module is skipped.
OutputFile OptionalPath
// If true, the module is skipped and does not appear on the final Android-<product name>.mk
@@ -1682,15 +1672,9 @@
// Start with an empty (nil) set.
var availableTaggedDists TaggedDistFiles
- // Then merge in any that are provided explicitly by the module.
- if a.DistFiles != nil {
- // Merge the DistFiles into the set.
- availableTaggedDists = availableTaggedDists.merge(a.DistFiles)
- }
-
// If no paths have been provided for the DefaultDistTag and the output file is
// valid then add that as the default dist path.
- if _, ok := availableTaggedDists[DefaultDistTag]; !ok && a.OutputFile.Valid() {
+ if a.OutputFile.Valid() {
availableTaggedDists = availableTaggedDists.addPathsForTag(DefaultDistTag, a.OutputFile.Path())
}
@@ -1815,9 +1799,8 @@
Class: mkinfo.Class,
SubName: mkinfo.SubName,
OverrideName: mkinfo.OverrideName,
- // There is no modification on DistFiles or OutputFile, so no need to
+ // There is no modification on OutputFile, so no need to
// make their deep copy.
- DistFiles: mkinfo.DistFiles,
OutputFile: mkinfo.OutputFile,
Disabled: mkinfo.Disabled,
Include: mkinfo.Include,
diff --git a/android/androidmk_test.go b/android/androidmk_test.go
index 0a81fb8..4cdd6a3 100644
--- a/android/androidmk_test.go
+++ b/android/androidmk_test.go
@@ -34,7 +34,6 @@
}
data AndroidMkData
- distFiles TaggedDistFiles
outputFile OptionalPath
}
@@ -73,7 +72,6 @@
path := PathForTesting("default-dist.out")
defaultDistPaths = Paths{path}
m.setOutputFiles(ctx, defaultDistPaths)
- m.distFiles = MakeDefaultDistFiles(path)
case defaultDistFiles_Tagged:
// Module types that set AndroidMkEntry.DistFiles to the result of calling
@@ -84,11 +82,6 @@
// will be the same as empty-string-tag output.
defaultDistPaths = PathsForTesting("one.out")
m.setOutputFiles(ctx, defaultDistPaths)
-
- // This must be called after setting defaultDistPaths/outputFile as
- // GenerateTaggedDistFiles calls into outputFiles property which may use
- // those fields.
- m.distFiles = m.GenerateTaggedDistFiles(ctx)
}
}
@@ -113,7 +106,6 @@
return []AndroidMkEntries{
{
Class: "CUSTOM_MODULE",
- DistFiles: m.distFiles,
OutputFile: m.outputFile,
},
}
diff --git a/android/module.go b/android/module.go
index 996c64e..d387c2c 100644
--- a/android/module.go
+++ b/android/module.go
@@ -613,17 +613,6 @@
return t
}
-func MakeDefaultDistFiles(paths ...Path) TaggedDistFiles {
- for _, p := range paths {
- if p == nil {
- panic("The path to a dist file cannot be nil.")
- }
- }
-
- // The default OutputFile tag is the empty "" string.
- return TaggedDistFiles{DefaultDistTag: paths}
-}
-
type hostAndDeviceProperties struct {
// If set to true, build a variant of the module for the host. Defaults to false.
Host_supported *bool