Skip to content

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Oct 21, 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 PR adds support for git-based libraries in profiles.

What is the current behavior?

Sketch profiles do not support libraries downloaded from git.
Only libraries available on the Libraries Index or in the local storage could be included in a build made with profiles.

What is the new behavior?

Now the profiles support a third kind of library, and a git reference could be indicated in the profiles, like in the following example:

profiles:
  zero:
    fqbn: arduino:samd:arduino_zero_native
    platforms:
      - platform: arduino:samd (1.8.14)
    libraries:
      - git: https://github.com/cmaglie/FlashStorage.git#1.0.0

default_profile: zero

The specific git-revision of the library specified in the profile will be downloaded from git and cached in the data directory's internal folder. The downloaded copy is cached only the first time and will not be downloaded again.

If the git-reference is updated on the repository, the cached copy will become outdated, and the only way to refresh it is to delete the internal cache directory to force the Arduino CLI to download it again.

For example, a user trying to always utilize the latest main branch of a library might be tempted to write something like:

    libraries:
      - git: https://github.com/cmaglie/FlashStorage.git#main

BTW, this won't work well because, after the first compile (and download from git), the Arduino CLI will never try again to refresh the library.

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

No

Other information

Fix #2133

@cmaglie cmaglie force-pushed the profile-git-libraries branch from 157e08d to a77f39c Compare October 21, 2025 16:45
@cmaglie cmaglie self-assigned this Oct 21, 2025
@cmaglie cmaglie added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Oct 21, 2025
@per1234 per1234 added the topic: package-management Related to the packaging and managing of the platform/libraries label Oct 21, 2025
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 43.67816% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.33%. Comparing base (a8423ab) to head (8949023).

Files with missing lines Patch % Lines
commands/instances.go 0.00% 25 Missing and 1 partial ⚠️
internal/arduino/sketch/profiles.go 58.33% 8 Missing and 7 partials ⚠️
...rnal/arduino/libraries/librariesmanager/install.go 65.21% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3028      +/-   ##
==========================================
- Coverage   68.39%   68.33%   -0.07%     
==========================================
  Files         241      241              
  Lines       22734    22791      +57     
==========================================
+ Hits        15550    15574      +24     
- Misses       5988     6017      +29     
- Partials     1196     1200       +4     
Flag Coverage Δ
unit 68.33% <43.67%> (-0.07%) ⬇️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: code Related to content of the project itself topic: package-management Related to the packaging and managing of the platform/libraries type: enhancement Proposed improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for custom libraries when using sketch.yaml

2 participants