Skip to content
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

Use arduino-cli backend #218

Merged
merged 9 commits into from
Nov 27, 2020
Merged

Conversation

ianfixes
Copy link
Collaborator

@ianfixes ianfixes commented Nov 16, 2020

Highlights from CHANGELOG.md

🎉 Arduino backend is now arduino-cli version 0.13.0 🎉

Added

  • Special handling of attempts to run the arduino_ci.rb CI script against the ruby library instead of an actual Arduino project
  • Explicit checks for attemping to test arduino_ci itself as if it were a librart, resolving a minor annoyance to this developer.
  • Code coverage tooling
  • Explicit check and warning for library directory names that do not match our guess of what the library should/would be called

Changed

  • Arduino backend is now arduino-cli version 0.13.0
  • ArduinoCmd is now ArduinoBackend
  • CppLibrary now relies largely on ArduinoBackend instead of making its own judgements about libraries (metadata, includes, and examples)
  • ArduinoBackend functionality related to CppLibrary now lives in CppLibrary
  • CppLibrary now works in an installation-first manner for exposure to arduino-cli's logic -- without installation, there is no ability to reason about libraries
  • CppLibrary forces just-in-time recursive dependency installation in order to work sensibly
  • ArduinoBackend maintains the central "best guess" logic on what a library (on disk) might be named

Deprecated

  • arduino_ci_remote.rb CLI switch --skip-compilation
  • Deprecated arduino_ci_remote.rb in favor of arduino_ci.rb

Removed

  • ARDUINO_CI_SKIP_SPLASH_SCREEN_RSPEC_TESTS no longer affects any tests because there are no longer splash screens since switching to arduino-cli

Fixed

  • Mismatches between library names in library.properties and the directory names, which can cause cryptic failures
  • LibraryProperties skips over parse errors instead of crashing: only lines with non-empty keys and non-nil values are recorded

Issues Fixed

@ianfixes
Copy link
Collaborator Author

@per1234 one thing I'm struggling with here is how much to rely on the output of arduino-cli lib list. For example, I'm noticing here is that it doesn't follow any symlinks.

I could imagine relying on a lot of its output (which us unbelievably helpful by being json-formatted, btw), but for some of the unit tests I'd prefer to symlink dummy libraries into the Arduino libraries dir rather than fake or mock the output of arduino-cli.

@per1234
Copy link
Contributor

per1234 commented Nov 16, 2020

I'm noticing here is that it doesn't follow any symlinks.

Is this the same behavior you're experiencing?

$ ./arduino-cli version
arduino-cli Version: 0.13.0 Commit: 693a045
$ export ARDUINO_DIRECTORIES_USER=/tmp/arduino/staging
$ ./arduino-cli lib install Servo
Servo depends on [email protected]
Downloading [email protected]...
[email protected] already downloaded
Installing [email protected]...
Installed [email protected]
$ export ARDUINO_DIRECTORIES_USER=/tmp/arduino/directories/user
$ mkdir --parents "${ARDUINO_DIRECTORIES_USER}/libraries"
$ ln -s /tmp/arduino/staging/libraries/Servo "${ARDUINO_DIRECTORIES_USER}/libraries/Servo"
$ ./arduino-cli lib list --format json
[
  {
    "library": {
      "name": "Servo",
      "author": "Michael Margolis, Arduino",
      "maintainer": "Arduino \[email protected]\u003e",
      "sentence": "Allows Arduino/Genuino 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.\u003cbr /\u003e",
      "website": "http://www.arduino.cc/en/Reference/Servo",
      "category": "Device Control",
      "architectures": [
        "avr",
        "megaavr",
        "sam",
        "samd",
        "nrf52",
        "stm32f4",
        "mbed"
      ],
      "install_dir": "/tmp/arduino/directories/user/libraries/Servo",
      "source_dir": "/tmp/arduino/directories/user/libraries/Servo/src",
      "real_name": "Servo",
      "version": "1.1.7",
      "license": "Unspecified",
      "location": 1,
      "layout": 1,
      "examples": [
        "/tmp/arduino/directories/user/libraries/Servo/examples/Knob",
        "/tmp/arduino/directories/user/libraries/Servo/examples/Sweep"
      ],
      "provides_includes": [
        "Servo.h"
      ]
    },
    "release": {}
  }
]

@ianfixes
Copy link
Collaborator Author

Aah, this was my own mistake.

Comparing ls -l $(./arduino-cli config dump --format json | jq -r ".directories.user")/libraries to ./arduino-cli lib list, everything is as it should be. I lost track of which of my dummy libraries I had actually installed.

@ianfixes
Copy link
Collaborator Author

I take that back, it's failing in a very narrow case

$ ls -lo $(./arduino-cli config dump --format json | jq -r ".directories.user")/libraries | grep TestSomething
lrwxr-xr-x   1 ianfixes   78 Jan  5  2019 TestSomething -> /Users/ianfixes/Development/arduino_ci/SampleProjects/TestSomething
$ ./arduino-cli lib list | grep TestSomething
TestSomething                    0.1.0    -        user     Arduino CI unit test example                                          
$ cat /Users/ianfixes/Development/arduino_ci/SampleProjects/TestSomething/library.properties 
name=TestSomething
version=0.1.0
author= <my info>
maintainer= <my info>
sentence=Arduino CI unit test example
paragraph=A skeleton library demonstrating CI and unit tests
category=Other
url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/TestSomething
architectures=avr,esp8266
includes=do-something.h
$ ./arduino-cli lib deps TestSomething
Error resolving dependencies for TestSomething: looking for library: library TestSomething not found

In other words,

  1. the library exists as a symlink in the directory that arduino-cli agrees is the proper library directory
  2. arduino-cli detects the library
  3. the library contains a library.properties
  4. arduino-cli can't determine the deps of the library it already "knows" exists

Am I missing something obvious or quirky here?

@ianfixes ianfixes force-pushed the 2020-11-16_arduino-cli branch 4 times, most recently from 4e91fa9 to 71b7dce Compare November 27, 2020 04:35
@ianfixes ianfixes force-pushed the 2020-11-16_arduino-cli branch 13 times, most recently from 41d81ff to 2a5162a Compare November 27, 2020 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants