@@ -522,124 +522,6 @@ func UpdateCoreLibrariesIndex(ctx context.Context, req *rpc.UpdateCoreLibrariesI
522522 return nil
523523}
524524
525- // Outdated returns a list struct containing both Core and Libraries that can be updated
526- func Outdated (ctx context.Context , req * rpc.OutdatedRequest ) (* rpc.OutdatedResponse , error ) {
527- id := req .GetInstance ().GetId ()
528-
529- lm := GetLibraryManager (id )
530- if lm == nil {
531- return nil , & arduino.InvalidInstanceError {}
532- }
533-
534- outdatedLibraries := []* rpc.InstalledLibrary {}
535- for _ , libAlternatives := range lm .Libraries {
536- for _ , library := range libAlternatives .Alternatives {
537- if library .Location != libraries .User {
538- continue
539- }
540- available := lm .Index .FindLibraryUpdate (library )
541- if available == nil {
542- continue
543- }
544-
545- outdatedLibraries = append (outdatedLibraries , & rpc.InstalledLibrary {
546- Library : getOutputLibrary (library ),
547- Release : getOutputRelease (available ),
548- })
549- }
550- }
551-
552- pm := GetPackageManager (id )
553- if pm == nil {
554- return nil , & arduino.InvalidInstanceError {}
555- }
556-
557- outdatedPlatforms := []* rpc.Platform {}
558- for _ , targetPackage := range pm .Packages {
559- for _ , installed := range targetPackage .Platforms {
560- if installedRelease := pm .GetInstalledPlatformRelease (installed ); installedRelease != nil {
561- latest := installed .GetLatestRelease ()
562- if latest == nil || latest == installedRelease {
563- continue
564- }
565- rpcPlatform := PlatformReleaseToRPC (latest )
566- rpcPlatform .Installed = installedRelease .Version .String ()
567-
568- outdatedPlatforms = append (
569- outdatedPlatforms ,
570- rpcPlatform ,
571- )
572- }
573- }
574- }
575-
576- return & rpc.OutdatedResponse {
577- OutdatedLibraries : outdatedLibraries ,
578- OutdatedPlatforms : outdatedPlatforms ,
579- }, nil
580- }
581-
582- func getOutputLibrary (lib * libraries.Library ) * rpc.Library {
583- insdir := ""
584- if lib .InstallDir != nil {
585- insdir = lib .InstallDir .String ()
586- }
587- srcdir := ""
588- if lib .SourceDir != nil {
589- srcdir = lib .SourceDir .String ()
590- }
591- utldir := ""
592- if lib .UtilityDir != nil {
593- utldir = lib .UtilityDir .String ()
594- }
595- cntplat := ""
596- if lib .ContainerPlatform != nil {
597- cntplat = lib .ContainerPlatform .String ()
598- }
599-
600- return & rpc.Library {
601- Name : lib .Name ,
602- Author : lib .Author ,
603- Maintainer : lib .Maintainer ,
604- Sentence : lib .Sentence ,
605- Paragraph : lib .Paragraph ,
606- Website : lib .Website ,
607- Category : lib .Category ,
608- Architectures : lib .Architectures ,
609- Types : lib .Types ,
610- InstallDir : insdir ,
611- SourceDir : srcdir ,
612- UtilityDir : utldir ,
613- Location : lib .Location .ToRPCLibraryLocation (),
614- ContainerPlatform : cntplat ,
615- Layout : lib .Layout .ToRPCLibraryLayout (),
616- RealName : lib .RealName ,
617- DotALinkage : lib .DotALinkage ,
618- Precompiled : lib .Precompiled ,
619- LdFlags : lib .LDflags ,
620- IsLegacy : lib .IsLegacy ,
621- Version : lib .Version .String (),
622- License : lib .License ,
623- }
624- }
625-
626- func getOutputRelease (lib * librariesindex.Release ) * rpc.LibraryRelease {
627- if lib != nil {
628- return & rpc.LibraryRelease {
629- Author : lib .Author ,
630- Version : lib .Version .String (),
631- Maintainer : lib .Maintainer ,
632- Sentence : lib .Sentence ,
633- Paragraph : lib .Paragraph ,
634- Website : lib .Website ,
635- Category : lib .Category ,
636- Architectures : lib .Architectures ,
637- Types : lib .Types ,
638- }
639- }
640- return & rpc.LibraryRelease {}
641- }
642-
643525// LoadSketch collects and returns all files composing a sketch
644526func LoadSketch (ctx context.Context , req * rpc.LoadSketchRequest ) (* rpc.LoadSketchResponse , error ) {
645527 // TODO: This should be a ToRpc function for the Sketch struct
0 commit comments