File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,20 @@ func (p *ProfileRequiredPlatforms) AsYaml() string {
186
186
return res
187
187
}
188
188
189
+ func (p * ProfileRequiredPlatforms ) UnmarshalYAML (unmarshal func (interface {}) error ) error {
190
+ _p := (* []* ProfilePlatformReference )(p )
191
+ if err := unmarshal (_p ); err != nil {
192
+ return err
193
+ }
194
+ requireSystemPlatform := (* _p )[0 ].RequireSystemInstalledPlatform ()
195
+ for _ , platform := range * _p {
196
+ if platform .RequireSystemInstalledPlatform () != requireSystemPlatform {
197
+ return errors .New (i18n .Tr ("all platforms in a profile must either require a specific version or not" ))
198
+ }
199
+ }
200
+ return nil
201
+ }
202
+
189
203
// ProfileRequiredLibraries is a list of ProfileLibraryReference (libraries
190
204
// required to build the sketch using this profile)
191
205
type ProfileRequiredLibraries []* ProfileLibraryReference
Original file line number Diff line number Diff line change @@ -47,4 +47,9 @@ func TestProjectFileLoading(t *testing.T) {
47
47
require .NoError (t , err )
48
48
require .Equal (t , string (golden ), proj .AsYaml ())
49
49
}
50
+ {
51
+ sketchProj := paths .New ("testdata" , "profiles" , "bad_profile_1.yml" )
52
+ _ , err := LoadProjectFile (sketchProj )
53
+ require .Error (t , err )
54
+ }
50
55
}
Original file line number Diff line number Diff line change
1
+ profiles :
2
+ tiny :
3
+ notes : Invalid profile mixing versioned and non-versioned platforms.
4
+ fqbn : attiny:avr:ATtinyX5:cpu=attiny85,clock=internal16
5
+ platforms :
6
+ - platform : attiny:avr
7
+ platform_index_url : http://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
8
+ - platform : arduino:avr (1.8.3)
9
+
You can’t perform that action at this time.
0 commit comments