@@ -43,8 +43,8 @@ import (
43
43
"arduino.cc/properties"
44
44
)
45
45
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 )
48
48
if err != nil {
49
49
return nil , i18n .WrapError (err )
50
50
}
@@ -55,7 +55,7 @@ func CompileFilesRecursive(objectFiles []string, sourcePath string, buildPath st
55
55
}
56
56
57
57
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 )
59
59
if err != nil {
60
60
return nil , i18n .WrapError (err )
61
61
}
@@ -64,28 +64,28 @@ func CompileFilesRecursive(objectFiles []string, sourcePath string, buildPath st
64
64
return objectFiles , nil
65
65
}
66
66
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 )
69
69
if err != nil {
70
70
return nil , i18n .WrapError (err )
71
71
}
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 )
73
73
if err != nil {
74
74
return nil , i18n .WrapError (err )
75
75
}
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 )
77
77
if err != nil {
78
78
return nil , i18n .WrapError (err )
79
79
}
80
80
return objectFiles , nil
81
81
}
82
82
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 ) {
84
84
sources , err := findFilesInFolder (sourcePath , extension , recurse )
85
85
if err != nil {
86
86
return nil , i18n .WrapError (err )
87
87
}
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 )
89
89
}
90
90
91
91
func findFilesInFolder (sourcePath string , extension string , recurse bool ) ([]string , error ) {
@@ -116,9 +116,9 @@ func findFilesInFolder(sourcePath string, extension string, recurse bool) ([]str
116
116
return sources , nil
117
117
}
118
118
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 ) {
120
120
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 )
122
122
if err != nil {
123
123
return nil , i18n .WrapError (err )
124
124
}
@@ -128,7 +128,7 @@ func compileFilesWithRecipe(objectFiles []string, sourcePath string, sources []s
128
128
return objectFiles , nil
129
129
}
130
130
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 ) {
132
132
properties := buildProperties .Clone ()
133
133
properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS ] = properties [constants .BUILD_PROPERTIES_COMPILER_WARNING_FLAGS + "." + warningsLevel ]
134
134
properties [constants .BUILD_PROPERTIES_INCLUDES ] = strings .Join (includes , constants .SPACE )
@@ -144,7 +144,7 @@ func compileFileWithRecipe(sourcePath string, source string, buildPath string, b
144
144
return "" , i18n .WrapError (err )
145
145
}
146
146
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 )
148
148
if err != nil {
149
149
return "" , i18n .WrapError (err )
150
150
}
@@ -161,7 +161,7 @@ func compileFileWithRecipe(sourcePath string, source string, buildPath string, b
161
161
return properties [constants .BUILD_PROPERTIES_OBJECT_FILE ], nil
162
162
}
163
163
164
- func ObjFileIsUpToDate (sourceFile , objectFile , dependencyFile string ) (bool , error ) {
164
+ func ObjFileIsUpToDate (sourceFile , objectFile , dependencyFile string , debugLevel int , logger i18n. Logger ) (bool , error ) {
165
165
sourceFile = filepath .Clean (sourceFile )
166
166
objectFile = filepath .Clean (objectFile )
167
167
dependencyFile = filepath .Clean (dependencyFile )
0 commit comments