Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Nov 12, 2024
1 parent bf834bf commit 0e4559b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 29 deletions.
31 changes: 16 additions & 15 deletions docs/sketch-build-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ generated for the path to each library dependency and appended to the
If multiple libraries contain a file that matches the `#include` directive, the priority is determined by applying the
following rules, one by one in this order, until a rule determines a winner:

1. A library that has been specified using the [`--library` option](commands/arduino-cli_compile.md#options) of
`arduino-cli compile` wins against a library in other locations
1. A library has been specified using the [`--library` option](commands/arduino-cli_compile.md#options) of
`arduino-cli compile`.
1. A library is found in the `libraries` subfolder of the sketch.
1. A library that is architecture compatible wins against a library that is not architecture compatible (see
[**Architecture Matching**](#architecture-matching))
1. A library with both [library name](#library-name-priority) and [folder name](#folder-name-priority) matching the
include wins
1. A library that has better "library name priority" or "folder name priority" wins (see
[**Library Name Priority**](#library-name-priority) and [**Folder Name Priority**](#folder-name-priority))
1. A library that is architecture optimized wins against a library that is not architecture optimized (see
[**Architecture Matching**](#architecture-matching))
1. A library that has a better "location priority" wins (see [**Location Priority**](#location-priority))
1. A library that has a folder name with a better score using the "closest-match" algorithm wins
1. A library that has a folder name that comes first in alphanumeric order wins
include.
1. A library has better "library name priority" or "folder name priority" (see
[**Library Name Priority**](#library-name-priority) and [**Folder Name Priority**](#folder-name-priority)).
1. A library is architecture optimized (see [**Architecture Matching**](#architecture-matching)).
1. A library has a better "location priority" (see [**Location Priority**](#location-priority)).
1. A library has a folder name with a better score using the "closest-match" algorithm.
1. A library has a folder name that comes first in alphanumeric order.

### Architecture Matching

Expand Down Expand Up @@ -126,14 +126,15 @@ The "location priority" is determined as follows (in order of highest to lowest

1. The library is under a custom libraries path specified via the
[`--libraries` option](commands/arduino-cli_compile.md#options) of `arduino-cli compile` (in decreasing order of
priority when multiple custom paths are defined)
1. The library is under the `libraries` subfolder of the IDE's sketchbook or Arduino CLI's user directory
priority when multiple custom paths are defined).
1. The library is under the `libraries` subfolder of the sketch.
1. The library is under the `libraries` subfolder of the IDE's sketchbook or Arduino CLI's user directory.
1. The library is bundled with the board platform/core
([`{runtime.platform.path}/libraries`](platform-specification.md#global-predefined-properties))
([`{runtime.platform.path}/libraries`](platform-specification.md#global-predefined-properties)).
1. The library is bundled with the [referenced](platform-specification.md#referencing-another-core-variant-or-tool)
board platform/core
board platform/core.
1. The library is bundled with the Arduino IDE (this location is determined by the Arduino CLI configuration setting
`directories.builtin.libraries`)
`directories.builtin.libraries`).

#### Location priorities in Arduino Web Editor

Expand Down
38 changes: 24 additions & 14 deletions docs/sketch-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ Files added to the sketch via the Arduino IDE's **Sketch > Add File...** are pla
The Arduino IDE's **File > Save As...** only copies the code files in the sketch root folder and the full contents of
the `data` folder, so any non-code files outside the `data` folder are stripped.

### `libraries` subfolder

The `libraries` folder is used to store libraries compiled with the sketch. This folder should be used to store
libraries that have been patched or to store libraries that are not available through the official library repository.

- This feature is available since Arduino CLI 1.1.1
- This feature is not yet available in Arduino IDE and Arduino Web Editor.

### Metadata

#### `sketch.json`
Expand Down Expand Up @@ -118,25 +126,27 @@ Web Editor.
### Sketch file structure example

```
Foo
MotorController
|_ arduino_secrets.h
|_ Abc.ino
|_ Def.cpp
|_ Def.h
|_ Foo.ino
|_ Ghi.c
|_ Ghi.h
|_ Jkl.h
|_ Jkl.S
|_ motors.ino
|_ defs.cpp
|_ defs.h
|_ MotorController.ino
|_ someASM.h
|_ someASM.S
|_ sketch.yaml
|_ data
| |_ Schematic.pdf
|_ libraries
| |_ SomeLib
| |_ library.properties
| |_ src
| |_ SomeLib.h
| |_ SomeLib.cpp
|_ src
|_ SomeLib
|_ library.properties
|_ src
|_ SomeLib.h
|_ SomeLib.cpp
|_ encoders
|_ encoders.h
|_ encoders.cpp
```

## Sketchbook
Expand Down

0 comments on commit 0e4559b

Please sign in to comment.