@@ -42,7 +42,7 @@ import (
4242 "github.com/arduino/arduino-builder/types"
4343 "github.com/arduino/arduino-builder/utils"
4444 "github.com/arduino/go-paths-helper"
45- "github.com/arduino/go-properties-map "
45+ "github.com/arduino/go-properties-orderedmap "
4646)
4747
4848func PrintProgressIfProgressEnabledAndMachineLogger (ctx * types.Context ) {
@@ -58,7 +58,7 @@ func PrintProgressIfProgressEnabledAndMachineLogger(ctx *types.Context) {
5858 }
5959}
6060
61- func CompileFilesRecursive (ctx * types.Context , sourcePath * paths.Path , buildPath * paths.Path , buildProperties properties.Map , includes []string ) (paths.PathList , error ) {
61+ func CompileFilesRecursive (ctx * types.Context , sourcePath * paths.Path , buildPath * paths.Path , buildProperties * properties.Map , includes []string ) (paths.PathList , error ) {
6262 objectFiles , err := CompileFiles (ctx , sourcePath , false , buildPath , buildProperties , includes )
6363 if err != nil {
6464 return nil , i18n .WrapError (err )
@@ -80,7 +80,7 @@ func CompileFilesRecursive(ctx *types.Context, sourcePath *paths.Path, buildPath
8080 return objectFiles , nil
8181}
8282
83- func CompileFiles (ctx * types.Context , sourcePath * paths.Path , recurse bool , buildPath * paths.Path , buildProperties properties.Map , includes []string ) (paths.PathList , error ) {
83+ func CompileFiles (ctx * types.Context , sourcePath * paths.Path , recurse bool , buildPath * paths.Path , buildProperties * properties.Map , includes []string ) (paths.PathList , error ) {
8484 sObjectFiles , err := compileFilesWithExtensionWithRecipe (ctx , sourcePath , recurse , buildPath , buildProperties , includes , ".S" , constants .RECIPE_S_PATTERN )
8585 if err != nil {
8686 return nil , i18n .WrapError (err )
@@ -100,7 +100,7 @@ func CompileFiles(ctx *types.Context, sourcePath *paths.Path, recurse bool, buil
100100 return objectFiles , nil
101101}
102102
103- func compileFilesWithExtensionWithRecipe (ctx * types.Context , sourcePath * paths.Path , recurse bool , buildPath * paths.Path , buildProperties properties.Map , includes []string , extension string , recipe string ) (paths.PathList , error ) {
103+ func compileFilesWithExtensionWithRecipe (ctx * types.Context , sourcePath * paths.Path , recurse bool , buildPath * paths.Path , buildProperties * properties.Map , includes []string , extension string , recipe string ) (paths.PathList , error ) {
104104 sources , err := findFilesInFolder (sourcePath , extension , recurse )
105105 if err != nil {
106106 return nil , i18n .WrapError (err )
@@ -164,7 +164,7 @@ func findAllFilesInFolder(sourcePath string, recurse bool) ([]string, error) {
164164 return sources , nil
165165}
166166
167- func compileFilesWithRecipe (ctx * types.Context , sourcePath * paths.Path , sources paths.PathList , buildPath * paths.Path , buildProperties properties.Map , includes []string , recipe string ) (paths.PathList , error ) {
167+ func compileFilesWithRecipe (ctx * types.Context , sourcePath * paths.Path , sources paths.PathList , buildPath * paths.Path , buildProperties * properties.Map , includes []string , recipe string ) (paths.PathList , error ) {
168168 objectFiles := paths .NewPathList ()
169169 if len (sources ) == 0 {
170170 return objectFiles , nil
@@ -212,19 +212,19 @@ func compileFilesWithRecipe(ctx *types.Context, sourcePath *paths.Path, sources
212212 }
213213}
214214
215- func compileFileWithRecipe (ctx * types.Context , sourcePath * paths.Path , source * paths.Path , buildPath * paths.Path , buildProperties properties.Map , includes []string , recipe string ) (* paths.Path , error ) {
215+ func compileFileWithRecipe (ctx * types.Context , sourcePath * paths.Path , source * paths.Path , buildPath * paths.Path , buildProperties * properties.Map , includes []string , recipe string ) (* paths.Path , error ) {
216216 logger := ctx .GetLogger ()
217217 properties := buildProperties .Clone ()
218- properties [ constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS ] = properties [ constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS + "." + ctx .WarningsLevel ]
219- properties [ constants .BUILD_PROPERTIES_INCLUDES ] = strings .Join (includes , constants .SPACE )
220- properties [ constants .BUILD_PROPERTIES_SOURCE_FILE ] = source . String ( )
218+ properties . Set ( constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS , properties . Get ( constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS + "." + ctx .WarningsLevel ))
219+ properties . Set ( constants .BUILD_PROPERTIES_INCLUDES , strings .Join (includes , constants .SPACE ) )
220+ properties . SetPath ( constants .BUILD_PROPERTIES_SOURCE_FILE , source )
221221 relativeSource , err := sourcePath .RelTo (source )
222222 if err != nil {
223223 return nil , i18n .WrapError (err )
224224 }
225- properties [ constants .BUILD_PROPERTIES_OBJECT_FILE ] = buildPath .JoinPath (relativeSource ).String () + ".o"
225+ properties . Set ( constants .BUILD_PROPERTIES_OBJECT_FILE , buildPath .JoinPath (relativeSource ).String ()+ ".o" )
226226
227- err = paths . New ( properties [ constants .BUILD_PROPERTIES_OBJECT_FILE ] ).Parent ().MkdirAll ()
227+ err = properties . GetPath ( constants .BUILD_PROPERTIES_OBJECT_FILE ).Parent ().MkdirAll ()
228228 if err != nil {
229229 return nil , i18n .WrapError (err )
230230 }
@@ -240,10 +240,10 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath *paths.Path, source *p
240240 return nil , i18n .WrapError (err )
241241 }
242242 } else if ctx .Verbose {
243- logger .Println (constants .LOG_LEVEL_INFO , constants .MSG_USING_PREVIOUS_COMPILED_FILE , properties [ constants .BUILD_PROPERTIES_OBJECT_FILE ] )
243+ logger .Println (constants .LOG_LEVEL_INFO , constants .MSG_USING_PREVIOUS_COMPILED_FILE , properties . Get ( constants .BUILD_PROPERTIES_OBJECT_FILE ) )
244244 }
245245
246- return paths . New ( properties [ constants .BUILD_PROPERTIES_OBJECT_FILE ] ), nil
246+ return properties . GetPath ( constants .BUILD_PROPERTIES_OBJECT_FILE ), nil
247247}
248248
249249func ObjFileIsUpToDate (ctx * types.Context , sourceFile , objectFile , dependencyFile * paths.Path ) (bool , error ) {
@@ -430,7 +430,7 @@ func TXTBuildRulesHaveChanged(corePath, targetCorePath, targetFile *paths.Path)
430430 return true
431431}
432432
433- func ArchiveCompiledFiles (ctx * types.Context , buildPath * paths.Path , archiveFile * paths.Path , objectFilesToArchive paths.PathList , buildProperties properties.Map ) (* paths.Path , error ) {
433+ func ArchiveCompiledFiles (ctx * types.Context , buildPath * paths.Path , archiveFile * paths.Path , objectFilesToArchive paths.PathList , buildProperties * properties.Map ) (* paths.Path , error ) {
434434 logger := ctx .GetLogger ()
435435 archiveFilePath := buildPath .JoinPath (archiveFile )
436436
@@ -463,9 +463,9 @@ func ArchiveCompiledFiles(ctx *types.Context, buildPath *paths.Path, archiveFile
463463
464464 for _ , objectFile := range objectFilesToArchive {
465465 properties := buildProperties .Clone ()
466- properties [ constants .BUILD_PROPERTIES_ARCHIVE_FILE ] = archiveFilePath .Base ()
467- properties [ constants .BUILD_PROPERTIES_ARCHIVE_FILE_PATH ] = archiveFilePath . String ( )
468- properties [ constants .BUILD_PROPERTIES_OBJECT_FILE ] = objectFile . String ( )
466+ properties . Set ( constants .BUILD_PROPERTIES_ARCHIVE_FILE , archiveFilePath .Base () )
467+ properties . SetPath ( constants .BUILD_PROPERTIES_ARCHIVE_FILE_PATH , archiveFilePath )
468+ properties . SetPath ( constants .BUILD_PROPERTIES_OBJECT_FILE , objectFile )
469469
470470 _ , _ , err := ExecRecipe (ctx , properties , constants .RECIPE_AR_PATTERN , false /* stdout */ , utils .ShowIfVerbose /* stderr */ , utils .Show )
471471 if err != nil {
@@ -476,7 +476,7 @@ func ArchiveCompiledFiles(ctx *types.Context, buildPath *paths.Path, archiveFile
476476 return archiveFilePath , nil
477477}
478478
479- func ExecRecipe (ctx * types.Context , buildProperties properties.Map , recipe string , removeUnsetProperties bool , stdout int , stderr int ) ([]byte , []byte , error ) {
479+ func ExecRecipe (ctx * types.Context , buildProperties * properties.Map , recipe string , removeUnsetProperties bool , stdout int , stderr int ) ([]byte , []byte , error ) {
480480 // See util.ExecCommand for stdout/stderr arguments
481481 command , err := PrepareCommandForRecipe (ctx , buildProperties , recipe , removeUnsetProperties )
482482 if err != nil {
@@ -488,9 +488,9 @@ func ExecRecipe(ctx *types.Context, buildProperties properties.Map, recipe strin
488488
489489const COMMANDLINE_LIMIT = 30000
490490
491- func PrepareCommandForRecipe (ctx * types.Context , buildProperties properties.Map , recipe string , removeUnsetProperties bool ) (* exec.Cmd , error ) {
491+ func PrepareCommandForRecipe (ctx * types.Context , buildProperties * properties.Map , recipe string , removeUnsetProperties bool ) (* exec.Cmd , error ) {
492492 logger := ctx .GetLogger ()
493- pattern := buildProperties [ recipe ]
493+ pattern := buildProperties . Get ( recipe )
494494 if pattern == "" {
495495 return nil , i18n .ErrorfWithLogger (logger , constants .MSG_PATTERN_MISSING , recipe )
496496 }
@@ -504,7 +504,7 @@ func PrepareCommandForRecipe(ctx *types.Context, buildProperties properties.Map,
504504 relativePath := ""
505505
506506 if len (commandLine ) > COMMANDLINE_LIMIT {
507- relativePath = buildProperties [ "build.path" ]
507+ relativePath = buildProperties . Get ( "build.path" )
508508 }
509509
510510 command , err := utils .PrepareCommand (commandLine , logger , relativePath )
0 commit comments