@@ -43,8 +43,8 @@ import (
4343 "arduino.cc/properties"
4444)
4545
46- func CompileFilesRecursive (objectFiles []string , sourcePath string , buildPath string , buildProperties properties.Map , includes []string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
47- objectFiles , err := CompileFiles (objectFiles , sourcePath , false , buildPath , buildProperties , includes , verbose , warningsLevel , logger )
46+ func CompileFilesRecursive (objectFiles []string , sourcePath string , buildPath string , buildProperties properties.Map , includes []string , verbose bool , warningsLevel string , debugLevel int , logger i18n.Logger ) ([]string , error ) {
47+ objectFiles , err := CompileFiles (objectFiles , sourcePath , false , buildPath , buildProperties , includes , verbose , warningsLevel , debugLevel , logger )
4848 if err != nil {
4949 return nil , i18n .WrapError (err )
5050 }
@@ -55,7 +55,7 @@ func CompileFilesRecursive(objectFiles []string, sourcePath string, buildPath st
5555 }
5656
5757 for _ , folder := range folders {
58- objectFiles , err = CompileFilesRecursive (objectFiles , filepath .Join (sourcePath , folder .Name ()), filepath .Join (buildPath , folder .Name ()), buildProperties , includes , verbose , warningsLevel , logger )
58+ objectFiles , err = CompileFilesRecursive (objectFiles , filepath .Join (sourcePath , folder .Name ()), filepath .Join (buildPath , folder .Name ()), buildProperties , includes , verbose , warningsLevel , debugLevel , logger )
5959 if err != nil {
6060 return nil , i18n .WrapError (err )
6161 }
@@ -64,28 +64,28 @@ func CompileFilesRecursive(objectFiles []string, sourcePath string, buildPath st
6464 return objectFiles , nil
6565}
6666
67- func CompileFiles (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties properties.Map , includes []string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
68- objectFiles , err := compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".S" , constants .RECIPE_S_PATTERN , verbose , warningsLevel , logger )
67+ func CompileFiles (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties properties.Map , includes []string , verbose bool , warningsLevel string , debugLevel int , logger i18n.Logger ) ([]string , error ) {
68+ objectFiles , err := compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".S" , constants .RECIPE_S_PATTERN , verbose , warningsLevel , debugLevel , logger )
6969 if err != nil {
7070 return nil , i18n .WrapError (err )
7171 }
72- objectFiles , err = compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".c" , constants .RECIPE_C_PATTERN , verbose , warningsLevel , logger )
72+ objectFiles , err = compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".c" , constants .RECIPE_C_PATTERN , verbose , warningsLevel , debugLevel , logger )
7373 if err != nil {
7474 return nil , i18n .WrapError (err )
7575 }
76- objectFiles , err = compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".cpp" , constants .RECIPE_CPP_PATTERN , verbose , warningsLevel , logger )
76+ objectFiles , err = compileFilesWithExtensionWithRecipe (objectFiles , sourcePath , recurse , buildPath , buildProperties , includes , ".cpp" , constants .RECIPE_CPP_PATTERN , verbose , warningsLevel , debugLevel , logger )
7777 if err != nil {
7878 return nil , i18n .WrapError (err )
7979 }
8080 return objectFiles , nil
8181}
8282
83- func compileFilesWithExtensionWithRecipe (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties properties.Map , includes []string , extension string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
83+ func compileFilesWithExtensionWithRecipe (objectFiles []string , sourcePath string , recurse bool , buildPath string , buildProperties properties.Map , includes []string , extension string , recipe string , verbose bool , warningsLevel string , debugLevel int , logger i18n.Logger ) ([]string , error ) {
8484 sources , err := findFilesInFolder (sourcePath , extension , recurse )
8585 if err != nil {
8686 return nil , i18n .WrapError (err )
8787 }
88- return compileFilesWithRecipe (objectFiles , sourcePath , sources , buildPath , buildProperties , includes , recipe , verbose , warningsLevel , logger )
88+ return compileFilesWithRecipe (objectFiles , sourcePath , sources , buildPath , buildProperties , includes , recipe , verbose , warningsLevel , debugLevel , logger )
8989}
9090
9191func findFilesInFolder (sourcePath string , extension string , recurse bool ) ([]string , error ) {
@@ -116,9 +116,9 @@ func findFilesInFolder(sourcePath string, extension string, recurse bool) ([]str
116116 return sources , nil
117117}
118118
119- func compileFilesWithRecipe (objectFiles []string , sourcePath string , sources []string , buildPath string , buildProperties properties.Map , includes []string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) ([]string , error ) {
119+ func compileFilesWithRecipe (objectFiles []string , sourcePath string , sources []string , buildPath string , buildProperties properties.Map , includes []string , recipe string , verbose bool , warningsLevel string , debugLevel int , logger i18n.Logger ) ([]string , error ) {
120120 for _ , source := range sources {
121- objectFile , err := compileFileWithRecipe (sourcePath , source , buildPath , buildProperties , includes , recipe , verbose , warningsLevel , logger )
121+ objectFile , err := compileFileWithRecipe (sourcePath , source , buildPath , buildProperties , includes , recipe , verbose , warningsLevel , debugLevel , logger )
122122 if err != nil {
123123 return nil , i18n .WrapError (err )
124124 }
@@ -128,7 +128,7 @@ func compileFilesWithRecipe(objectFiles []string, sourcePath string, sources []s
128128 return objectFiles , nil
129129}
130130
131- func compileFileWithRecipe (sourcePath string , source string , buildPath string , buildProperties properties.Map , includes []string , recipe string , verbose bool , warningsLevel string , logger i18n.Logger ) (string , error ) {
131+ func compileFileWithRecipe (sourcePath string , source string , buildPath string , buildProperties properties.Map , includes []string , recipe string , verbose bool , warningsLevel string , debugLevel int , logger i18n.Logger ) (string , error ) {
132132 properties := buildProperties .Clone ()
133133 properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS ] = properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS + "." + warningsLevel ]
134134 properties [constants .BUILD_PROPERTIES_INCLUDES ] = strings .Join (includes , constants .SPACE )
@@ -144,7 +144,7 @@ func compileFileWithRecipe(sourcePath string, source string, buildPath string, b
144144 return "" , i18n .WrapError (err )
145145 }
146146
147- objIsUpToDate , err := ObjFileIsUpToDate (properties [constants .BUILD_PROPERTIES_SOURCE_FILE ], properties [constants .BUILD_PROPERTIES_OBJECT_FILE ], filepath .Join (buildPath , relativeSource + ".d" ))
147+ objIsUpToDate , err := ObjFileIsUpToDate (properties [constants .BUILD_PROPERTIES_SOURCE_FILE ], properties [constants .BUILD_PROPERTIES_OBJECT_FILE ], filepath .Join (buildPath , relativeSource + ".d" ), debugLevel , logger )
148148 if err != nil {
149149 return "" , i18n .WrapError (err )
150150 }
@@ -161,7 +161,7 @@ func compileFileWithRecipe(sourcePath string, source string, buildPath string, b
161161 return properties [constants .BUILD_PROPERTIES_OBJECT_FILE ], nil
162162}
163163
164- func ObjFileIsUpToDate (sourceFile , objectFile , dependencyFile string ) (bool , error ) {
164+ func ObjFileIsUpToDate (sourceFile , objectFile , dependencyFile string , debugLevel int , logger i18n. Logger ) (bool , error ) {
165165 sourceFile = filepath .Clean (sourceFile )
166166 objectFile = filepath .Clean (objectFile )
167167 dependencyFile = filepath .Clean (dependencyFile )
0 commit comments