Skip to content

fix(toolchain): support ${{ VAR }} syntax in toolchain commands#22

Merged
joabech merged 1 commit intoanalogdevicesinc:mainfrom
joabech:workspace-toolchain-fix
Apr 13, 2026
Merged

fix(toolchain): support ${{ VAR }} syntax in toolchain commands#22
joabech merged 1 commit intoanalogdevicesinc:mainfrom
joabech:workspace-toolchain-fix

Conversation

@joabech
Copy link
Copy Markdown
Contributor

@joabech joabech commented Apr 13, 2026

Add support for the cim template syntax ${{ VAR }} in the toolchain variable expansion as well.

This change makes it possible to use something like:
CARGO_HOME=${{ WORKSPACE }}/toolchains/rust/cargo
instead of:
CARGO_HOME=$PWD/cargo

Which likely feels more intuitive for many users.

Two problems are fixed together:

  1. expand_toolchain_env_vars did not recognise ${{ VAR }} at all. A new parsing pass is inserted before the existing ${VAR}/$VAR handling. Known cim variables (PWD, WORKSPACE, HOME) are resolved to their absolute paths; all other names are looked up as standard environment variables and, if not found, the original token is preserved unchanged.

  2. execute_post_install_commands passed command strings verbatim to the shell without any cim-variable expansion. Only the separate 'environment' section was expanded. Now each command is run through expand_toolchain_env_vars before being handed to the shell, so ${{ WORKSPACE }}, $WORKSPACE, ${{ PWD }}, $PWD, and any other supported variable forms work consistently inside commands.

Add support for the cim template syntax ${{ VAR }} in the toolchain
variable expansion as well.

This change makes it possible to use something like:
  CARGO_HOME=${{ WORKSPACE }}/toolchains/rust/cargo
instead of:
  CARGO_HOME=$PWD/cargo

Which likely feels more intuitive for many users.

Two problems are fixed together:

1. expand_toolchain_env_vars did not recognise ${{ VAR }} at all.
   A new parsing pass is inserted before the existing ${VAR}/$VAR
   handling.  Known cim variables (PWD, WORKSPACE, HOME) are resolved
   to their absolute paths; all other names are looked up as standard
   environment variables and, if not found, the original token is
   preserved unchanged.

2. execute_post_install_commands passed command strings verbatim to
   the shell without any cim-variable expansion.  Only the separate
   'environment' section was expanded.  Now each command is run through
   expand_toolchain_env_vars before being handed to the shell, so
   ${{ WORKSPACE }}, $WORKSPACE, ${{ PWD }}, $PWD, and any other
   supported variable forms work consistently inside commands.

Signed-off-by: Joakim Bech <Joakim.Bech@analog.com>
@joabech joabech merged commit b0bbccc into analogdevicesinc:main Apr 13, 2026
8 checks passed
@joabech joabech deleted the workspace-toolchain-fix branch April 13, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant