Skip to content

Commit f47083b

Browse files
committed
Merge branch 'release/v6.1.9'
2 parents b239628 + 3d48f3e commit f47083b

File tree

6 files changed

+39
-19
lines changed

6 files changed

+39
-19
lines changed

HISTORY.rst

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ PlatformIO Core 6
1515

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

18+
6.1.9 (2023-07-06)
19+
~~~~~~~~~~~~~~~~~~
20+
21+
* 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>`_)
22+
* 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>`_)
23+
1824
6.1.8 (2023-07-05)
1925
~~~~~~~~~~~~~~~~~~
2026

docs

platformio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
VERSION = (6, 1, 8)
15+
VERSION = (6, 1, 9)
1616
__version__ = ".".join([str(s) for s in VERSION])
1717

1818
__title__ = "platformio"

platformio/builder/main.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
from platformio import app, fs
3232
from platformio.platform.base import PlatformBase
33-
from platformio.proc import get_pythonexe_path, where_is_program
33+
from platformio.proc import get_pythonexe_path
3434
from platformio.project.helpers import get_project_dir
3535

3636
AllowSubstExceptions(NameError)
@@ -195,13 +195,6 @@
195195
Default("checkprogsize")
196196

197197
if "compiledb" in COMMAND_LINE_TARGETS:
198-
# Resolve absolute path of toolchain
199-
for cmd in ("CC", "CXX", "AS"):
200-
if cmd not in env:
201-
continue
202-
if os.path.isabs(env[cmd]):
203-
continue
204-
env[cmd] = where_is_program(env.subst("$%s" % cmd), env.subst("${ENV['PATH']}"))
205198
env.Alias("compiledb", env.CompilationDatabase("$COMPILATIONDB_PATH"))
206199

207200
# Print configured protocols

platformio/builder/tools/piobuild.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from platformio import __version__, fs
2727
from platformio.compat import IS_MACOS, string_types
2828
from platformio.package.version import pepver_to_semver
29+
from platformio.proc import where_is_program
2930

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

128-
if "compiledb" in COMMAND_LINE_TARGETS and env.get(
129-
"COMPILATIONDB_INCLUDE_TOOLCHAIN"
130-
):
131-
for scope, includes in env.DumpIntegrationIncludes().items():
132-
if scope in ("toolchain",):
133-
env.Append(CPPPATH=includes)
129+
if "compiledb" in COMMAND_LINE_TARGETS:
130+
# Resolve absolute path of toolchain
131+
for cmd in ("CC", "CXX", "AS"):
132+
if cmd not in env:
133+
continue
134+
if os.path.isabs(env[cmd]):
135+
continue
136+
env[cmd] = where_is_program(
137+
env.subst("$%s" % cmd), env.subst("${ENV['PATH']}")
138+
)
139+
140+
if env.get("COMPILATIONDB_INCLUDE_TOOLCHAIN"):
141+
for scope, includes in env.DumpIntegrationIncludes().items():
142+
if scope in ("toolchain",):
143+
env.Append(CPPPATH=includes)
134144

135145

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

214222
return result
215223

tests/commands/test_run.py

+13
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ def test_generic_build(clirunner, validate_cliresult, tmpdir):
2222
("-D TEST_INT=13", "-DTEST_INT=13"),
2323
("-DTEST_SINGLE_MACRO", "-DTEST_SINGLE_MACRO"),
2424
('-DTEST_STR_SPACE="Andrew Smith"', '"-DTEST_STR_SPACE=Andrew Smith"'),
25+
("-Iinclude", "-Iinclude"),
26+
("-include cpppath-include.h", "cpppath-include.h"),
2527
("-Iextra_inc", "-Iextra_inc"),
28+
("-Inon-existing-dir", "non-existing-dir"),
2629
(
2730
"-include $PROJECT_DIR/lib/component/component-forced-include.h",
2831
"component-forced-include.h",
@@ -103,12 +106,22 @@ def post_prog_action(source, target, env):
103106
#error "I_AM_FORCED_COMPONENT_INCLUDE"
104107
#endif
105108
109+
#ifndef I_AM_FORCED_CPPPATH_INCLUDE
110+
#error "I_AM_FORCED_CPPPATH_INCLUDE"
111+
#endif
112+
106113
#ifdef COMMENTED_MACRO
107114
#error "COMMENTED_MACRO"
108115
#endif
109116
110117
int main() {
111118
}
119+
"""
120+
)
121+
122+
tmpdir.mkdir("include").join("cpppath-include.h").write(
123+
"""
124+
#define I_AM_FORCED_CPPPATH_INCLUDE
112125
"""
113126
)
114127
component_dir = tmpdir.mkdir("lib").mkdir("component")

0 commit comments

Comments
 (0)