Skip to content

Commit

Permalink
Merge branch 'release/v6.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jul 6, 2023
2 parents b239628 + 3d48f3e commit f47083b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ PlatformIO Core 6

**A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.**

6.1.9 (2023-07-06)
~~~~~~~~~~~~~~~~~~

* Rectified a regression bug that occurred when the ``-include`` flag was passed via the `build_flags <https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html>`__ option as a relative path and subsequently expanded (`issue #4683 <https://github.com/platformio/platformio-core/issues/4683>`_)
* Resolved an issue that resulted in unresolved absolute toolchain paths when generating the `Compilation database "compile_commands.json" <https://docs.platformio.org/en/latest/integration/compile_commands.html>`__ (`issue #4684 <https://github.com/platformio/platformio-core/issues/4684>`_)

6.1.8 (2023-07-05)
~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion docs
2 changes: 1 addition & 1 deletion platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = (6, 1, 8)
VERSION = (6, 1, 9)
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio"
Expand Down
9 changes: 1 addition & 8 deletions platformio/builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from platformio import app, fs
from platformio.platform.base import PlatformBase
from platformio.proc import get_pythonexe_path, where_is_program
from platformio.proc import get_pythonexe_path
from platformio.project.helpers import get_project_dir

AllowSubstExceptions(NameError)
Expand Down Expand Up @@ -195,13 +195,6 @@
Default("checkprogsize")

if "compiledb" in COMMAND_LINE_TARGETS:
# Resolve absolute path of toolchain
for cmd in ("CC", "CXX", "AS"):
if cmd not in env:
continue
if os.path.isabs(env[cmd]):
continue
env[cmd] = where_is_program(env.subst("$%s" % cmd), env.subst("${ENV['PATH']}"))
env.Alias("compiledb", env.CompilationDatabase("$COMPILATIONDB_PATH"))

# Print configured protocols
Expand Down
26 changes: 17 additions & 9 deletions platformio/builder/tools/piobuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from platformio import __version__, fs
from platformio.compat import IS_MACOS, string_types
from platformio.package.version import pepver_to_semver
from platformio.proc import where_is_program

SRC_HEADER_EXT = ["h", "hpp"]
SRC_ASM_EXT = ["S", "spp", "SPP", "sx", "s", "asm", "ASM"]
Expand Down Expand Up @@ -125,12 +126,21 @@ def _append_pio_macros():
# remove specified flags
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))

if "compiledb" in COMMAND_LINE_TARGETS and env.get(
"COMPILATIONDB_INCLUDE_TOOLCHAIN"
):
for scope, includes in env.DumpIntegrationIncludes().items():
if scope in ("toolchain",):
env.Append(CPPPATH=includes)
if "compiledb" in COMMAND_LINE_TARGETS:
# Resolve absolute path of toolchain
for cmd in ("CC", "CXX", "AS"):
if cmd not in env:
continue
if os.path.isabs(env[cmd]):
continue
env[cmd] = where_is_program(
env.subst("$%s" % cmd), env.subst("${ENV['PATH']}")
)

if env.get("COMPILATIONDB_INCLUDE_TOOLCHAIN"):
for scope, includes in env.DumpIntegrationIncludes().items():
if scope in ("toolchain",):
env.Append(CPPPATH=includes)


def ProcessProjectDeps(env):
Expand Down Expand Up @@ -207,9 +217,7 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches
# fix relative path for "-include"
for i, f in enumerate(result.get("CCFLAGS", [])):
if isinstance(f, tuple) and f[0] == "-include":
p = env.subst(f[1].get_path())
if os.path.exists(p):
result["CCFLAGS"][i] = (f[0], os.path.abspath(p))
result["CCFLAGS"][i] = (f[0], env.subst(f[1].get_path()))

return result

Expand Down
13 changes: 13 additions & 0 deletions tests/commands/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def test_generic_build(clirunner, validate_cliresult, tmpdir):
("-D TEST_INT=13", "-DTEST_INT=13"),
("-DTEST_SINGLE_MACRO", "-DTEST_SINGLE_MACRO"),
('-DTEST_STR_SPACE="Andrew Smith"', '"-DTEST_STR_SPACE=Andrew Smith"'),
("-Iinclude", "-Iinclude"),
("-include cpppath-include.h", "cpppath-include.h"),
("-Iextra_inc", "-Iextra_inc"),
("-Inon-existing-dir", "non-existing-dir"),
(
"-include $PROJECT_DIR/lib/component/component-forced-include.h",
"component-forced-include.h",
Expand Down Expand Up @@ -103,12 +106,22 @@ def post_prog_action(source, target, env):
#error "I_AM_FORCED_COMPONENT_INCLUDE"
#endif
#ifndef I_AM_FORCED_CPPPATH_INCLUDE
#error "I_AM_FORCED_CPPPATH_INCLUDE"
#endif
#ifdef COMMENTED_MACRO
#error "COMMENTED_MACRO"
#endif
int main() {
}
"""
)

tmpdir.mkdir("include").join("cpppath-include.h").write(
"""
#define I_AM_FORCED_CPPPATH_INCLUDE
"""
)
component_dir = tmpdir.mkdir("lib").mkdir("component")
Expand Down

0 comments on commit f47083b

Please sign in to comment.