@@ -25,6 +25,7 @@ import (
25
25
rpc "github.com./arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
26
26
paths "github.com./arduino/go-paths-helper"
27
27
properties "github.com./arduino/go-properties-orderedmap"
28
+ "go.bug.st/f"
28
29
semver "go.bug.st/relaxed-semver"
29
30
)
30
31
@@ -78,6 +79,7 @@ type Library struct {
78
79
License string
79
80
Properties * properties.Map
80
81
Examples paths.PathList
82
+ Dependencies []* Dependency
81
83
declaredHeaders []string
82
84
sourceHeaders []string
83
85
CompatibleWith map [string ]bool
@@ -142,6 +144,13 @@ func (library *Library) ToRPCLibrary() (*rpc.Library, error) {
142
144
Examples : library .Examples .AsStrings (),
143
145
ProvidesIncludes : headers ,
144
146
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
+ }),
145
154
}, nil
146
155
}
147
156
@@ -239,3 +248,19 @@ func (library *Library) SourceHeaders() ([]string, error) {
239
248
}
240
249
return library .sourceHeaders , nil
241
250
}
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