@@ -43,7 +43,8 @@ import (
4343 "github.com/arduino/arduino-builder/constants"
4444 _ "github.com/arduino/arduino-builder/i18n"
4545 "github.com/arduino/arduino-builder/types"
46- properties "github.com/arduino/go-properties-map"
46+ "github.com/arduino/arduino-builder/utils"
47+ "github.com/arduino/go-properties-map"
4748)
4849
4950type core struct {
@@ -101,7 +102,7 @@ var systems = map[string]string{
101102
102103var globalProperties map [string ]properties.Map
103104
104- func PackageIndexFoldersToPropertiesMap (packages * types.Packages , folders []string ) (map [string ]properties.Map , error ) {
105+ func PackageIndexFoldersToPropertiesMap (packages * types.Packages , folders []string , specifiedFilenames [] string ) (map [string ]properties.Map , error ) {
105106
106107 var paths []string
107108
@@ -113,7 +114,13 @@ func PackageIndexFoldersToPropertiesMap(packages *types.Packages, folders []stri
113114 files , _ := ioutil .ReadDir (folder )
114115 for _ , f := range files {
115116 if strings .HasPrefix (f .Name (), "package" ) && strings .HasSuffix (f .Name (), "index.json" ) {
116- paths = append (paths , filepath .Join (folder , f .Name ()))
117+ // if a list of required json has been provided only add them
118+ if specifiedFilenames != nil && len (specifiedFilenames ) > 1 &&
119+ ! utils .SliceContains (specifiedFilenames , f .Name ()) {
120+ continue
121+ } else {
122+ paths = append (paths , filepath .Join (folder , f .Name ()))
123+ }
117124 }
118125 }
119126 }
0 commit comments