Keep dependencies in order

Don't sort the dependencies, keep them in the order they were in the
Blueprints file and use a set to prevent adding duplicates to the list.

Change-Id: Icade91d035ccfb12c26ba0584144c1723607019c
This commit is contained in:
Colin Cross 2015-01-13 10:59:52 -08:00
parent 3793062859
commit a434b3fd69

View file

@ -846,9 +846,13 @@ func (c *Context) moduleDepNames(group *moduleGroup,
config interface{}) ([]string, []error) { config interface{}) ([]string, []error) {
depNamesSet := make(map[string]bool) depNamesSet := make(map[string]bool)
depNames := []string{}
for _, depName := range group.properties.Deps { for _, depName := range group.properties.Deps {
if !depNamesSet[depName] {
depNamesSet[depName] = true depNamesSet[depName] = true
depNames = append(depNames, depName)
}
} }
if len(group.modules) != 1 { if len(group.modules) != 1 {
@ -870,17 +874,12 @@ func (c *Context) moduleDepNames(group *moduleGroup,
} }
for _, depName := range dynamicDeps { for _, depName := range dynamicDeps {
if !depNamesSet[depName] {
depNamesSet[depName] = true depNamesSet[depName] = true
}
}
// We need to sort the dependency names to ensure deterministic Ninja file
// output from one run to the next.
depNames := make([]string, 0, len(depNamesSet))
for depName := range depNamesSet {
depNames = append(depNames, depName) depNames = append(depNames, depName)
} }
sort.Strings(depNames) }
}
return depNames, nil return depNames, nil
} }