Merge branch 'release/v3.6.2'

This commit is contained in:
Ivan Kravets
2018-11-29 18:02:58 +02:00
14 changed files with 96 additions and 64 deletions

View File

@ -4,6 +4,19 @@ Release Notes
PlatformIO 3.0 PlatformIO 3.0
-------------- --------------
3.6.2 (2018-11-29)
~~~~~~~~~~~~~~~~~~
* Improved IntelliSense for `PlatformIO IDE for VSCode <http://docs.platformio.org/page/ide/vscode.html>`__ via passing extra compiler information for C/C++ Code Parser (resolves issues with spurious project's "Problems")
* Fixed an issue with VSCode IntelliSense warning about the missed headers located in `include <http://docs.platformio.org/page/projectconf/section_platformio.html#include-dir>`__ folder
* Fixed incorrect wording when initializing/updating project
* Fixed an issue with incorrect order for library dependencies ``CPPPATH``
(`issue #1914 <https://github.com/platformio/platformio-core/issues/1914>`_)
* Fixed an issue when Library Dependency Finder (LDF) does not handle project `src_filter <http://docs.platformio.org/page/projectconf/section_env_build.html#src-filter>`__
(`issue #1905 <https://github.com/platformio/platformio-core/issues/1905>`_)
* Fixed an issue when Library Dependency Finder (LDF) finds spurious dependencies in ``chain+`` and ``deep+`` modes
(`issue #1930 <https://github.com/platformio/platformio-core/issues/1930>`_)
3.6.1 (2018-10-29) 3.6.1 (2018-10-29)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

2
docs

Submodule docs updated: 30c88f6247...cfdb7d8968

View File

@ -14,7 +14,7 @@
import sys import sys
VERSION = (3, 6, 1) VERSION = (3, 6, 2)
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -25,7 +25,7 @@ from platformio.managers.core import get_core_package_dir
def _dump_includes(env): def _dump_includes(env):
includes = [env.subst("$PROJECTINCLUDE_DIR"), env.subst("$PROJECTSRC_DIR")] includes = []
for item in env.get("CPPPATH", []): for item in env.get("CPPPATH", []):
includes.append(env.subst(item)) includes.append(env.subst(item))
@ -53,6 +53,10 @@ def _dump_includes(env):
if unity_dir: if unity_dir:
includes.append(unity_dir) includes.append(unity_dir)
includes.extend(
[env.subst("$PROJECTINCLUDE_DIR"),
env.subst("$PROJECTSRC_DIR")])
# remove duplicates # remove duplicates
result = [] result = []
for item in includes: for item in includes:
@ -130,8 +134,8 @@ def _get_svd_path(env):
def DumpIDEData(env): def DumpIDEData(env):
LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS"
LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS"
data = { data = {
"libsource_dirs": "libsource_dirs":

View File

@ -347,7 +347,7 @@ class LibBuilderBase(object):
for path in self._validate_search_files(search_files): for path in self._validate_search_files(search_files):
try: try:
assert "+" in self.lib_ldf_mode assert "+" in self.lib_ldf_mode
incs = LibBuilderBase.CCONDITIONAL_SCANNER( candidates = LibBuilderBase.CCONDITIONAL_SCANNER(
self.env.File(path), self.env.File(path),
self.env, self.env,
tuple(include_dirs), tuple(include_dirs),
@ -357,26 +357,26 @@ class LibBuilderBase(object):
sys.stderr.write( sys.stderr.write(
"Warning! Classic Pre Processor is used for `%s`, " "Warning! Classic Pre Processor is used for `%s`, "
"advanced has failed with `%s`\n" % (path, e)) "advanced has failed with `%s`\n" % (path, e))
_incs = LibBuilderBase.CLASSIC_SCANNER( candidates = LibBuilderBase.CLASSIC_SCANNER(
self.env.File(path), self.env, tuple(include_dirs)) self.env.File(path), self.env, tuple(include_dirs))
incs = []
for inc in _incs: # print(path, map(lambda n: n.get_abspath(), candidates))
incs.append(inc) for item in candidates:
if not self.PARSE_SRC_BY_H_NAME: if item not in result:
result.append(item)
if not self.PARSE_SRC_BY_H_NAME:
continue
_h_path = item.get_abspath()
if not self.env.IsFileWithExt(_h_path, piotool.SRC_HEADER_EXT):
continue
_f_part = _h_path[:_h_path.rindex(".")]
for ext in piotool.SRC_C_EXT:
if not isfile("%s.%s" % (_f_part, ext)):
continue continue
_h_path = inc.get_abspath() _c_path = self.env.File("%s.%s" % (_f_part, ext))
if not self.env.IsFileWithExt(_h_path, if _c_path not in result:
piotool.SRC_HEADER_EXT): result.append(_c_path)
continue
_f_part = _h_path[:_h_path.rindex(".")]
for ext in piotool.SRC_C_EXT:
if isfile("%s.%s" % (_f_part, ext)):
incs.append(
self.env.File("%s.%s" % (_f_part, ext)))
# print(path, map(lambda n: n.get_abspath(), incs))
for inc in incs:
if inc not in result:
result.append(inc)
return result return result
def depend_recursive(self, lb, search_files=None): def depend_recursive(self, lb, search_files=None):
@ -432,23 +432,23 @@ class LibBuilderBase(object):
libs.extend(lb.build()) libs.extend(lb.build())
# copy shared information to self env # copy shared information to self env
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"):
self.env.AppendUnique(**{key: lb.env.get(key)}) self.env.PrependUnique(**{key: lb.env.get(key)})
for lb in self._circular_deps: for lb in self._circular_deps:
self.env.AppendUnique(CPPPATH=lb.get_include_dirs()) self.env.PrependUnique(CPPPATH=lb.get_include_dirs())
if self._is_built: if self._is_built:
return libs return libs
self._is_built = True self._is_built = True
self.env.AppendUnique(CPPPATH=self.get_include_dirs()) self.env.PrependUnique(CPPPATH=self.get_include_dirs())
if self.lib_ldf_mode == "off": if self.lib_ldf_mode == "off":
for lb in self.env.GetLibBuilders(): for lb in self.env.GetLibBuilders():
if self == lb or not lb.is_built: if self == lb or not lb.is_built:
continue continue
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"):
self.env.AppendUnique(**{key: lb.env.get(key)}) self.env.PrependUnique(**{key: lb.env.get(key)})
if self.lib_archive: if self.lib_archive:
libs.append( libs.append(
@ -663,6 +663,12 @@ class PlatformIOLibBuilder(LibBuilderBase):
class ProjectAsLibBuilder(LibBuilderBase): class ProjectAsLibBuilder(LibBuilderBase):
def __init__(self, env, *args, **kwargs):
# backup original value, will be reset in base.__init__
project_src_filter = env.get("SRC_FILTER")
super(ProjectAsLibBuilder, self).__init__(env, *args, **kwargs)
self.env['SRC_FILTER'] = project_src_filter
@property @property
def include_dir(self): def include_dir(self):
include_dir = self.env.subst("$PROJECTINCLUDE_DIR") include_dir = self.env.subst("$PROJECTINCLUDE_DIR")
@ -701,7 +707,8 @@ class ProjectAsLibBuilder(LibBuilderBase):
@property @property
def src_filter(self): def src_filter(self):
return self.env.get("SRC_FILTER", LibBuilderBase.src_filter.fget(self)) return (self.env.get("SRC_FILTER")
or LibBuilderBase.src_filter.fget(self))
def process_extra_options(self): def process_extra_options(self):
# skip for project, options are already processed # skip for project, options are already processed
@ -743,7 +750,7 @@ class ProjectAsLibBuilder(LibBuilderBase):
def build(self): def build(self):
self._is_built = True # do not build Project now self._is_built = True # do not build Project now
self.env.AppendUnique(CPPPATH=self.get_include_dirs()) self.env.PrependUnique(CPPPATH=self.get_include_dirs())
return LibBuilderBase.build(self) return LibBuilderBase.build(self)

View File

@ -124,15 +124,15 @@ def LoadPioPlatform(env, variables):
def PrintConfiguration(env): def PrintConfiguration(env):
platform = env.PioPlatform() platform = env.PioPlatform()
platform_data = ["PLATFORM: %s >" % platform.title] platform_data = ["PLATFORM: %s >" % platform.title]
system_data = ["SYSTEM:"] hardware_data = ["HARDWARE:"]
configuration_data = ["CONFIGURATION:"] configuration_data = ["CONFIGURATION:"]
mcu = env.subst("$BOARD_MCU") mcu = env.subst("$BOARD_MCU")
f_cpu = env.subst("$BOARD_F_CPU") f_cpu = env.subst("$BOARD_F_CPU")
if mcu: if mcu:
system_data.append(mcu.upper()) hardware_data.append(mcu.upper())
if f_cpu: if f_cpu:
f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()])) f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()]))
system_data.append("%dMHz" % (f_cpu / 1000000)) hardware_data.append("%dMHz" % (f_cpu / 1000000))
debug_tools = None debug_tools = None
if "BOARD" in env: if "BOARD" in env:
@ -142,13 +142,14 @@ def PrintConfiguration(env):
debug_tools = board_config.get("debug", {}).get("tools") debug_tools = board_config.get("debug", {}).get("tools")
ram = board_config.get("upload", {}).get("maximum_ram_size") ram = board_config.get("upload", {}).get("maximum_ram_size")
flash = board_config.get("upload", {}).get("maximum_size") flash = board_config.get("upload", {}).get("maximum_size")
system_data.append("%s RAM (%s Flash)" % (util.format_filesize(ram), hardware_data.append(
util.format_filesize(flash))) "%s RAM (%s Flash)" % (util.format_filesize(ram),
util.format_filesize(flash)))
configuration_data.append( configuration_data.append(
"https://docs.platformio.org/page/boards/%s/%s.html" % "https://docs.platformio.org/page/boards/%s/%s.html" %
(platform.name, board_config.id)) (platform.name, board_config.id))
for data in (configuration_data, platform_data, system_data): for data in (configuration_data, platform_data, hardware_data):
if len(data) > 1: if len(data) > 1:
print(" ".join(data)) print(" ".join(data))

View File

@ -44,10 +44,10 @@ def scons_patched_match_splitext(path, suffixes=None):
def _build_project_deps(env): def _build_project_deps(env):
project_lib_builder = env.ConfigureProjectLibBuilder() project_lib_builder = env.ConfigureProjectLibBuilder()
# append project libs to the beginning of list # prepend project libs to the beginning of list
env.Prepend(LIBS=project_lib_builder.build()) env.Prepend(LIBS=project_lib_builder.build())
# append extra linker related options from libs # prepend extra linker related options from libs
env.AppendUnique( env.PrependUnique(
**{ **{
key: project_lib_builder.env.get(key) key: project_lib_builder.env.get(key)
for key in ("LIBS", "LIBPATH", "LINKFLAGS") for key in ("LIBS", "LIBPATH", "LINKFLAGS")

View File

@ -87,7 +87,7 @@ def cli(
click.echo("%s - Project Configuration File" % click.style( click.echo("%s - Project Configuration File" % click.style(
"platformio.ini", fg="cyan")) "platformio.ini", fg="cyan"))
is_new_project = util.is_platformio_project(project_dir) is_new_project = not util.is_platformio_project(project_dir)
init_base_project(project_dir) init_base_project(project_dir)
if board: if board:

View File

@ -1,7 +1,8 @@
% _defines = " ".join(["-D%s" % d for d in defines])
{ {
"execPath": "{{ cxx_path.replace("\\", "/") }}", "execPath": "{{ cxx_path.replace("\\", "/") }}",
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}", "gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}", "gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccErrorLimit": 15, "gccErrorLimit": 15,
"gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}", "gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}",
"gccSuppressWarnings": false "gccSuppressWarnings": false

View File

@ -1,7 +1,8 @@
% _defines = " ".join(["-D%s" % d for d in defines])
{ {
"execPath": "{{ cxx_path.replace("\\", "/") }}", "execPath": "{{ cxx_path.replace("\\", "/") }}",
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}", "gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}", "gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccErrorLimit": 15, "gccErrorLimit": 15,
"gccIncludePaths": "{{! ','.join("'{}'".format(w.replace("\\", '/')) for w in includes)}}", "gccIncludePaths": "{{! ','.join("'{}'".format(w.replace("\\", '/')) for w in includes)}}",
"gccSuppressWarnings": false "gccSuppressWarnings": false

View File

@ -7,10 +7,14 @@
% %
% systype = platform.system().lower() % systype = platform.system().lower()
% %
% def _escape(text):
% return text.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')
% end
%
% cleaned_includes = [] % cleaned_includes = []
% for include in includes: % for include in includes:
% if "toolchain-" not in dirname(commonprefix([include, cc_path])): % if "toolchain-" not in dirname(commonprefix([include, cc_path])):
% cleaned_includes.append(include) % cleaned_includes.append(include)
% end % end
% end % end
% %
@ -24,7 +28,7 @@
% end % end
"includePath": [ "includePath": [
% for include in cleaned_includes: % for include in cleaned_includes:
"{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "{{! _escape(include) }}",
% end % end
"" ""
], ],
@ -33,14 +37,14 @@
"databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db", "databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db",
"path": [ "path": [
% for include in cleaned_includes: % for include in cleaned_includes:
"{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "{{! _escape(include) }}",
% end % end
"" ""
] ]
}, },
"defines": [ "defines": [
% for define in defines: % for define in defines:
"{{!define.replace('"', '\\"')}}", "{{! _escape(define) }}",
% end % end
"" ""
], ],
@ -56,7 +60,7 @@
% if cxx_stds: % if cxx_stds:
"cppStandard": "c++{{ cxx_stds[-1] }}", "cppStandard": "c++{{ cxx_stds[-1] }}",
% end % end
"compilerPath": "{{ cc_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"') }}" "compilerPath": "{{! _escape(cc_path) }} {{! _escape(STD_RE.sub("", cc_flags)) }}"
} }
] ]
} }

View File

@ -66,11 +66,12 @@ def on_platformio_exception(e):
def in_silence(ctx=None): def in_silence(ctx=None):
ctx = ctx or app.get_session_var("command_ctx") ctx = ctx or app.get_session_var("command_ctx")
assert ctx if not ctx:
ctx_args = ctx.args or [] return True
return ctx_args and any([ return ctx.args and any([
ctx.args[0] == "upgrade", "--json-output" in ctx_args, ctx.args[0] == "debug" and "--interpreter" in " ".join(ctx.args),
"--version" in ctx_args ctx.args[0] == "upgrade", "--json-output" in ctx.args,
"--version" in ctx.args
]) ])

View File

@ -24,11 +24,11 @@ from platformio import __version__, exception, util
from platformio.managers.package import PackageManager from platformio.managers.package import PackageManager
CORE_PACKAGES = { CORE_PACKAGES = {
"contrib-piohome": "^1.0.2", "contrib-piohome": "^2.0.0",
"contrib-pysite": ">=0.3.2,<2", "contrib-pysite": "~2.%d%d.0" % (sys.version_info[0], sys.version_info[1]),
"tool-pioplus": "^1.5.0", "tool-pioplus": "^2.0.0",
"tool-unity": "~1.20403.0", "tool-unity": "~1.20403.0",
"tool-scons": "~2.20501.4" "tool-scons": "~2.20501.7"
} }
PIOPLUS_AUTO_UPDATES_MAX = 100 PIOPLUS_AUTO_UPDATES_MAX = 100
@ -106,12 +106,12 @@ def update_core_packages(only_check=False, silent=False):
def shutdown_piohome_servers(): def shutdown_piohome_servers():
port = 8010 port = 8010
while port < 9000: while port < 8100:
try: try:
requests.get("http://127.0.0.1:%d?__shutdown__=1" % port) requests.get("http://127.0.0.1:%d?__shutdown__=1" % port)
port += 1
except: # pylint: disable=bare-except except: # pylint: disable=bare-except
return pass
port += 1
def pioplus_call(args, **kwargs): def pioplus_call(args, **kwargs):

View File

@ -628,8 +628,8 @@ def update_embedded_board(rst_path, board):
lines.append(""" lines.append("""
.. contents:: .. contents::
System Hardware
------ --------
Platform :ref:`platform_{platform}`: {platform_description} Platform :ref:`platform_{platform}`: {platform_description}
@ -822,7 +822,7 @@ Boards
# Debug tools # Debug tools
for tool, platforms in tool_to_platforms.items(): for tool, platforms in tool_to_platforms.items():
tool_path = join(DOCS_ROOT_DIR, "plus", "debug-tools", "%s.rst" % tool) tool_path = join(DOCS_ROOT_DIR, "plus", "debug-tools", "%s.rst" % tool)
assert isfile(tool_path) assert isfile(tool_path), tool
platforms = sorted(set(platforms)) platforms = sorted(set(platforms))
lines = [".. begin_platforms"] lines = [".. begin_platforms"]