From d493ae2c196983d2e879c7aeec58f1ec2c6dda34 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Mon, 16 Mar 2026 15:21:14 +0000 Subject: [PATCH] Add parallel dependency compilation env variable Projects using this Feature will benefit from the recommended setting of this new environment variable to half the available CPUs (see link below). See-also: https://elixir-lang.org/blog/2025/10/16/elixir-v1-19-0-released/#parallel-compilation-of-dependencies --- src/elixir-project/devcontainer-feature.json | 2 +- src/elixir-project/scripts/onCreateCommand.sh | 4 +++- test/elixir-project/test.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/elixir-project/devcontainer-feature.json b/src/elixir-project/devcontainer-feature.json index ecff31e..82ed8d1 100644 --- a/src/elixir-project/devcontainer-feature.json +++ b/src/elixir-project/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "elixir-project", - "version": "1.0.0", + "version": "1.1.0", "name": "elixir-project", "description": "An opinionated, batteries-included Dev Container Feature for Elixir projects.", "documentationURL": "https://github.com/CargoSense/devcontainer-features/tree/main/src/elixir-project", diff --git a/src/elixir-project/scripts/onCreateCommand.sh b/src/elixir-project/scripts/onCreateCommand.sh index 14e3965..5230bbb 100755 --- a/src/elixir-project/scripts/onCreateCommand.sh +++ b/src/elixir-project/scripts/onCreateCommand.sh @@ -11,10 +11,12 @@ BASHRC_DIR="${HOME}/.bashrc.d" mkdir -p "${BASHRC_DIR}" chmod 700 "${BASHRC_DIR}" -# Configure environment variables that rely on `CONTAINER_WORKSPACE_FOLDER` +# Configure environment variables that rely on `CONTAINER_WORKSPACE_FOLDER` and +# set dependency compilation parallelism (new in Elixir v1.19) cat << EOF > "${BASHRC_DIR}/elixir-project.bashrc" export HISTFILE="${CONTAINER_WORKSPACE_FOLDER}/.bash_history" export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\\"${CONTAINER_WORKSPACE_FOLDER}/.iex_history\\"'" +export MIX_OS_DEPS_COMPILE_PARTITION_COUNT="\$(( "\$(nproc --all)" / 2 ))" EOF chmod +x "${BASHRC_DIR}/elixir-project.bashrc" diff --git a/test/elixir-project/test.sh b/test/elixir-project/test.sh index a458bad..60d1e5d 100755 --- a/test/elixir-project/test.sh +++ b/test/elixir-project/test.sh @@ -7,7 +7,7 @@ set -e source dev-container-features-test-lib # Feature-specific tests -check "environment" bash -c "env | grep ERL_AFLAGS" +check "environment" bash -c "env | grep ERL_AFLAGS && env | grep MIX_OS_DEPS_COMPILE_PARTITION_COUNT" check "gitignore" grep -xF .bash_history .gitignore # Report result