Skip to content

Feature request: compile --show-properties without a sketch #1047

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
obra opened this issue Oct 24, 2020 · 5 comments · Fixed by #2151
Closed

Feature request: compile --show-properties without a sketch #1047

obra opened this issue Oct 24, 2020 · 5 comments · Fixed by #2151
Assignees
Labels
topic: CLI Related to the command line interface type: enhancement Proposed improvement

Comments

@obra
Copy link
Contributor

obra commented Oct 24, 2020

arduino-cli compile --show-properties currently won't run without an .ino file present. However, that appears to be a side effect of the fact that it's an option to compile

Using arduino-cli in my tooling, I often want to query board properties before locating a specific sketch. (This may be crazy.)

I -sort of- feel like --show-properties should be a sub-command of arduino-cli board, rather than compile. (And, if we're going there, I'd love it if there were a command like:

./bin/arduino-cli board get-property foo.bar --fqbn arduino:avr:leonardo

which would return the fully evaluated template for foo.bar.

@ubidefeo
Copy link

ubidefeo commented Oct 24, 2020

@obra
this looks interesting.
What do you think about it, @per1234 ? I saw you added the labels, which makes me think you agree :)

@per1234
Copy link
Contributor

per1234 commented Oct 24, 2020

I actually think it would be cool if it were a global flag, since the properties are context-dependent. If you are compiling a sketch, build.project_name and build.source.path will be defined. If you are uploading, serial.port and serial.port.file, if doing upload -P or burn-bootloader then the properties of the programmer are defined.

@obra
Copy link
Contributor Author

obra commented Nov 15, 2020

Just to further explain how I'm using this in my build tooling, these are the current shell functions I use to get an individual property.

_arduino_prop() {
        pref=$1
        # Strip the preference name. And then strip leading and trailing quotations
        _arduino_props | grep --max-count=1 "${pref}=" | sed -e s/^.*"${pref}"=// -e 's/^"//' -e 's/"$//'
}

_arduino_props() {
        if [ "x${_ARDUINO_PREFS}x" == "xx" ]; then
                _ARDUINO_PREFS=$(_run_arduino_cli --fqbn "${FQBN}" compile --show-properties "${SKETCH_FILE_PATH}")
        fi
        echo "$_ARDUINO_PREFS"
}


Here are some of my current uses:

 

We have a target that builds a .hex including the sketch and the bootloader

"${BOOTLOADER_PATH:=$(_arduino_prop 'runtime.platform.path')/bootloaders/$(_arduino_prop 'bootloader.file')}"```

# A custom board property used in the flashing process

flashing_instructions=$(_arduino_prop 'build.flashing_instructions')```

@per1234 per1234 reopened this Mar 30, 2021
@rsora rsora removed the topic: CLI label Sep 16, 2021
@rsora rsora added topic: core topic: CLI Related to the command line interface labels Sep 22, 2021
@umbynos umbynos added this to the Arduino CLI 1.0 milestone Nov 25, 2022
@umbynos
Copy link
Contributor

umbynos commented Feb 2, 2023

Related to #1046

@cmaglie
Copy link
Member

cmaglie commented Apr 18, 2023

The ongoing development here: #2151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface type: enhancement Proposed improvement
Projects
None yet
8 participants