Skip to content

Provide instruction to test libraries / sketches with dependencies #91

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

Closed
s-celles opened this issue Jan 15, 2019 · 12 comments
Closed

Provide instruction to test libraries / sketches with dependencies #91

s-celles opened this issue Jan 15, 2019 · 12 comments
Labels
docs Documentation enhancement New feature or request question Further information is requested

Comments

@s-celles
Copy link
Contributor

s-celles commented Jan 15, 2019

Hello,

I think it should be useful to provide information in doc to test libraries / sketches with dependencies.

I see 2 kind of dependencies:

My opinion is that arduino-cli should manage this... (instead of everyone doing its own script)
I opened several issues related to this problem.

arduino-cli

A more general issue (that I didn't opened)
Library manager: Library dependencies arduino/Arduino#5795

The concept of environments could help to have several versions of a same library installed without hassle arduino/arduino-cli#108 ... but that's an other story.

What's you opinion about this @ianfixes?
What actions can be done?

Kind regards

@ianfixes
Copy link
Collaborator

ianfixes commented Jan 15, 2019

Here's how you'd enable unit tests with a dependent library (via https://github.com/ianfixes/arduino_ci/blob/master/REFERENCE.md):

unittest:
  libraries:
    - "abc123"
    - "def456"
  platforms:
    - mega2560

That will cause the library manager to download abc123 and def456 if they aren't already.

For unregistered libraries, I have to leave it to the developer to put the appropriate download commands into their build scripts such that the dependent libs end up in the Arduino library directories. Whether that means curl or wget a URL and unzipping it, or git cloneing something, that's currently the user's responsibility, and it's documented at https://github.com/ianfixes/arduino_ci/blob/master/REFERENCE.md#custom-versions-of-external-arduino-libraries

My personal opinion is that Arduino needs a package manager on par with NPM (NodeJS), bundler (Ruby), or Cargo (Rust) that can handle all those download sources, semver, recursive dependencies, etc. I won't have time to build such a thing and do it correctly.

@ianfixes
Copy link
Collaborator

Is there a specific thing you'd like to see worded differently in the documentation about dependent libraries?

It also occurs to me that I'm very unlikely to be compiling dependent libraries properly. Getting the list of files in the right order is something I'm not sure how to tackle.

@ianfixes ianfixes added docs Documentation enhancement New feature or request question Further information is requested labels Jan 15, 2019
@s-celles
Copy link
Contributor Author

Maybe you might show at least a .travis.yml example showing how to download a zip file using wget or curl, unzip this file, create Arduino directory and move lib in this directory.

@s-celles
Copy link
Contributor Author

@s-celles
Copy link
Contributor Author

Looks good now with the following .travis.yml

sudo: false
language: ruby
before_install:
   - wget https://github.com/itead/ITEADLIB_Arduino_Nextion/archive/master.zip
   - unzip -o master.zip
   - mkdir -p ~/Arduino/libraries/
   - mv ITEADLIB_Arduino_Nextion-master ~/Arduino/libraries/
script:
   - bundle install
   - bundle exec arduino_ci_remote.rb

https://travis-ci.com/scls19fr/mwe_arduino_ci/builds/97514947
but on Linux, Arduino libraries are in ~/Arduino/libraries, on OS X it's ~/Documents/Arduino/libraries

If it was managed by an other script, user will not have to take care about that.

@ianfixes
Copy link
Collaborator

What I have in #92 should allow you to do this:

sudo: false
language: ruby
script:
   - bundle install
   - bundle exec ensure_arduino_installation.rb
   - echo "Arduino library directory:"
   - bundle exec arduino_library_location.rb
   - wget https://github.com/itead/ITEADLIB_Arduino_Nextion/archive/master.zip
   - unzip -o master.zip
   - mv ITEADLIB_Arduino_Nextion-master $(bundle exec arduino_library_location.rb)
   - bundle exec arduino_ci_remote.rb

These lines aren't strictly necessary:

   - bundle exec ensure_arduino_installation.rb
   - echo "Arduino library directory:"
   - bundle exec arduino_library_location.rb

They will just make the output a bit easier to understand.

Can you give that branch a try? The only thing I haven't tested is whether the subshell syntax (wrapping a command in $( command )) works in Travis.

@ianfixes
Copy link
Collaborator

Made a mistake while pushing things up, the ref you want is 6dcc33e

@s-celles
Copy link
Contributor Author

bundle exec arduino_library_location.rb

maybe result should be stored in an environment variable to be reused in

mv ITEADLIB_Arduino_Nextion-master $(bundle exec arduino_library_location.rb)

@s-celles
Copy link
Contributor Author

@ianfixes
Copy link
Collaborator

OK, looks like I had some minor formatting bugs in there (these dots, not being on the same line) which I just fixed. I'll merge that when the latest tests complete.

@s-celles
Copy link
Contributor Author

@s-celles
Copy link
Contributor Author

Thanks @ianfixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants