8000 BuildProperties are now part of Context · kevans91/arduino-builder@310f2e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 310f2e2

Browse files
committed
BuildProperties are now part of Context
Signed-off-by: Cristian Maglie <c.maglie@arduino.cc>
1 parent 57203ac commit 310f2e2

23 files changed

+27
-51
lines changed

src/arduino.cc/builder/add_missing_build_properties_from_parent_platform_txt_files.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ package builder
3131

3232
import (
3333
"arduino.cc/builder/constants"
34-
"arduino.cc/builder/props"
3534
"arduino.cc/builder/types"
3635
)
3736

@@ -40,13 +39,13 @@ type AddMissingBuildPropertiesFromParentPlatformTxtFiles struct{}
4039
func (s *AddMissingBuildPropertiesFromParentPlatformTxtFiles) Run(context map[string]interface{}, ctx *types.Context) error {
4140
packages := context[constants.CTX_HARDWARE].(*types.Packages)
4241
targetPackage := ctx.TargetPackage
43-
buildProperties := context[constants.CTX_BUILD_PROPERTIES].(props.PropertiesMap)
42+
buildProperties := ctx.BuildProperties
4443

4544
newBuildProperties := packages.Properties.Clone()
4645
newBuildProperties.Merge(targetPackage.Properties)
4746
newBuildProperties.Merge(buildProperties)
4847

49-
context[constants.CTX_BUILD_PROPERTIES] = newBuildProperties
48+
ctx.BuildProperties = newBuildProperties
5049

5150
return nil
5251
}

src/arduino.cc/builder/coan_runner.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ package builder
3232
import (
3333
"arduino.cc/builder/constants"
3434
"arduino.cc/builder/i18n"
35-
"arduino.cc/builder/props"
3635
"arduino.cc/builder/types"
3736
"arduino.cc/builder/utils"
3837
"fmt"
@@ -61,7 +60,7 @@ func (s *CoanRunner) Run(context map[string]interface{}, ctx *types.Context) err
6160
return i18n.WrapError(err)
6261
}
6362

64-
buildProperties := context[constants.CTX_BUILD_PROPERTIES].(props.PropertiesMap)
63+
buildProperties := ctx.BuildProperties
6564
properties := buildProperties.Clone()
6665
properties.Merge(buildProperties.SubTree(constants.BUILD_PROPERTIES_TOOLS_KEY).SubTree(constants.COAN))
6766
properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = coanTargetFileName

src/arduino.cc/builder/constants/constants.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ const COAN = "coan"
7676
const CTAGS = "ctags"
7777
const CTX_ARCHIVE_FILE_PATH_CORE = "archiveFileCore"
7878
const CTX_BUILD_CORE = "buildCore"
79-
const CTX_BUILD_PROPERTIES = "buildProperties"
8079
const CTX_FILE_PATH_TO_READ = "filePathToRead"
8180
const CTX_GCC_MINUS_E_SOURCE = "gccMinusESource"
8281
const CTX_GCC_MINUS_M_OUTPUT = "gccMinusMOutput"

src/arduino.cc/builder/ctags/ctags_runner.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ package ctags
3232
import (
3333
"arduino.cc/builder/constants"
3434
"arduino.cc/builder/i18n"
35-
"arduino.cc/builder/props"
3635
"arduino.cc/builder/types"
3736
"arduino.cc/builder/utils"
3837
"fmt"
@@ -41,7 +40,7 @@ import (
4140
type CTagsRunner struct{}
4241

4342
func (s *CTagsRunner) Run(context map[string]interface{}, ctx *types.Context) error {
44-
buildProperties := context[constants.CTX_BUILD_PROPERTIES].(props.PropertiesMap)
43+
buildProperties := ctx.BuildProperties
4544
ctagsTargetFilePath := ctx.CTagsTargetFile
4645
logger := ctx.GetLogger()
4746

src/arduino.cc/builder/dump_build_properties.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
package builder
3131

3232
import (
33-
"arduino.cc/builder/constants"
34-
"arduino.cc/builder/props"
3533
"arduino.cc/builder/types"
3634
"arduino.cc/builder/utils"
3735
"fmt"
@@ -41,7 +39,7 @@ import (
4139
type DumpBuildProperties struct{}
4240

4341
func (s *DumpBuildProperties) Run(context map[string]interface{}, ctx *types.Context) error {
44-
buildProperties := context[constants.CTX_BUILD_PROPERTIES].(props.PropertiesMap)
42+
buildProperties := ctx.BuildProperties
4543

4644
keys := utils.KeysOfMapOfString(buildProperties)
4745
sort.Strings(keys)

src/arduino.cc/builder/gcc_preproc_runner.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ func prepareGCCPreprocRecipeProperties(context map[string]interface{}, ctx *type
108108
targetFilePath = filepath.Join(preprocPath, targetFilePath)
109109
}
110110

111-
properties := make(props.PropertiesMap)
112-
if p, ok := context[constants.CTX_BUILD_PROPERTIES]; ok {
113-
properties = p.(props.PropertiesMap).Clone()
114-
}
115-
111+
properties := ctx.BuildProperties
116112
properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = sourceFilePath
117113
properties[constants.BUILD_PROPERTIES_PREPROCESSED_FILE_PATH] = targetFilePath
118114

src/arduino.cc/builder/includes_finder_with_gcc.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
"arduino.cc/builder/builder_utils"
3434
"arduino.cc/builder/constants"
3535
"arduino.cc/builder/i18n"
36-
"arduino.cc/builder/props"
3736
"arduino.cc/builder/types"
3837
"arduino.cc/builder/utils"
3938
"strings"
@@ -44,10 +43,7 @@ type IncludesFinderWithGCC struct {
4443
}
4544

4645
func (s *IncludesFinderWithGCC) Run(context map[string]interface{}, ctx *types.Context) error {
47-
buildProperties := make(props.PropertiesMap)
48-
if p, ok := context[constants.CTX_BUILD_PROPERTIES]; ok {
49-
buildProperties = p.(props.PropertiesMap).Clone()
50-
}
46+
buildProperties := ctx.BuildProperties
5147
verbose := ctx.Verbose
5248
logger := ctx.GetLogger()
5349

src/arduino.cc/builder/includes_to_include_folders.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (s *IncludesToIncludeFolders) Run(context map[string]interface{}, ctx *type
6969

7070
ctx.ImportedLibraries = importedLibraries
7171

72-
buildProperties := context[constants.CTX_BUILD_PROPERTIES].(props.PropertiesMap)
72+
buildProperties := ctx.BuildProperties
7373
verbose := ctx.Verbose
7474
includeFolders := resolveIncludeFolders(newlyImportedLibraries, buildProperties, verbose)
7575
context[constants.CTX_INCLUDE_FOLDERS] = includeFolders

src/arduino.cc/builder/load_vid_pid_specific_properties.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (s *LoadVIDPIDSpecificProperties) Run(context map[string]interface{}, ctx *
5252
vid := vidPidParts[0]
5353
pid := vidPidParts[1]
5454

55-
buildProperties := context[constants.CTX_BUILD_PROPERTIES].(props.PropertiesMap)
55+
buildProperties := ctx.BuildProperties
5656
VIDPIDIndex, err := findVIDPIDIndex(buildProperties, vid, pid)
5757
if err != nil {
5858
return i18n.WrapError(err)

src/arduino.cc/builder/merge_sketch_with_bootloader.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ package builder
3232
import (
3333
"arduino.cc/builder/constants"
3434
"arduino.cc/builder/i18n"
35-
"arduino.cc/builder/props"
3635
"arduino.cc/builder/types"
3736
"arduino.cc/builder/utils"
3837
"os"
@@ -43,7 +42,7 @@ import (
4342
type MergeSketchWithBootloader struct{}
4443

4544
func (s *MergeSketchWithBootloader) Run(context map[string]interface{}, ctx *types.Context) error {
46-
buildProperties := context[constants.CTX_BUILD_PROPERTIES].(props.PropertiesMap)
45+
buildProperties := ctx.BuildProperties
4746
if !utils.MapStringStringHas(buildProperties, constants.BUILD_PROPERTIES_BOOTLOADER_NOBLINK) && !utils.MapStringStringHas(buildProperties, constants.BUILD_PROPERTIES_BOOTLOADER_FILE) {
4847
return nil
4948
}

0 commit comments

Comments
 (0)
0