arduino / arduino-builder

A command line tool for compiling Arduino sketches
GNU General Public License v2.0
459 stars 114 forks source link
arduino command-line go golang tooling-team

DEPRECATION WARNING: This tool is being phased out in favor of Arduino CLI, we recommend to use Arduino CLI for new projects.

The source code of the builder has been moved in the arduino-cli repository (as a legacy package) where it will be maintained and developed and eventually moved outside the legacy package once properly integrated in the Arduino CLI codebase.

The arduino-builder is now just a wrapper of arduino-cli. We will continue to provide builds of this project for some time to allow a smooth transition period to our users.

Arduino Builder Build Status

A command line tool for compiling Arduino sketches

This tool is able to parse Arduino Hardware specifications, properly run gcc and produce compiled sketches.

An Arduino sketch differs from a standard C program in that it misses a main (provided by the Arduino core), function prototypes are not mandatory, and libraries inclusion is automagic (you just have to #include them). This tool generates function prototypes and gathers library paths, providing gcc with all the needed -I params.

Usage

Final mandatory parameter is the sketch to compile (of course).

What is and how to use build.options.json file

Every time you run this tool, it will create a build.options.json file in build path. It's used to understand if build options (such as hardware folders, fqbn and so on) were changed when compiling the same sketch. If they changed, the whole build path is wiped out. If they didn't change, previous compiled files will be reused if the corresponding source files didn't change as well. You can save this file locally and use it instead of specifying -hardware, -tools, -libraries, -fqbn, -pref and -ide-version.

Using it for continuously verify your libraries or cores

See Doing continuous integration with arduino builder.

Building from source

You need a version of Go >=1.13.0.

The project now uses go.mod for dependecy management, there is no need to go get anything or to set GOPATH env vars. The build is very simple:

$ git clone https://github.com/arduino/arduino-builder.git
$ cd arduino-builder
$ go build
[.....]
$ ./arduino-builder -version
Arduino Builder 1.5.1
Copyright (C) 2015 Arduino LLC and contributors
See https://www.arduino.cc/ and https://github.com/arduino/arduino-builder/graphs/contributors
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Security

If you think you found a vulnerability or other security-related bug in this project, please read our security policy and report the bug to our Security Team 🛡️ Thank you!

e-mail contact: security@arduino.cc

License and Copyright

arduino-builder is licensed under General Public License version 2, as published by the Free Software Foundation. See LICENSE.txt.

Copyright (C) 2017 Arduino AG and contributors

See https://www.arduino.cc/ and https://github.com/arduino/arduino-builder/graphs/contributors