diff --git a/HISTORY.rst b/HISTORY.rst index 51a05c9c..621b6e52 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,32 +11,30 @@ PlatformIO 4.0 - New project configuration parser with a strict options typing (`API `__) - Unified workspace storage (`workspace_dir `__ -> ``.pio``) for PlatformIO Build System, Library Manager, and other internal services (`issue #1778 `_) - - Switched to workspace ``.pio/build`` folder for build artifacts instead of ``.pioenvs`` - Share common (global) options between project environments using `[env] `__ section (`issue #1643 `_) - Include external configuration files with `extra_configs `__ option (`issue #1590 `_) - - Override default `"platformio.ini" (Project Configuration File) `__ with a custom using ``-c, --project-conf`` option for `platformio run `__, `platformio debug `__, or `platformio test `__ commands (`issue #1913 `_) - Custom project ``***_dir`` options declared in `platformio `__ section have higher priority than `Environment variables `__ - Added support for Unix shell-style wildcards for `monitor_port `__ option (`issue #2541 `_) - Added new `monitor_flags `__ option which allows passing extra flags and options to `platformio device monitor `__ command (`issue #2165 `_) - - Override default development platform upload command with a custom `upload_command `__ (`issue #2599 `_) - Added support for `PLATFORMIO_DEFAULT_ENVS `__ system environment variable (`issue #1967 `_) - - Fixed an issue when ``-U`` in ``build_flags`` does not remove macro previously defined via ``-D`` flag (`issue #2508 `_) + - Added support for `shared_dir `__ where you can place an extra files (extra scripts, LD scripts, etc.) which should be transferred to a `PIO Remote `__ machine * **Library Management** + - Switched to workspace ``.pio/libdeps`` folder for project dependencies instead of ``.piolibdeps`` - Save libraries passed to `platformio lib install `__ command into the project dependency list (`lib_deps `__) with a new ``--save`` flag (`issue #1028 `_) - Install all project dependencies declared via `lib_deps `__ option using a simple `platformio lib install `__ command (`issue #2147 `_) - Use isolated library dependency storage per project build environment (`issue #1696 `_) - Override default source and include directories for a library via `library.json `__ manifest using ``includeDir`` and ``srcDir`` fields - - Switched to workspace ``.pio/libdeps`` folder for project dependencies instead of ``.piolibdeps`` * **Build System** + - Switched to workspace ``.pio/build`` folder for build artifacts instead of ``.pioenvs`` + - Switch between `Build Configurations `__ (``release`` and ``debug``) with a new project configuration option `build_type `__ - Print platform package details, such as version, VSC source and commit (`issue #2155 `_) - -* **PIO Remote** - - - Added support for `shared_dir `__ where you can place an extra files (extra scripts, LD scripts, etc.) which should be transferred to a remote machine + - Override default `"platformio.ini" (Project Configuration File) `__ with a custom using ``-c, --project-conf`` option for `platformio run `__, `platformio debug `__, or `platformio test `__ commands (`issue #1913 `_) + - Override default development platform upload command with a custom `upload_command `__ (`issue #2599 `_) + - Fixed an issue when ``-U`` in ``build_flags`` does not remove macro previously defined via ``-D`` flag (`issue #2508 `_) * **Infrastructure** diff --git a/docs b/docs index 84973be5..ddf3e192 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 84973be53b7465e37ab4b20ce245ffa12a294098 +Subproject commit ddf3e1929ae0d23a5a373ee4b15edb04b480415c diff --git a/platformio/builder/main.py b/platformio/builder/main.py index cedea7ca..bf1b001e 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -142,7 +142,6 @@ env.AddPreAction( "Configuring upload protocol...")) AlwaysBuild(env.Alias("debug", DEFAULT_TARGETS)) -AlwaysBuild(env.Alias("__debug", DEFAULT_TARGETS)) AlwaysBuild(env.Alias("__test", DEFAULT_TARGETS)) ############################################################################## diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index a7fef99a..442ffdd7 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -298,7 +298,7 @@ def ProcessDebug(env): if not env.subst("$PIODEBUGFLAGS"): env.Replace(PIODEBUGFLAGS=["-Og", "-g3", "-ggdb3"]) env.Append(BUILD_FLAGS=list(env['PIODEBUGFLAGS']) + - ["-D__PLATFORMIO_DEBUG__"]) + ["-D__PLATFORMIO_BUILD_DEBUG__"]) unflags = ["-Os"] for level in [0, 1, 2]: for flag in ("O", "g", "ggdb"): diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index f8f3656c..c584d654 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -69,7 +69,7 @@ def _build_project_deps(env): if is_test: projenv.BuildSources("$BUILDTEST_DIR", "$PROJECTTEST_DIR", "$PIOTEST_SRC_FILTER") - if not is_test or env.get("TEST_BUILD_PROJECT_SRC") == "true": + if not is_test or env.GetProjectOption("test_build_project_src", False): projenv.BuildSources("$BUILDSRC_DIR", "$PROJECTSRC_DIR", env.get("SRC_FILTER")) @@ -97,7 +97,8 @@ def BuildProgram(env): if not Util.case_sensitive_suffixes(".s", ".S"): env.Replace(AS="$CC", ASCOM="$ASPPCOM") - if set(["__debug", "debug"]) & set(COMMAND_LINE_TARGETS): + if ("debug" in COMMAND_LINE_TARGETS + or env.GetProjectOption("build_type") == "debug"): env.ProcessDebug() # process extra flags from board diff --git a/platformio/commands/debug/helpers.py b/platformio/commands/debug/helpers.py index 2d1f5205..6c215512 100644 --- a/platformio/commands/debug/helpers.py +++ b/platformio/commands/debug/helpers.py @@ -21,7 +21,7 @@ from hashlib import sha1 from io import BytesIO from os.path import isfile -from platformio import VERSION, exception, util +from platformio import exception, util from platformio.commands.platform import \ platform_install as cmd_platform_install from platformio.commands.run import cli as cmd_run @@ -49,7 +49,14 @@ def escape_path(path): def get_default_debug_env(config): default_envs = config.default_envs() - return default_envs[0] if default_envs else config.envs()[0] + all_envs = config.envs() + for env in default_envs: + if config.get("env:" + env, "build_type") == "debug": + return env + for env in all_envs: + if config.get("env:" + env, "build_type") == "debug": + return env + return default_envs[0] if default_envs else all_envs[0] def validate_debug_options(cmd_ctx, env_options): @@ -141,7 +148,7 @@ def predebug_project(ctx, project_dir, env_name, preload, verbose): ctx.invoke(cmd_run, project_dir=project_dir, environment=[env_name], - target=["__debug"] + (["upload"] if preload else []), + target=["debug"] + (["upload"] if preload else []), verbose=verbose) if preload: time.sleep(5) @@ -206,7 +213,7 @@ def has_debug_symbols(prog_path): b".debug_abbrev": False, b" -Og": False, b" -g": False, - b"__PLATFORMIO_DEBUG__": (3, 6) > VERSION[:2] + b"__PLATFORMIO_BUILD_DEBUG__": False } with open(prog_path, "rb") as fp: last_data = b"" diff --git a/platformio/project/options.py b/platformio/project/options.py index 66fb13fc..fe5e9368 100644 --- a/platformio/project/options.py +++ b/platformio/project/options.py @@ -111,6 +111,8 @@ ProjectOptions = OrderedDict([ buildenvvar="BOARD_FLASH_MODE"), # Build + ConfigEnvOption(name="build_type", + type=click.Choice(["release", "debug"])), ConfigEnvOption(name="build_flags", multiple=True, sysenvvar="PLATFORMIO_BUILD_FLAGS",