@@ -25,6 +25,7 @@ import (
2525 rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2626 paths "github.com/arduino/go-paths-helper"
2727 properties "github.com/arduino/go-properties-orderedmap"
28+ "go.bug.st/f"
2829 semver "go.bug.st/relaxed-semver"
2930)
3031
@@ -78,6 +79,7 @@ type Library struct {
7879 License string
7980 Properties * properties.Map
8081 Examples paths.PathList
82+ Dependencies []* Dependency
8183 declaredHeaders []string
8284 sourceHeaders []string
8385 CompatibleWith map [string ]bool
@@ -142,6 +144,13 @@ func (library *Library) ToRPCLibrary() (*rpc.Library, error) {
142144 Examples : library .Examples .AsStrings (),
143145 ProvidesIncludes : headers ,
144146 CompatibleWith : library .CompatibleWith ,
147+ Dependencies : f .Map (library .Dependencies , func (d * Dependency ) * rpc.LibraryDependency {
148+ dep := & rpc.LibraryDependency {Name : d .GetName ()}
149+ if d .GetConstraint () != nil {
150+ dep .VersionConstraint = d .GetConstraint ().String ()
151+ }
152+ return dep
153+ }),
145154 }, nil
146155}
147156
@@ -239,3 +248,19 @@ func (library *Library) SourceHeaders() ([]string, error) {
239248 }
240249 return library .sourceHeaders , nil
241250}
251+
252+ // Dependency is a library dependency
253+ type Dependency struct {
254+ Name string
255+ VersionConstraint semver.Constraint
256+ }
257+
258+ // GetName returns the name of the dependency
259+ func (r * Dependency ) GetName () string {
260+ return r .Name
261+ }
262+
263+ // GetConstraint returns the version Constraint of the dependecy
264+ func (r * Dependency ) GetConstraint () semver.Constraint {
265+ return r .VersionConstraint
266+ }
0 commit comments