Description
Feature Request
via https://github.com/ianfixes/arduino_ci/issues/150#issuecomment-689887131
I find that I'd like a way to distinguish between when code is compiled from the Arduino IDE and when code is compiled from arduino_ci. Ideal would be something like
#define ARDUINO_CI
but the closest I've come isMOCK_PINS_COUNT
Initial thoughts
There is some ability to do this already, as a per-project workaround, by copying platform definitions from default.yml
and adding to the defines
section of a platform:
# copied from default.yml in september 2020
platforms:
uno:
board: arduino:avr:uno
package: arduino:avr
gcc:
features:
defines:
- __AVR_ATmega328P__
# This is the workaround described above
- ARDUINO_CI
warnings:
flags:
Since the platform definitions' gcc
section applies only to unit testing (i.e. it's not AVR compilation), this is safe. But possibly not ideal.
Discussion points
What are best practices for injecting "evidence" of test platforms into compilation? For example, should we copy the pattern used by the ARDUINO
constant, and if so, what would the numbers represent?