Thanks for taking a look Ivan.
Replacing the env.Depends command so that the binary file creation depends on release_decriptor also doesn’t help. The directory isn’t created, and “Hi” isn’t printed:
Scanning dependencies...
No dependencies
Building in release mode
Building .pio/build/esp32dev/bootloader.bin
Generating partitions .pio/build/esp32dev/partitions.bin
esptool.py v4.2.1
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 5.0% (used 16440 bytes from 327680 bytes)
Flash: [== ] 18.6% (used 244065 bytes from 1310720 bytes)
Building .pio/build/esp32dev/firmware.bin
esptool.py v4.2.1
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
create_release(["create_release"], [".pio/build/esp32dev/firmware.bin"])
target=create_release, source=.pio/build/esp32dev/firmware.bin
release_file[0] is releases/esp32dev_firmware.bin
It appears from the the terminal output that the binary is created before the extra_script is parsed, so I guess env.Depends is being parsed too late?
Because there are a series of tasks that form a dependency chain that I’m trying to manage, some of which are slow and each of which should only be re-run if/ when something higher up the chain has run successfully. According to the SCons docs I believe that it will also handle the “fingerprints” of my custom items in the dependency chain and only rebuild the downstream tasks if necessary. For example:
- AFTER the binary is rebuilt, patch it with the project name, version, build-time etc (see here - it’s not done by an arduino build so must be post-processed so the ESP functions work)
- AFTER the binary has been patched, the tests can be run
- Also AFTER the binary has been patched, create a release descriptor and copy the file to the release directory
- AFTER BOTH the tests have passed AND the release descriptor has been created, upload the binary and the release descriptor to the staging server so it can be distributed to test devices via OTA
It’s a fairly basic build process that is straightforward in Ant, Make or Maven and I the sort of thing you use SCons for internally within PlatformIO from what I can see? And you’ve envisaged end-users doing the same I think - I’ve been using the PIO docs on Advanced Scripting as my reference, combined with the SCons docs, to build the various extra_scripts.
I expect there’s something very basic that I’m doing wrong. But I can’t see what it is! You can clone the files for the minimal test example above from git@gitlab.com:8w/pio-scons.git and see what I mean