@@ -24,17 +24,20 @@ import (
24
24
"github.com/arduino/arduino-cli/arduino/security"
25
25
"github.com/arduino/arduino-cli/i18n"
26
26
"github.com/arduino/go-paths-helper"
27
+ easyjson "github.com/mailru/easyjson"
27
28
"github.com/sirupsen/logrus"
28
29
semver "go.bug.st/relaxed-semver"
29
30
)
30
31
31
32
// Index represents Cores and Tools struct as seen from package_index.json file.
33
+ //easyjson:json
32
34
type Index struct {
33
35
Packages []* indexPackage `json:"packages"`
34
36
IsTrusted bool
35
37
}
36
38
37
39
// indexPackage represents a single entry from package_index.json file.
40
+ //easyjson:json
38
41
type indexPackage struct {
39
42
Name string `json:"name"`
40
43
Maintainer string `json:"maintainer"`
@@ -47,6 +50,7 @@ type indexPackage struct {
47
50
}
48
51
49
52
// indexPlatformRelease represents a single Core Platform from package_index.json file.
53
+ //easyjson:json
50
54
type indexPlatformRelease struct {
51
55
Name string `json:"name"`
52
56
Architecture string `json:"architecture"`
@@ -65,32 +69,37 @@ type indexPlatformRelease struct {
65
69
}
66
70
67
71
// indexToolDependency represents a single dependency of a core from a tool.
72
+ //easyjson:json
68
73
type indexToolDependency struct {
69
74
Packager string `json:"packager"`
70
75
Name string `json:"name"`
71
76
Version * semver.RelaxedVersion `json:"version"`
72
77
}
73
78
74
79
// indexDiscoveryDependency represents a single dependency of a core from a pluggable discovery tool.
80
+ //easyjson:json
75
81
type indexDiscoveryDependency struct {
76
82
Packager string `json:"packager"`
77
83
Name string `json:"name"`
78
84
}
79
85
80
86
// indexMonitorDependency represents a single dependency of a core from a pluggable monitor tool.
87
+ //easyjson:json
81
88
type indexMonitorDependency struct {
82
89
Packager string `json:"packager"`
83
90
Name string `json:"name"`
84
91
}
85
92
86
93
// indexToolRelease represents a single Tool from package_index.json file.
94
+ //easyjson:json
87
95
type indexToolRelease struct {
88
96
Name string `json:"name"`
89
97
Version * semver.RelaxedVersion `json:"version"`
90
98
Systems []indexToolReleaseFlavour `json:"systems"`
91
99
}
92
100
93
101
// indexToolReleaseFlavour represents a single tool flavor in the package_index.json file.
102
+ //easyjson:json
94
103
type indexToolReleaseFlavour struct {
95
104
OS string `json:"host"`
96
105
URL string `json:"url"`
@@ -100,17 +109,20 @@ type indexToolReleaseFlavour struct {
100
109
}
101
110
102
111
// indexBoard represents a single Board as written in package_index.json file.
112
+ //easyjson:json
103
113
type indexBoard struct {
104
114
Name string `json:"name"`
105
115
ID []indexBoardID `json:"id,omitempty"`
106
116
}
107
117
108
118
// indexBoardID represents the ID of a single board. i.e. uno, yun, diecimila, micro and the likes
119
+ //easyjson:json
109
120
type indexBoardID struct {
110
121
USB string `json:"usb"`
111
122
}
112
123
113
124
// indexHelp represents the help URL
125
+ //easyjson:json
114
126
type indexHelp struct {
115
127
Online string `json:"online,omitempty"`
116
128
}
@@ -352,7 +364,7 @@ func LoadIndex(jsonIndexFile *paths.Path) (*Index, error) {
352
364
return nil , err
353
365
}
354
366
var index Index
355
- err = json .Unmarshal (buff , & index )
367
+ err = easyjson .Unmarshal (buff , & index )
356
368
if err != nil {
357
369
return nil , err
358
370
}
@@ -381,7 +393,7 @@ func LoadIndexNoSign(jsonIndexFile *paths.Path) (*Index, error) {
381
393
return nil , err
382
394
}
383
395
var index Index
384
- err = json .Unmarshal (buff , & index )
396
+ err = easyjson .Unmarshal (buff , & index )
385
397
if err != nil {
386
398
return nil , err
387
399
}
0 commit comments