From 1be6e10f994d299bc102474af7e3c73665822834 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 8 Feb 2025 17:15:34 +0200 Subject: [PATCH] Introduced the PLATFORMIO_RUN_JOBS environment variable // Resolve #5077 --- HISTORY.rst | 1 + docs | 2 +- platformio/run/cli.py | 6 ++++-- tests/commands/pkg/test_install.py | 6 +++--- tests/commands/test_lib_complex.py | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c79f5a8c..6f4bd915 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -21,6 +21,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. 6.1.17 (2024-??-??) ~~~~~~~~~~~~~~~~~~~ +* Introduced the `PLATFORMIO_RUN_JOBS `__ environment variable, allowing manual override of the number of parallel build jobs (`issue #5077 `_) * Added support for ``tar.xz`` tarball dependencies (`pull #4974 `_) * Ensured that dependencies of private libraries are no longer unnecessarily re-installed, optimizing dependency management and reducing redundant operations (`issue #4987 `_) * Resolved an issue where the ``compiledb`` target failed to properly escape compiler executable paths containing spaces (`issue #4998 `_) diff --git a/docs b/docs index 9f64f54a..93c46bdf 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9f64f54adc842b1aba2b00c378460d39358f0272 +Subproject commit 93c46bdf3fed561c069fd4dcb80aef9f5a825723 diff --git a/platformio/run/cli.py b/platformio/run/cli.py index 26a4bb16..c07db5fd 100644 --- a/platformio/run/cli.py +++ b/platformio/run/cli.py @@ -33,9 +33,11 @@ from platformio.test.runners.base import CTX_META_TEST_IS_RUNNING # pylint: disable=too-many-arguments,too-many-locals,too-many-branches try: - DEFAULT_JOB_NUMS = cpu_count() + SYSTEM_CPU_COUNT = cpu_count() except NotImplementedError: - DEFAULT_JOB_NUMS = 1 + SYSTEM_CPU_COUNT = 1 + +DEFAULT_JOB_NUMS = int(os.getenv("PLATFORMIO_RUN_JOBS", SYSTEM_CPU_COUNT)) @click.command("run", short_help="Run project targets (build, upload, clean, etc.)") diff --git a/tests/commands/pkg/test_install.py b/tests/commands/pkg/test_install.py index f0033fee..a1630a3d 100644 --- a/tests/commands/pkg/test_install.py +++ b/tests/commands/pkg/test_install.py @@ -31,7 +31,7 @@ PROJECT_CONFIG_TPL = """ [env] platform = platformio/atmelavr@^3.4.0 lib_deps = - milesburton/DallasTemperature@^3.9.1 + milesburton/DallasTemperature@^4.0.4 https://github.com/esphome/ESPAsyncWebServer/archive/refs/tags/v2.1.0.zip [env:baremetal] @@ -215,7 +215,7 @@ def test_project( PackageSpec("toolchain-atmelavr@1.70300.191015"), ] assert config.get("env:devkit", "lib_deps") == [ - "milesburton/DallasTemperature@^3.9.1", + "milesburton/DallasTemperature@^4.0.4", "https://github.com/esphome/ESPAsyncWebServer/archive/refs/tags/v2.1.0.zip", ] @@ -241,7 +241,7 @@ def test_private_lib_deps( "version": "1.0.0", "dependencies": { "bblanchon/ArduinoJson": "^5", - "milesburton/DallasTemperature": "^3.9.1" + "milesburton/DallasTemperature": "^4.0.4" } } """ diff --git a/tests/commands/test_lib_complex.py b/tests/commands/test_lib_complex.py index 55563be5..f14d9d4c 100644 --- a/tests/commands/test_lib_complex.py +++ b/tests/commands/test_lib_complex.py @@ -235,7 +235,7 @@ def test_global_lib_update_check(clirunner, validate_cliresult): validate_cliresult(result) output = json.loads(result.output) assert set( - ["Adafruit PN532", "AsyncMqttClient", "ESPAsyncTCP", "NeoPixelBus"] + ["Adafruit PN532", "AsyncMqttClient", "AsyncTCP", "ESPAsyncTCP", "NeoPixelBus"] ) == set(lib["name"] for lib in output)