@@ -164,6 +164,7 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageDir
164
164
} else if exist {
165
165
166
166
// case: ARCHITECTURE/boards.txt
167
+ // this is the general case for unversioned Platform
167
168
version := semver .MustParse ("" )
168
169
169
170
// FIXME: this check is duplicated, find a better way to handle this
@@ -173,6 +174,34 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageDir
173
174
continue
174
175
}
175
176
177
+ // check if package_bundled_index.json exists
178
+ packageBundledIndexPath := packageDir .Parent ().Join ("package_index_bundled.json" )
179
+ if packageBundledIndexPath .Exist () {
180
+ // particular case: ARCHITECTURE/boards.txt with package_bundled_index.json
181
+
182
+ // this is an unversioned Platform with a package_index_bundled.json that
183
+ // gives information about the version and tools needed
184
+
185
+ // Parse the bundled index and merge to the general index
186
+ index , err := pm .LoadPackageIndexFromFile (packageBundledIndexPath )
187
+ if err != nil {
188
+ return fmt .Errorf ("parsing IDE bundled index: %s" , err )
189
+ }
190
+
191
+ // Now export the bundled index in a temporary core.Packages to retrieve the bundled package version
192
+ tmp := cores .NewPackages ()
193
+ index .MergeIntoPackages (tmp )
194
+ if tmpPackage := tmp .GetOrCreatePackage (targetPackage .Name ); tmpPackage == nil {
195
+ pm .Log .Warnf ("Can't determine bundle platform version for %s" , targetPackage .Name )
196
+ } else if tmpPlatform := tmpPackage .GetOrCreatePlatform (architecure ); tmpPlatform == nil {
197
+ pm .Log .Warnf ("Can't determine bundle platform version for %s:%s" , targetPackage .Name , architecure )
198
+ } else if tmpPlatformRelease := tmpPlatform .GetLatestRelease (); tmpPlatformRelease == nil {
199
+ pm .Log .Warnf ("Can't determine bundle platform version for %s:%s, no valid release found" , targetPackage .Name , architecure )
200
+ } else {
201
+ version = tmpPlatformRelease .Version
202
+ }
203
+ }
204
+
176
205
platform := targetPackage .GetOrCreatePlatform (architecure )
177
206
release , err := platform .GetOrCreateRelease (version )
178
207
if err != nil {
0 commit comments