@@ -33,6 +33,7 @@ import (
33
33
"arduino.cc/builder/constants"
34
34
_ "arduino.cc/builder/i18n"
35
35
"arduino.cc/builder/types"
36
+ "arduino.cc/builder/utils"
36
37
"arduino.cc/properties"
37
38
"encoding/json"
38
39
"errors"
@@ -99,7 +100,7 @@ var systems = map[string]string{
99
100
100
101
var globalProperties map [string ]properties.Map
101
102
102
- func PackageIndexFoldersToPropertiesMap (packages * types.Packages , folders []string ) (map [string ]properties.Map , error ) {
103
+ func PackageIndexFoldersToPropertiesMap (packages * types.Packages , folders []string , specifiedFilenames [] string ) (map [string ]properties.Map , error ) {
103
104
104
105
var paths []string
105
106
@@ -111,7 +112,13 @@ func PackageIndexFoldersToPropertiesMap(packages *types.Packages, folders []stri
111
112
files , _ := ioutil .ReadDir (folder )
112
113
for _ , f := range files {
113
114
if strings .HasPrefix (f .Name (), "package" ) && strings .HasSuffix (f .Name (), "index.json" ) {
114
- paths = append (paths , filepath .Join (folder , f .Name ()))
115
+ // if a list of required json has been provided only add them
116
+ if specifiedFilenames != nil && len (specifiedFilenames ) > 1 &&
117
+ ! utils .SliceContains (specifiedFilenames , f .Name ()) {
118
+ continue
119
+ } else {
120
+ paths = append (paths , filepath .Join (folder , f .Name ()))
121
+ }
115
122
}
116
123
}
117
124
}
0 commit comments