@@ -42,7 +42,7 @@ import (
4242 "strings"
4343)
4444
45- func CompileFilesRecursive (objectFiles []string , sourcePath string , buildPath string , buildProperties map [ string ] string , includes []string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
45+ func CompileFilesRecursive (objectFiles []string , sourcePath string , buildPath string , buildProperties props. PropertiesMap , includes []string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
4646 objectFiles , err := CompileFiles (objectFiles , sourcePath , false , buildPath , buildProperties , includes , verbose , warningsLevel , logger )
4747 if err != nil {
4848 return nil , utils .WrapError (err )
@@ -63,7 +63,7 @@ func CompileFilesRecursive(objectFiles []string, sourcePath string, buildPath st
6363 return objectFiles , nil
6464}
6565
66- func CompileFiles (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties map [ string ] string , includes []string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
66+ func CompileFiles (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties props. PropertiesMap , includes []string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
6767 objectFiles , err := compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".S" , constants .RECIPE_S_PATTERN , verbose , warningsLevel , logger )
6868 if err != nil {
6969 return nil , utils .WrapError (err )
@@ -79,7 +79,7 @@ func CompileFiles(objectFiles []string, sourcePath string, recurse bool, buildPa
7979 return objectFiles , nil
8080}
8181
82- func compileFilesWithExtensionWithRecipe (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties map [ string ] string , includes []string , extension string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
82+ func compileFilesWithExtensionWithRecipe (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties props. PropertiesMap , includes []string , extension string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
8383 sources , err := findFilesInFolder (sourcePath , extension , recurse )
8484 if err != nil {
8585 return nil , utils .WrapError (err )
@@ -115,7 +115,7 @@ func findFilesInFolder(sourcePath string, extension string, recurse bool) ([]str
115115 return sources , nil
116116}
117117
118- func compileFilesWithRecipe (objectFiles []string , sourcePath string , sources []string , buildPath string , buildProperties map [ string ] string , includes []string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
118+ func compileFilesWithRecipe (objectFiles []string , sourcePath string , sources []string , buildPath string , buildProperties props. PropertiesMap , includes []string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
119119 for _ , source := range sources {
120120 objectFile , err := compileFileWithRecipe (sourcePath , source , buildPath , buildProperties , includes , recipe , verbose , warningsLevel , logger )
121121 if err != nil {
@@ -127,8 +127,8 @@ func compileFilesWithRecipe(objectFiles []string, sourcePath string, sources []s
127127 return objectFiles , nil
128128}
129129
130- func compileFileWithRecipe (sourcePath string , source string , buildPath string , buildProperties map [ string ] string , includes []string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) (string , error ) {
131- properties := utils . MergeMapsOfStrings ( make ( map [ string ] string ), buildProperties )
130+ func compileFileWithRecipe (sourcePath string , source string , buildPath string , buildProperties props. PropertiesMap , includes []string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) (string , error ) {
131+ properties := buildProperties . Clone ( )
132132 properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS ] = properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS + "." + warningsLevel ]
133133 properties [constants .BUILD_PROPERTIES_INCLUDES ] = strings .Join (includes , constants .SPACE )
134134 properties [constants .BUILD_PROPERTIES_SOURCE_FILE ] = source
@@ -255,7 +255,7 @@ func nonEmptyString(s string) bool {
255255 return s != constants .EMPTY_STRING
256256}
257257
258- func ArchiveCompiledFiles (buildPath string , archiveFile string , objectFiles []string , buildProperties map [ string ] string , verbose bool , logger i18n.Logger ) (string , error ) {
258+ func ArchiveCompiledFiles (buildPath string , archiveFile string , objectFiles []string , buildProperties props. PropertiesMap , verbose bool , logger i18n.Logger ) (string , error ) {
259259 archiveFilePath := filepath .Join (buildPath , archiveFile )
260260 if _ , err := os .Stat (archiveFilePath ); err == nil {
261261 err = os .Remove (archiveFilePath )
@@ -265,7 +265,7 @@ func ArchiveCompiledFiles(buildPath string, archiveFile string, objectFiles []st
265265 }
266266
267267 for _ , objectFile := range objectFiles {
268- properties := utils . MergeMapsOfStrings ( make ( map [ string ] string ), buildProperties )
268+ properties := buildProperties . Clone ( )
269269 properties [constants .BUILD_PROPERTIES_ARCHIVE_FILE ] = filepath .Base (archiveFilePath )
270270 properties [constants .BUILD_PROPERTIES_ARCHIVE_FILE_PATH ] = archiveFilePath
271271 properties [constants .BUILD_PROPERTIES_OBJECT_FILE ] = objectFile
@@ -279,7 +279,7 @@ func ArchiveCompiledFiles(buildPath string, archiveFile string, objectFiles []st
279279 return archiveFilePath , nil
280280}
281281
282- func ExecRecipe (properties map [ string ] string , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger ) ([]byte , error ) {
282+ func ExecRecipe (properties props. PropertiesMap , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger ) ([]byte , error ) {
283283 command , err := PrepareCommandForRecipe (properties , recipe , removeUnsetProperties , echoCommandLine , echoOutput , logger )
284284 if err != nil {
285285 return nil , utils .WrapError (err )
@@ -300,14 +300,14 @@ func ExecRecipe(properties map[string]string, recipe string, removeUnsetProperti
300300 return bytes , utils .WrapError (err )
301301}
302302
303- func PrepareCommandForRecipe (properties map [ string ] string , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger ) (* exec.Cmd , error ) {
303+ func PrepareCommandForRecipe (properties props. PropertiesMap , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger ) (* exec.Cmd , error ) {
304304 pattern := properties [recipe ]
305305 if pattern == constants .EMPTY_STRING {
306306 return nil , utils .ErrorfWithLogger (logger , constants .MSG_PATTERN_MISSING , recipe )
307307 }
308308
309309 var err error
310- commandLine := props .ExpandPropsInString (properties , pattern )
310+ commandLine := properties .ExpandPropsInString (pattern )
311311 if removeUnsetProperties {
312312 commandLine , err = props .DeleteUnexpandedPropsFromString (commandLine )
313313 if err != nil {
@@ -327,7 +327,7 @@ func PrepareCommandForRecipe(properties map[string]string, recipe string, remove
327327 return command , nil
328328}
329329
330- func ExecRecipeCollectStdErr (properties map [ string ] string , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger ) (string , error ) {
330+ func ExecRecipeCollectStdErr (properties props. PropertiesMap , recipe string , removeUnsetProperties bool , echoCommandLine bool , echoOutput bool , logger i18n.Logger ) (string , error ) {
331331 command , err := PrepareCommandForRecipe (properties , recipe , removeUnsetProperties , echoCommandLine , echoOutput , logger )
332332 if err != nil {
333333 return "" , utils .WrapError (err )
@@ -339,6 +339,6 @@ func ExecRecipeCollectStdErr(properties map[string]string, recipe string, remove
339339 return string (buffer .Bytes ()), nil
340340}
341341
342- func RemoveHyphenMDDFlagFromGCCCommandLine (properties map [ string ] string ) {
342+ func RemoveHyphenMDDFlagFromGCCCommandLine (properties props. PropertiesMap ) {
343343 properties [constants .BUILD_PROPERTIES_COMPILER_CPP_FLAGS ] = strings .Replace (properties [constants .BUILD_PROPERTIES_COMPILER_CPP_FLAGS ], "-MMD" , "" , - 1 )
344344}
0 commit comments