-
-
Notifications
You must be signed in to change notification settings - Fork 398
[breaking] Remove auto detection of Arduino IDE built-in libraries and tools / Allow gRPC install of built-in libraries #1817
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
Conversation
More work is going into this PR: the handling of the historic Arduino IDE bundled libraries will be implemented in the CLI. |
15f8111
to
1b3264a
Compare
Codecov Report
@@ Coverage Diff @@
## master #1817 +/- ##
==========================================
+ Coverage 36.39% 36.58% +0.19%
==========================================
Files 231 231
Lines 19573 19561 -12
==========================================
+ Hits 7124 7157 +33
+ Misses 11620 11578 -42
+ Partials 829 826 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
3e68ac2
to
6b797cf
Compare
6b797cf
to
520de09
Compare
The gRPC
This change allows the gRPC client (IDE) to install libraries in the "builtin libraries" directory. The library installation into the builtin directory is available only via gRPC. If the "builtin libraries" directory is not set, installing to the builtin library directory will fail. |
As reported in IDE2 code here, it does not work.
Why should the IDE2 set any path? We discussed that the default |
Uhm... shall we make it default to The rationale for this PR is that I see the "bundled" libraries as a legacy that we inherited from Arduino IDE 1.8.x, and I would like to separate them from the pure-CLI users. The bundled libraries can't be managed from the command line (there is no @ubidefeo @per1234 any comments on this?
The IDE should be already setting the sketchbook path AFAIK, the bundled libs would be another path to set. But I'm open to defaulting it to |
No, IDE2 is not setting anything. There is the default CLI config that is generated by the CLI when IDE2 starts, and it's missing. The sketchbook path is inferred from the CLI config: |
Another solution may be to set the default path only when the CLI is running as a daemon, this way:
|
ba9117a
to
79702f8
Compare
I've implemented the default for the bundled library directory when running as a daemon, as I said in my last comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the problem
cc.arduino.cli.commands.v1.ArduinoCoreService.LibraryUninstall
uninstalls the library that was installed to directories.builtin.libraries
by that instance.
To reproduce
Set up
$ arduino-cli version
arduino-cli.exe Version: git-snapshot Commit: fb57a522 Date: 2022-08-31T14:09:52Z
$ arduino-cli lib install Servo
Downloading [email protected]...
[email protected] already downloaded
Installing [email protected]...
Installed [email protected]
$ arduino-cli daemon --debug
Daemon is now listening on 127.0.0.1:50051
Demo
Use grpcurl to run the following commands in another terminal:
$ grpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.Create
{
"instance": {
"id": 1
}
}
$ grpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
-d '{"instance": {"id": 1}}' \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.Init
$ grpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
-d '{"instance": {"id": 1}, "name": "Servo", "install_location": 1}' \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.LibraryInstall
{
"taskProgress": {
"name": "Downloading [email protected]"
}
}
{
"progress": {
"file": "[email protected]",
"completed": true
}
}
{
"taskProgress": {
"completed": true
}
}
{
"taskProgress": {
"name": "Installing [email protected]"
}
}
{
"taskProgress": {
"message": "Installed [email protected]",
"completed": true
}
}
{
}
$ grpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
-d '{"instance": {"id": 1}, "all": true, "name": "Servo"}' \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.LibraryList
{
"installedLibraries": [
{
"library": {
"name": "Servo",
"author": "Michael Margolis, Arduino",
"maintainer": "Arduino \[email protected]\u003e",
"sentence": "Allows Arduino boards to control a variety of servo motors.",
"paragraph": "This library can control a great number of servos.\u003cbr /\u003eIt makes careful use of timers: the library can control 12 servos using only 1 timer.\u003cbr /\u003eOn the Arduino Due you can control up to 60 servos.",
"website": "https://www.arduino.cc/reference/en/libraries/servo/",
"category": "Device Control",
"architectures": [
"avr",
"megaavr",
"sam",
"samd",
"nrf52",
"stm32f4",
"mbed",
"mbed_nano",
"mbed_portenta",
"mbed_rp2040"
],
"installDir": "C:\\Users\\per\\AppData\\Local\\Arduino15\\libraries\\Servo",
"sourceDir": "C:\\Users\\per\\AppData\\Local\\Arduino15\\libraries\\Servo\\src",
"realName": "Servo",
"version": "1.1.8",
"license": "Unspecified",
"layout": "LIBRARY_LAYOUT_RECURSIVE",
"examples": [
"C:\\Users\\per\\AppData\\Local\\Arduino15\\libraries\\Servo\\examples\\Knob",
"C:\\Users\\per\\AppData\\Local\\Arduino15\\libraries\\Servo\\examples\\Sweep"
],
"providesIncludes": [
"Servo.h"
]
}
},
{
"library": {
"name": "Servo",
"author": "Michael Margolis, Arduino",
"maintainer": "Arduino \[email protected]\u003e",
"sentence": "Allows Arduino boards to control a variety of servo motors.",
"paragraph": "This library can control a great number of servos.\u003cbr /\u003eIt makes careful use of timers: the library can control 12 servos using only 1 timer.\u003cbr /\u003eOn the Arduino Due you can control up to 60 servos.",
"website": "https://www.arduino.cc/reference/en/libraries/servo/",
"category": "Device Control",
"architectures": [
"avr",
"megaavr",
"sam",
"samd",
"nrf52",
"stm32f4",
"mbed",
"mbed_nano",
"mbed_portenta",
"mbed_rp2040"
],
"installDir": "C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo",
"sourceDir": "C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo\\src",
"realName": "Servo",
"version": "1.1.8",
"license": "Unspecified",
"location": "LIBRARY_LOCATION_USER",
"layout": "LIBRARY_LAYOUT_RECURSIVE",
"examples": [
"C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo\\examples\\Knob",
"C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo\\examples\\Sweep"
],
"providesIncludes": [
"Servo.h"
]
}
}
]
}
$ grpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
-d '{"instance": {"id": 1}, "name": "Servo", "version": "1.1.8"}' \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.LibraryUninstall
{
"taskProgress": {
"name": "Uninstalling [email protected]"
}
}
{
"taskProgress": {
"completed": true
}
}
{
}
$ grpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
-d '{"instance": {"id": 1}, "all": true, "name": "Servo"}' \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.LibraryList
{
"installedLibraries": [
{
"library": {
"name": "Servo",
"author": "Michael Margolis, Arduino",
"maintainer": "Arduino \[email protected]\u003e",
"sentence": "Allows Arduino boards to control a variety of servo motors.",
"paragraph": "This library can control a great number of servos.\u003cbr /\u003eIt makes careful use of timers: the library can control 12 servos using only 1 timer.\u003cbr /\u003eOn the Arduino Due you can control up to 60 servos.",
"website": "https://www.arduino.cc/reference/en/libraries/servo/",
"category": "Device Control",
"architectures": [
"avr",
"megaavr",
"sam",
"samd",
"nrf52",
"stm32f4",
"mbed",
"mbed_nano",
"mbed_portenta",
"mbed_rp2040"
],
"installDir": "C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo",
"sourceDir": "C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo\\src",
"realName": "Servo",
"version": "1.1.8",
"license": "Unspecified",
"location": "LIBRARY_LOCATION_USER",
"layout": "LIBRARY_LAYOUT_RECURSIVE",
"examples": [
"C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo\\examples\\Knob",
"C:\\Users\\per\\Documents\\Arduino\\libraries\\Servo\\examples\\Sweep"
],
"providesIncludes": [
"Servo.h"
]
}
}
]
}
🐛 The library in LIBRARY_LOCATION_BUILTIN
was uninstalled instead of the library in LIBRARY_LOCATION_USER
Expected behavior
cc.arduino.cli.commands.v1.ArduinoCoreService.LibraryUninstall
only uninstalls libraries from directories.user
Arduino CLI version
Operating system
Windows 10
Additional context
The bug does not occur if "version": "1.1.8"
is removed from the cc.arduino.cli.commands.v1.ArduinoCoreService.LibraryUninstall
request.
Co-authored-by: per1234 <[email protected]>
499b963
to
ad98097
Compare
@per1234 I don't know how you manage to find these edge cases but it's amazing! In this case, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified that the bug reported in my previous review was fixed by ad98097
Excellent work on this Cristian!
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)Remove the check for the CLI being bundled in the Arduino IDE
Arduino CLI checks if it's bundled with the Arduino IDE. This check allows the CLI
to automatically use the libraries and tools bundled in the Arduino IDE
Now, this is not supported anymore unless the configuration keys
directories.builtin.libraries/tools
are set.titled accordingly?
Yes
Fix Sourcing built-in libraries when not bundled w/ classic IDE is undocumented or unintended #1565