Board specific commands in platform.txt in Arduino IDE

I have a custom platform.txt that works great for my custom board. Now I have a different version of that board that requires a tiny change to one of the build steps in the platform.txt file. I've added both boards to my boards.txt file so I can select either one from the Arduino IDE menu but I haven't figured out how to select a different command in platform.txt based on which board is currently selected.

I'm wondering if I can somehow have something like this:

if (build.board == BOARD1)
pattern = blahblah
else
pattern = blehbleh

There is no support for any conditional syntax in the platform properties format. If you were to need something like this, you would do it in a separate script, then call that script from one of the recipes in platform.txt (note that you can have unlimited build hook recipes).

However, there is a very powerful system for setting properties based on which board is selected. It's just that it's in boards.txt, not in platform.txt.

The properties in boards.txt are set according to whether the board associated with the board ID that prefixes the property is selected. So let's say you have two boards defined in boards.txt:

myboard1.name=My Board 1

...

myboard2.name=My Board 2

You can then define the properties differently from one board definition to another in boards.txt:

myboard1.some_board_specific_property=My Board 1 specific property value here

...

myboard2.some_board_specific_property=My Board 2 specific property value here

Then in platform.txt you reference the some_board_specific_property property with this syntax:
{some_board_specific_property}
and you get the value of that property that was defined in boards.txt for the currently selected board.

More information here:
https://arduino.github.io/arduino-cli/latest/platform-specification/#boardstxt