Remove duplicates in PathsAndMissingDepsRelativeToModuleSourceDir

This change prevents duplicate paths from being returned when resolving
filepath, glob and ":name{.tag}" syntax to android.Paths. Once all
existing modules are cleaned up to remove duplicates in the source
files, the duplicates removal can be converted into an error so that
passing duplicate source files in the module definition is restricted.

Test: patch to git_main, inspect ninja commands
Bug: 326674683
Change-Id: I38a4ce9238da25cd67968f6bc8058bc9facc4551
This commit is contained in:
Jihoon Kang 2024-04-12 00:45:50 +00:00
parent 48d11dde95
commit 0e3a5352e1

View file

@ -673,7 +673,8 @@ func PathsAndMissingDepsRelativeToModuleSourceDir(input SourceInput) (Paths, []s
expandedSrcFiles = append(expandedSrcFiles, srcFiles...) expandedSrcFiles = append(expandedSrcFiles, srcFiles...)
} }
return expandedSrcFiles, append(missingDeps, missingExcludeDeps...) // TODO: b/334169722 - Replace with an error instead of implicitly removing duplicates.
return FirstUniquePaths(expandedSrcFiles), append(missingDeps, missingExcludeDeps...)
} }
type missingDependencyError struct { type missingDependencyError struct {