Skip to content

Support full constraint syntax of library.properties depends field #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
per1234 committed May 26, 2022
commit 1db094180aca62dcf03d37ab7533f1e4dda4bf50
2 changes: 1 addition & 1 deletion internal/rule/rulefunction/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ type libDependency struct {
parseConstraintErr error // Error produced by parsing the version constraint.
}

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

// libDependencies parses the library.properties `depends` field contents and returns an array of libDependency objects
func libDependencies(depends string) []libDependency {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ paragraph=Supports HTTP1.1 and you can do GET and POST.
category=Communication
url=http://example.com/
architectures=avr
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)
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 ()