Skip to content

Commit d343ee5

Browse files
committed
Increase priority of libraries specified via --library flag
1 parent bfb5f3f commit d343ee5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: arduino/libraries/librariesresolver/cpp.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ func ComputePriority(lib *libraries.Library, header, arch string) int {
212212
case libraries.User:
213213
priority += 3
214214
case libraries.Unmanaged:
215-
priority += 4
215+
// Bonus for libraries specified via --libraries flags, those libraries gets the highest priority
216+
priority += 10000
216217
default:
217218
panic(fmt.Sprintf("Invalid library location: %d", lib.Location))
218219
}

Diff for: docs/sketch-build-process.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ generated for the path to each library dependency and appended to the
5252
If multiple libraries contain a file that matches the `#include` directive, the priority is determined by applying the
5353
following rules, one by one in this order, until a rule determines a winner:
5454

55+
1. A library that has been specified using the [`--library` option](commands/arduino-cli_compile.md#options) of
56+
`arduino-cli compile` wins against a library in other locations
5557
1. A library that is architecture compatible wins against a library that is not architecture compatible (see
5658
[**Architecture Matching**](#architecture-matching))
5759
1. A library with both [library name](#library-name-priority) and [folder name](#folder-name-priority) matching the
@@ -120,8 +122,6 @@ The "folder name priority" is determined as follows (in order of highest to lowe
120122

121123
The "location priority" is determined as follows (in order of highest to lowest priority):
122124

123-
1. The library is specified using the [`--library` option](commands/arduino-cli_compile.md#options) of
124-
`arduino-cli compile`
125125
1. The library is under a custom libraries path specified via the
126126
[`--libraries` option](commands/arduino-cli_compile.md#options) of `arduino-cli compile` (in decreasing order of
127127
priority when multiple custom paths are defined)

0 commit comments

Comments
 (0)