Skip to content

feat: library folder name priority promotion for -main suffix #2233

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 8 commits into from
Jul 4, 2023
2 changes: 2 additions & 0 deletions arduino/libraries/librariesresolver/cpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ func ComputePriority(lib *libraries.Library, header, arch string) int {
priority += 600
} else if name == header || dirName == header {
priority += 500
} else if name == header+"-main" || dirName == header+"-main" {
priority += 410
} else if name == header+"-master" || dirName == header+"-master" {
priority += 400
} else if strings.HasPrefix(name, header) || strings.HasPrefix(dirName, header) {
Expand Down
2 changes: 2 additions & 0 deletions docs/sketch-build-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ The "library name priority" is determined as follows (in order of highest to low
| Rule | Example for `Arduino_Low_Power.h` |
| ------------------------------------------------------------------------- | --------------------------------- |
| The library name matches the include 100% | `Arduino Low Power` |
| The library name matches the include 100%, except with a `-main` suffix | `Arduino Low Power-main` |
| The library name matches the include 100%, except with a `-master` suffix | `Arduino Low Power-master` |
| The library name has a matching prefix | `Arduino Low Power Whatever` |
| The library name has a matching suffix | `Awesome Arduino Low Power` |
Expand All @@ -113,6 +114,7 @@ The "folder name priority" is determined as follows (in order of highest to lowe
| Rule | Example for `Servo.h` |
| ------------------------------------------------------------------------ | --------------------------- |
| The folder name matches the include 100% | `Servo` |
| The folder name matches the include 100%, except with a `-main` suffix | `Servo-main` |
| The folder name matches the include 100%, except with a `-master` suffix | `Servo-master` |
| The folder name has a matching prefix | `ServoWhatever` |
| The folder name has a matching suffix | `AwesomeServo` |
Expand Down