From a434b3fd693ecb39728098f74fcbfb2d2acb3145 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 13 Jan 2015 10:59:52 -0800 Subject: [PATCH] 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 --- blueprint/context.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/blueprint/context.go b/blueprint/context.go index 568cfb5..715b383 100644 --- a/blueprint/context.go +++ b/blueprint/context.go @@ -846,9 +846,13 @@ func (c *Context) moduleDepNames(group *moduleGroup, config interface{}) ([]string, []error) { depNamesSet := make(map[string]bool) + depNames := []string{} for _, depName := range group.properties.Deps { - depNamesSet[depName] = true + if !depNamesSet[depName] { + depNamesSet[depName] = true + depNames = append(depNames, depName) + } } if len(group.modules) != 1 { @@ -870,18 +874,13 @@ func (c *Context) moduleDepNames(group *moduleGroup, } for _, depName := range dynamicDeps { - depNamesSet[depName] = true + if !depNamesSet[depName] { + depNamesSet[depName] = true + depNames = append(depNames, depName) + } } } - // 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) - } - sort.Strings(depNames) - return depNames, nil }