@@ -21,7 +21,6 @@ import (
21
21
"strconv"
22
22
23
23
"github.com/arduino/arduino-cli/legacy/builder/builder_utils"
24
- "github.com/arduino/arduino-cli/legacy/builder/constants"
25
24
"github.com/arduino/arduino-cli/legacy/builder/types"
26
25
"github.com/arduino/arduino-cli/legacy/builder/utils"
27
26
"github.com/arduino/go-properties-orderedmap"
@@ -52,10 +51,10 @@ func (s *Sizer) Run(ctx *types.Context) error {
52
51
53
52
func checkSize (ctx * types.Context , buildProperties * properties.Map ) error {
54
53
properties := buildProperties .Clone ()
55
- properties .Set (constants . BUILD_PROPERTIES_COMPILER_WARNING_FLAGS , properties .Get (constants . BUILD_PROPERTIES_COMPILER_WARNING_FLAGS + " ."+ ctx .WarningsLevel ))
54
+ properties .Set ("compiler.warning_flags" , properties .Get ("compiler.warning_flags ."+ ctx .WarningsLevel ))
56
55
57
- maxTextSizeString := properties .Get (constants . PROPERTY_UPLOAD_MAX_SIZE )
58
- maxDataSizeString := properties .Get (constants . PROPERTY_UPLOAD_MAX_DATA_SIZE )
56
+ maxTextSizeString := properties .Get ("upload.maximum_size" )
57
+ maxDataSizeString := properties .Get ("upload.maximum_data_size" )
59
58
60
59
if maxTextSizeString == "" {
61
60
return nil
@@ -121,8 +120,8 @@ func checkSize(ctx *types.Context, buildProperties *properties.Map) error {
121
120
return errors .New (tr ("data section exceeds available space in board" ))
122
121
}
123
122
124
- if properties .Get (constants . PROPERTY_WARN_DATA_PERCENT ) != "" {
125
- warnDataPercentage , err := strconv .Atoi (properties . Get ( constants . PROPERTY_WARN_DATA_PERCENT ) )
123
+ if w := properties .Get ("build.warn_data_percentage" ); w != "" {
124
+ warnDataPercentage , err := strconv .Atoi (w )
126
125
if err != nil {
127
126
return err
128
127
}
@@ -135,7 +134,7 @@ func checkSize(ctx *types.Context, buildProperties *properties.Map) error {
135
134
}
136
135
137
136
func execSizeRecipe (ctx * types.Context , properties * properties.Map ) (textSize int , dataSize int , eepromSize int , resErr error ) {
138
- command , err := builder_utils .PrepareCommandForRecipe (properties , constants . RECIPE_SIZE_PATTERN , false )
137
+ command , err := builder_utils .PrepareCommandForRecipe (properties , "recipe.size.pattern" , false )
139
138
if err != nil {
140
139
resErr = fmt .Errorf (tr ("Error while determining sketch size: %s" ), err )
141
140
return
@@ -150,7 +149,7 @@ func execSizeRecipe(ctx *types.Context, properties *properties.Map) (textSize in
150
149
// force multiline match prepending "(?m)" to the actual regexp
151
150
// return an error if RECIPE_SIZE_REGEXP doesn't exist
152
151
153
- textSize , err = computeSize (properties .Get (constants . RECIPE_SIZE_REGEXP ), out )
152
+ textSize , err = computeSize (properties .Get ("recipe.size.regex" ), out )
154
153
if err != nil {
155
154
resErr = fmt .Errorf (tr ("Invalid size regexp: %s" ), err )
156
155
return
@@ -160,13 +159,13 @@ func execSizeRecipe(ctx *types.Context, properties *properties.Map) (textSize in
160
159
return
161
160
}
162
161
163
- dataSize , err = computeSize (properties .Get (constants . RECIPE_SIZE_REGEXP_DATA ), out )
162
+ dataSize , err = computeSize (properties .Get ("recipe.size.regex.data" ), out )
164
163
if err != nil {
165
164
resErr = fmt .Errorf (tr ("Invalid data size regexp: %s" ), err )
166
165
return
167
166
}
168
167
169
- eepromSize , err = computeSize (properties .Get (constants . RECIPE_SIZE_REGEXP_EEPROM ), out )
168
+ eepromSize , err = computeSize (properties .Get ("recipe.size.regex.eeprom" ), out )
170
169
if err != nil {
171
170
resErr = fmt .Errorf (tr ("Invalid eeprom size regexp: %s" ), err )
172
171
return
0 commit comments