Skip to content

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Jun 10, 2025

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

This change allows us to specify libraries in the sketch profile using a path to a local directory by prefixing the path with the string dir: .
It also provides this information in compile --dump-profile

What is the current behavior?

Only libraries in the Arduino Libraries Index could be specified in a sketch profile. A typical example may be the following:

profiles:
  uno:
    fqbn: arduino:avr:uno
    platforms:
      - platform: arduino:avr (1.8.6)
    libraries:
      - Adafruit SSD1306 (2.5.13)
      - Adafruit GFX Library (1.11.11)
      - Adafruit BusIO (1.17.0)

What is the new behavior?

A library installed in the filesystem could be specified as well:

profiles:
  uno:
    fqbn: arduino:avr:uno
    platforms:
      - platform: arduino:avr (1.8.6)
    libraries:
      - dir: libraries/MyLib
      - dir: /path/to/library/MyLibOutsideTheSketch 
      - Adafruit SSD1306 (2.5.13)
      - Adafruit GFX Library (1.11.11)
      - Adafruit BusIO (1.17.0)

In this case the two libraries:

  • libraries/MyLib
  • /path/to/library/MyLibOutsideTheSketch
    will be included during the compilation. In particular, a relative path refers to a path relative to the sketch path, in this case libraries/MyLib is to be intended as SKETCHPATH/libaries/MyLib.

Does this PR introduce a breaking change, and is titled accordingly?

No

Other information

@cmaglie cmaglie self-assigned this Jun 10, 2025
@cmaglie cmaglie added type: enhancement Proposed improvement topic: build-process Related to the sketch build process labels Jun 10, 2025
@cmaglie cmaglie force-pushed the allow_paths_in_profile_libs branch from 634d074 to cdd7f4e Compare June 10, 2025 14:50
@cmaglie cmaglie requested a review from a team June 10, 2025 15:11
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 65.95745% with 16 lines in your changes missing coverage. Please review.

Project coverage is 67.96%. Comparing base (524ddb3) to head (1a933cb).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
internal/arduino/sketch/profiles.go 45.00% 6 Missing and 5 partials ⚠️
commands/instances.go 68.75% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2930      +/-   ##
==========================================
+ Coverage   67.91%   67.96%   +0.05%     
==========================================
  Files         238      238              
  Lines       22489    22524      +35     
==========================================
+ Hits        15273    15309      +36     
+ Misses       6017     6013       -4     
- Partials     1199     1202       +3     
Flag Coverage Δ
unit 67.96% <65.95%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@alessio-perugini alessio-perugini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks good, I'd just add a test to assert the compilation given a sketch.yaml with also relative lib.

@cmaglie cmaglie linked an issue Jun 11, 2025 that may be closed by this pull request
6 tasks
@cmaglie cmaglie force-pushed the allow_paths_in_profile_libs branch from 1d46837 to 0bd806e Compare June 11, 2025 13:55
@egnor
Copy link

egnor commented Jun 13, 2025

This is amazing! I will finally be able to get rid of my various hacky uses of src/ directory symlinks!

@alessio-perugini
Copy link
Contributor

alessio-perugini commented Jun 13, 2025

@egnor 😄 If you want to give it a try, before we merge this, you can find the test binaries here: https://github.com/arduino/arduino-cli/actions/runs/15586877233
Or you can git-checkout this PR, and run go build .

Feedbacks are always welcomed 🤓

@cmaglie cmaglie force-pushed the allow_paths_in_profile_libs branch from 0bd806e to 1589119 Compare July 3, 2025 16:14
@cmaglie cmaglie merged commit 3dca438 into arduino:master Jul 3, 2025
102 checks passed
@cmaglie cmaglie deleted the allow_paths_in_profile_libs branch July 3, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: build-process Related to the sketch build process type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants