@@ -42,7 +42,7 @@ import (
42
42
"strings"
43
43
)
44
44
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 ) {
46
46
objectFiles , err := CompileFiles (objectFiles , sourcePath , false , buildPath , buildProperties , includes , verbose , warningsLevel , logger )
47
47
if err != nil {
48
48
return nil , utils .WrapError (err )
@@ -63,7 +63,7 @@ func CompileFilesRecursive(objectFiles []string, sourcePath string, buildPath st
63
63
return objectFiles , nil
64
64
}
65
65
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 ) {
67
67
objectFiles , err := compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".S" , constants .RECIPE_S_PATTERN , verbose , warningsLevel , logger )
68
68
if err != nil {
69
69
return nil , utils .WrapError (err )
@@ -79,7 +79,7 @@ func CompileFiles(objectFiles []string, sourcePath string, recurse bool, buildPa
79
79
return objectFiles , nil
80
80
}
81
81
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 ) {
83
83
sources , err := findFilesInFolder (sourcePath , extension , recurse )
84
84
if err != nil {
85
85
return nil , utils .WrapError (err )
@@ -115,7 +115,7 @@ func findFilesInFolder(sourcePath string, extension string, recurse bool) ([]str
115
115
return sources , nil
116
116
}
117
117
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 ) {
119
119
for _ , source := range sources {
120
120
objectFile , err := compileFileWithRecipe (sourcePath , source , buildPath , buildProperties , includes , recipe , verbose , warningsLevel , logger )
121
121
if err != nil {
@@ -127,8 +127,8 @@ func compileFilesWithRecipe(objectFiles []string, sourcePath string, sources []s
127
127
return objectFiles , nil
128
128
}
129
129
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 ( )
132
132
properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS ] = properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS + "." + warningsLevel ]
133
133
properties [constants .BUILD_PROPERTIES_INCLUDES ] = strings .Join (includes , constants .SPACE )
134
134
properties [constants .BUILD_PROPERTIES_SOURCE_FILE ] = source
@@ -255,7 +255,7 @@ func nonEmptyString(s string) bool {
255
255
return s != constants .EMPTY_STRING
256
256
}
257
257
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 ) {
259
259
archiveFilePath := filepath .Join (buildPath , archiveFile )
260
260
if _ , err := os .Stat (archiveFilePath ); err == nil {
261
261
err = os .Remove (archiveFilePath )
@@ -265,7 +265,7 @@ func ArchiveCompiledFiles(buildPath string, archiveFile string, objectFiles []st
265
265
}
266
266
267
267
for _ , objectFile := range objectFiles {
268
- properties := utils . MergeMapsOfStrings ( make ( map [ string ] string ), buildProperties )
268
+ properties := buildProperties . Clone ( )
269
269
properties [constants .BUILD_PROPERTIES_ARCHIVE_FILE ] = filepath .Base (archiveFilePath )
270
270
properties [constants .BUILD_PROPERTIES_ARCHIVE_FILE_PATH ] = archiveFilePath
271
271
properties [constants .BUILD_PROPERTIES_OBJECT_FILE ] = objectFile
@@ -279,7 +279,7 @@ func ArchiveCompiledFiles(buildPath string, archiveFile string, objectFiles []st
279
279
return archiveFilePath , nil
280
280
}
281
281
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 ) {
283
283
command , err := PrepareCommandForRecipe (properties , recipe , removeUnsetProperties , echoCommandLine , echoOutput , logger )
284
284
if err != nil {
285
285
return nil , utils .WrapError (err )
@@ -300,14 +300,14 @@ func ExecRecipe(properties map[string]string, recipe string, removeUnsetProperti
300
300
return bytes , utils .WrapError (err )
301
301
}
302
302
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 ) {
304
304
pattern := properties [recipe ]
305
305
if pattern == constants .EMPTY_STRING {
306
306
return nil , utils .ErrorfWithLogger (logger , constants .MSG_PATTERN_MISSING , recipe )
307
307
}
308
308
309
309
var err error
310
- commandLine := props .ExpandPropsInString (properties , pattern )
310
+ commandLine := properties .ExpandPropsInString (pattern )
311
311
if removeUnsetProperties {
312
312
commandLine , err = props .DeleteUnexpandedPropsFromString (commandLine )
313
313
if err != nil {
@@ -327,7 +327,7 @@ func PrepareCommandForRecipe(properties map[string]string, recipe string, remove
327
327
return command , nil
328
328
}
329
329
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 ) {
331
331
command , err := PrepareCommandForRecipe (properties , recipe , removeUnsetProperties , echoCommandLine , echoOutput , logger )
332
332
if err != nil {
333
333
return "" , utils .WrapError (err )
@@ -339,6 +339,6 @@ func ExecRecipeCollectStdErr(properties map[string]string, recipe string, remove
339
339
return string (buffer .Bytes ()), nil
340
340
}
341
341
342
- func RemoveHyphenMDDFlagFromGCCCommandLine (properties map [ string ] string ) {
342
+ func RemoveHyphenMDDFlagFromGCCCommandLine (properties props. PropertiesMap ) {
343
343
properties [constants .BUILD_PROPERTIES_COMPILER_CPP_FLAGS ] = strings .Replace (properties [constants .BUILD_PROPERTIES_COMPILER_CPP_FLAGS ], "-MMD" , "" , - 1 )
344
344
}
0 commit comments