@@ -18,8 +18,6 @@ package packagemanager
18
18
import (
19
19
"errors"
20
20
"fmt"
21
- "os"
22
- "path/filepath"
23
21
"regexp"
24
22
"strconv"
25
23
"strings"
@@ -36,12 +34,7 @@ import (
36
34
// LoadHardware read all plaforms from the configured paths
37
35
func (pm * Builder ) LoadHardware () []error {
38
36
hardwareDirs := configuration .HardwareDirectories (configuration .Settings )
39
- merr := pm .LoadHardwareFromDirectories (hardwareDirs )
40
-
41
- bundleToolDirs := configuration .BuiltinToolsDirectories (configuration .Settings )
42
- merr = append (merr , pm .LoadToolsFromBundleDirectories (bundleToolDirs )... )
43
-
44
- return merr
37
+ return pm .LoadHardwareFromDirectories (hardwareDirs )
45
38
}
46
39
47
40
// LoadHardwareFromDirectories load plaforms from a set of directories
@@ -203,49 +196,9 @@ func (pm *Builder) loadPlatform(targetPackage *cores.Package, architecture strin
203
196
return & cmderrors.InvalidVersionError {Cause : fmt .Errorf ("%s: %s" , platformTxtPath , err )}
204
197
}
205
198
206
- // Check if package_bundled_index.json exists.
207
- // This is used indirectly by the Java IDE since it's necessary for the arduino-builder
208
- // to find cores bundled with that version of the IDE.
209
- // TODO: This piece of logic MUST be removed as soon as the Java IDE stops using the arduino-builder.
210
- isIDEBundled := false
211
- packageBundledIndexPath := platformPath .Parent ().Parent ().Join ("package_index_bundled.json" )
212
- if packageBundledIndexPath .Exist () {
213
- // particular case: ARCHITECTURE/boards.txt with package_bundled_index.json
214
-
215
- // this is an unversioned Platform with a package_index_bundled.json that
216
- // gives information about the version and tools needed
217
-
218
- // Parse the bundled index and merge to the general index
219
- index , err := pm .LoadPackageIndexFromFile (packageBundledIndexPath )
220
- if err != nil {
221
- return fmt .Errorf ("%s: %w" , tr ("parsing IDE bundled index" ), err )
222
- }
223
-
224
- // Now export the bundled index in a temporary core.Packages to retrieve the bundled package version
225
- tmp := cores .NewPackages ()
226
- index .MergeIntoPackages (tmp )
227
- if tmpPackage := tmp .GetOrCreatePackage (targetPackage .Name ); tmpPackage == nil {
228
- pm .log .Warnf ("Can't determine bundle platform version for %s" , targetPackage .Name )
229
- } else if tmpPlatform := tmpPackage .GetOrCreatePlatform (architecture ); tmpPlatform == nil {
230
- pm .log .Warnf ("Can't determine bundle platform version for %s:%s" , targetPackage .Name , architecture )
231
- } else if tmpPlatformRelease := tmpPlatform .GetLatestRelease (); tmpPlatformRelease == nil {
232
- pm .log .Warnf ("Can't determine bundle platform version for %s:%s, no valid release found" , targetPackage .Name , architecture )
233
- } else {
234
- version = tmpPlatformRelease .Version
235
- }
236
-
237
- isIDEBundled = true
238
- }
239
-
240
199
platform := targetPackage .GetOrCreatePlatform (architecture )
241
- if ! isIDEBundled {
242
- platform .ManuallyInstalled = true
243
- }
200
+ platform .ManuallyInstalled = true
244
201
release := platform .GetOrCreateRelease (version )
245
- release .IsIDEBundled = isIDEBundled
246
- if isIDEBundled {
247
- pm .log .Infof ("Package is built-in" )
248
- }
249
202
if err := pm .loadPlatformRelease (release , platformPath ); err != nil {
250
203
return fmt .Errorf ("%s: %w" , tr ("loading platform release %s" , release ), err )
251
204
}
@@ -658,83 +611,6 @@ func (pm *Builder) loadToolReleaseFromDirectory(tool *cores.Tool, version *semve
658
611
}
659
612
}
660
613
661
- // LoadToolsFromBundleDirectories FIXMEDOC
662
- func (pm * Builder ) LoadToolsFromBundleDirectories (dirs paths.PathList ) []error {
663
- var merr []error
664
- for _ , dir := range dirs {
665
- if err := pm .LoadToolsFromBundleDirectory (dir ); err != nil {
666
- merr = append (merr , fmt .Errorf ("%s: %w" , tr ("loading bundled tools from %s" , dir ), err ))
667
- }
668
- }
669
- return merr
670
- }
671
-
672
- // LoadToolsFromBundleDirectory FIXMEDOC
673
- func (pm * Builder ) LoadToolsFromBundleDirectory (toolsPath * paths.Path ) error {
674
- pm .log .Infof ("Loading tools from bundle dir: %s" , toolsPath )
675
-
676
- // We scan toolsPath content to find a "builtin_tools_versions.txt", if such file exists
677
- // then the all the tools are available in the same directory, mixed together, and their
678
- // name and version are written in the "builtin_tools_versions.txt" file.
679
- // If no "builtin_tools_versions.txt" is found, then the directory structure is the classic
680
- // TOOLSPATH/TOOL-NAME/TOOL-VERSION and it will be parsed as such and associated to an
681
- // "unnamed" packager.
682
-
683
- // TODO: get rid of "builtin_tools_versions.txt"
684
-
685
- // Search for builtin_tools_versions.txt
686
- builtinToolsVersionsTxtPath := ""
687
- findBuiltInToolsVersionsTxt := func (currentPath string , info os.FileInfo , err error ) error {
688
- if err != nil {
689
- // Ignore errors
690
- return nil
691
- }
692
- if builtinToolsVersionsTxtPath != "" {
693
- return filepath .SkipDir
694
- }
695
- if info .Name () == "builtin_tools_versions.txt" {
696
- builtinToolsVersionsTxtPath = currentPath
697
- return filepath .SkipDir
698
- }
699
- return nil
700
- }
701
- if err := filepath .Walk (toolsPath .String (), findBuiltInToolsVersionsTxt ); err != nil {
702
- return fmt .Errorf (tr ("searching for builtin_tools_versions.txt in %[1]s: %[2]s" ), toolsPath , err )
703
- }
704
-
705
- if builtinToolsVersionsTxtPath != "" {
706
- // If builtin_tools_versions.txt is found create tools based on the info
707
- // contained in that file
708
- pm .log .Infof ("Found builtin_tools_versions.txt" )
709
- toolPath , err := paths .New (builtinToolsVersionsTxtPath ).Parent ().Abs ()
710
- if err != nil {
711
- return fmt .Errorf (tr ("getting parent dir of %[1]s: %[2]s" ), builtinToolsVersionsTxtPath , err )
712
- }
713
-
714
- all , err := properties .Load (builtinToolsVersionsTxtPath )
715
- if err != nil {
716
- return fmt .Errorf (tr ("reading %[1]s: %[2]s" ), builtinToolsVersionsTxtPath , err )
717
- }
718
-
719
- for packager , toolsData := range all .FirstLevelOf () {
720
- targetPackage := pm .packages .GetOrCreatePackage (packager )
721
-
722
- for toolName , toolVersion := range toolsData .AsMap () {
723
- tool := targetPackage .GetOrCreateTool (toolName )
724
- version := semver .ParseRelaxed (toolVersion )
725
- release := tool .GetOrCreateRelease (version )
726
- release .InstallDir = toolPath
727
- pm .log .WithField ("tool" , release ).Infof ("Loaded tool" )
728
- }
729
- }
730
- } else {
731
- // otherwise load the tools inside the unnamed package
732
- unnamedPackage := pm .packages .GetOrCreatePackage ("" )
733
- pm .LoadToolsFromPackageDir (unnamedPackage , toolsPath )
734
- }
735
- return nil
736
- }
737
-
738
614
// LoadDiscoveries load all discoveries for all loaded platforms
739
615
// Returns error if:
740
616
// * A PluggableDiscovery instance can't be created
0 commit comments