Skip to content

Commit 080fc7d

Browse files
facchinmcmaglie
authored andcommitted
Replace runtime variables with board-specific ones
Only works if a valid package_index json has been provided
1 parent 732fa1b commit 080fc7d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

add_missing_build_properties_from_parent_platform_txt_files.go

+25
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
package builder
3131

3232
import (
33+
"github.com/arduino/arduino-builder/json_package_index"
3334
"github.com/arduino/arduino-builder/types"
3435
)
3536

@@ -48,3 +49,27 @@ func (s *AddMissingBuildPropertiesFromParentPlatformTxtFiles) Run(ctx *types.Con
4849

4950
return nil
5051
}
52+
53+
type OverridePropertiesWithJsonInfo struct{}
54+
55+
func (s *OverridePropertiesWithJsonInfo) Run(ctx *types.Context) error {
56+
57+
if ctx.JsonFolders != nil {
58+
59+
jsonProperties, err := json_package_index.PackageIndexFoldersToPropertiesMap(ctx.JsonFolders)
60+
61+
if err != nil {
62+
// doesn't matter, log the broken package in verbose mode
63+
}
64+
65+
newBuildProperties := jsonProperties[ctx.TargetPackage.PackageId+":"+ctx.TargetPlatform.PlatformId+":"+ctx.TargetPlatform.Properties["version"]]
66+
67+
buildProperties := ctx.BuildProperties.Clone()
68+
69+
buildProperties.Merge(newBuildProperties)
70+
71+
ctx.BuildProperties = buildProperties
72+
}
73+
74+
return nil
75+
}

container_setup.go

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func (s *ContainerSetupHardwareToolsLibsSketchAndProps) Run(ctx *types.Context)
5252
&LoadVIDPIDSpecificProperties{},
5353
&SetCustomBuildProperties{},
5454
&AddMissingBuildPropertiesFromParentPlatformTxtFiles{},
55+
&OverridePropertiesWithJsonInfo{},
5556
}
5657

5758
for _, command := range commands {

0 commit comments

Comments
 (0)