Skip to content

Commit 1db0941

Browse files
committed
Correct regular expression used to parse library.properties depends field elements
Empty version constraints are supported by the Arduino library system (they match any version). Previously, the regular expression used to split the library name from the version constraint caused these empty constraints to incorrectly be considered invalid.
1 parent 10dd6a2 commit 1db0941

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: internal/rule/rulefunction/library.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ type libDependency struct {
15441544
parseConstraintErr error // Error produced by parsing the version constraint.
15451545
}
15461546

1547-
var dependRegexp = regexp.MustCompile("^([^()]+?) *(?:\\((.+)\\))?$")
1547+
var dependRegexp = regexp.MustCompile("^([^()]+?) *(?:\\((.*)\\))?$")
15481548

15491549
// libDependencies parses the library.properties `depends` field contents and returns an array of libDependency objects
15501550
func libDependencies(depends string) []libDependency {

Diff for: internal/rule/rulefunction/testdata/libraries/DependsIndexed/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=Supports HTTP1.1 and you can do GET and POST.
77
category=Communication
88
url=http://example.com/
99
architectures=avr
10-
depends=,(foo),foo (bar),Adafruit NeoPixel,Servo (<1.1.4),Stepper (<=1.1.3),Mouse (=1.0.0),Keyboard (>=1.0.1),WiFiNINA (>1.0.0)
10+
depends=,(foo),foo (bar),Adafruit NeoPixel,Servo (<1.1.4),Stepper (<=1.1.3),Mouse (=1.0.0),Keyboard (>=1.0.1),WiFiNINA (>1.0.0),Ethernet ()

0 commit comments

Comments
 (0)