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 @@ -187,6 +187,20 @@ func (p *ProfileRequiredPlatforms) AsYaml() string {
187
187
return res
188
188
}
189
189
190
+ func (p * ProfileRequiredPlatforms ) UnmarshalYAML (unmarshal func (interface {}) error ) error {
191
+ _p := (* []* ProfilePlatformReference )(p )
192
+ if err := unmarshal (_p ); err != nil {
193
+ return err
194
+ }
195
+ requireSystemPlatform := (* _p )[0 ].RequireSystemInstalledPlatform ()
196
+ for _ , platform := range * _p {
197
+ if platform .RequireSystemInstalledPlatform () != requireSystemPlatform {
198
+ return errors .New (i18n .Tr ("all platforms in a profile must either require a specific version or not" ))
199
+ }
200
+ }
201
+ return nil
202
+ }
203
+
190
204
// ProfileRequiredLibraries is a list of ProfileLibraryReference (libraries
191
205
// required to build the sketch using this profile)
192
206
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