mirror of
https://github.com/platformio/platformio-core.git
synced 2025-12-23 23:28:06 +01:00
Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b17183cff | ||
|
|
8cd35fb537 | ||
|
|
760499c095 | ||
|
|
00b162608e | ||
|
|
e33b0fe291 | ||
|
|
06fe557a20 | ||
|
|
9c1cc97776 | ||
|
|
d7e2d05f60 | ||
|
|
86e4641101 | ||
|
|
326eb4a681 | ||
|
|
e37d34b92f | ||
|
|
b562541f20 | ||
|
|
736a1404b4 | ||
|
|
9639626ab3 | ||
|
|
b99494671a | ||
|
|
9778778830 | ||
|
|
d2c2171ef9 | ||
|
|
856798488b | ||
|
|
00ba88911f | ||
|
|
639c086728 | ||
|
|
4504080027 | ||
|
|
367e4d663c | ||
|
|
28bca48eca | ||
|
|
69065d8bd6 | ||
|
|
db0bbcc043 | ||
|
|
b594c11718 | ||
|
|
d627a42268 | ||
|
|
f058b8f18f | ||
|
|
13430aa628 | ||
|
|
56cd55ba7d | ||
|
|
19b5285d50 | ||
|
|
d5d95092c4 | ||
|
|
68e3f9dc00 | ||
|
|
fabaadec60 | ||
|
|
7f697961ec | ||
|
|
9334f31ff2 | ||
|
|
579de32d4e | ||
|
|
c3702391ea | ||
|
|
826418a443 | ||
|
|
4dfa885a85 | ||
|
|
9f4dde4b5e | ||
|
|
3748219cac | ||
|
|
4b55767fb9 | ||
|
|
5aef182652 | ||
|
|
6db47cec2b | ||
|
|
6f8b9d70bc | ||
|
|
d8cbe99f2c | ||
|
|
a690b8c085 | ||
|
|
b874359482 | ||
|
|
3a18e668c2 | ||
|
|
3ca9527da4 | ||
|
|
f539513376 | ||
|
|
afdfaeec68 | ||
|
|
676c87d081 | ||
|
|
98032ec548 |
79
HISTORY.rst
79
HISTORY.rst
@@ -4,6 +4,54 @@ Release Notes
|
||||
PlatformIO 3.0
|
||||
--------------
|
||||
|
||||
3.6.6 (2019-03-29)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Project Generator: fixed a warning "Property !!! WARNING !!! is not allowed" for VSCode
|
||||
(`issue #2243 <https://github.com/platformio/platformio-core/issues/2243>`_)
|
||||
* Fixed an issue when PlatformIO Build System does not pick up "mbed_lib.json" files from libraries
|
||||
(`issue #2164 <https://github.com/platformio/platformio-core/issues/2164>`_)
|
||||
* Fixed an error with conflicting declaration of a prototype (Arduino sketch preprocessor)
|
||||
* Fixed "FileExistsError" when `platformio ci <https://docs.platformio.org/en/latest/userguide/cmd_ci.html>`__ command is used in pair with ``--keep-build-dir`` option
|
||||
* Fixed an issue with incorrect order of project "include" and "src" paths in ``CPPPATH``
|
||||
(`issue #1914 <https://github.com/platformio/platformio-core/issues/1914>`_)
|
||||
|
||||
3.6.5 (2019-03-07)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Project Generator: added new targets for CLion IDE "BUILD_VERBOSE" and "MONITOR" (serial port monitor)
|
||||
(`issue #359 <https://github.com/platformio/platformio-core/issues/359>`_)
|
||||
* Fixed an issue with slow updating of PlatformIO Core packages on Windows
|
||||
* Fixed an issue when `platformio ci <https://docs.platformio.org/en/latest/userguide/cmd_ci.html>`__ recompiles project if ``--keep-build-dir`` option is passed
|
||||
(`issue #2109 <https://github.com/platformio/platformio-core/issues/2109>`_)
|
||||
* Fixed an issue when ``$PROJECT_HASH`` template was not expanded for the other directory ``***_dir`` options in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #2170 <https://github.com/platformio/platformio-core/issues/2170>`_)
|
||||
|
||||
3.6.4 (2019-01-23)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Improved Project Generator for IDEs:
|
||||
|
||||
- Use full path to PlatformIO CLI when generating a project
|
||||
(`issue #1674 <https://github.com/platformio/platformio-core/issues/1674>`_)
|
||||
- CLion: Improved project portability using "${CMAKE_CURRENT_LIST_DIR}" instead of full path
|
||||
- Eclipse: Provide language standard to a project C/C++ indexer
|
||||
(`issue #1010 <https://github.com/platformio/platformio-core/issues/1010>`_)
|
||||
|
||||
* Fixed an issue with incorrect detecting of compatibility (LDF) between generic library and Arduino or ARM mbed frameworks
|
||||
* Fixed "Runtime Error: Dictionary size changed during iteration"
|
||||
(`issue #2003 <https://github.com/platformio/platformio-core/issues/2003>`_)
|
||||
* Fixed an error "Could not extract item..." when extracting TAR archive with symbolic items on Windows platform
|
||||
(`issue #2015 <https://github.com/platformio/platformio-core/issues/2015>`_)
|
||||
|
||||
3.6.3 (2018-12-12)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Ignore ``*.asm`` and ``*.ASM`` files when building Arduino-based library (compatibility with Arduino builder)
|
||||
* Fixed spurious project's "Problems" for `PlatformIO IDE for VSCode <http://docs.platformio.org/page/ide/vscode.html>`__ when ARM mbed framework is used
|
||||
* Fixed an issue with a broken headers list when generating ".clang_complete" for `Emacs <http://docs.platformio.org/page/ide/emacs.html>`__
|
||||
(`issue #1960 <https://github.com/platformio/platformio-core/issues/1960>`_)
|
||||
|
||||
3.6.2 (2018-11-29)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -21,8 +69,8 @@ PlatformIO 3.0
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Generate an `include <http://docs.platformio.org/page/projectconf/section_platformio.html#include-dir>`__ and `test <http://docs.platformio.org/page/projectconf/section_platformio.html#test-dir>`__ directories with a README file when initializing a new project
|
||||
* Support in-line comments for multi-line value (``lib_deps``, ``build_flags``, etc) in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
* Added ``$PROJECT_HASH`` template variable for `build_dir <http://docs.platformio.org/en/latest/projectconf/section_platformio.html#projectconf-pio-build-dir>`__. One of the use cases is setting a global storage for project artifacts using `PLATFORMIO_BUILD_DIR <http://docs.platformio.org/en/latest/envvars.html#envvar-PLATFORMIO_BUILD_DIR>`__ system environment variable. For example, ``/tmp/pio-build/$PROJECT_HASH`` (Unix) or ``%TEMP%/pio-build/$PROJECT_HASH`` (Windows)
|
||||
* Support in-line comments for multi-line value (``lib_deps``, ``build_flags``, etc) in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
* Added ``$PROJECT_HASH`` template variable for `build_dir <http://docs.platformio.org/en/latest/projectconf/section_platformio.html#projectconf-pio-build-dir>`__. One of the use cases is setting a global storage for project artifacts using `PLATFORMIO_BUILD_DIR <http://docs.platformio.org/en/latest/envvars.html#envvar-PLATFORMIO_BUILD_DIR>`__ system environment variable. For example, ``/tmp/pio-build/$PROJECT_HASH`` (Unix) or ``$[sysenv.TEMP}/pio-build/$PROJECT_HASH`` (Windows)
|
||||
* Improved a loading speed of PIO Home "Recent News"
|
||||
* Improved `PIO Unified Debugger <https://docs.platformio.org/en/page/plus/debugging.html>`__ for "mbed" framework and fixed issue with missed local variables
|
||||
* Introduced `"Release" and "Debug" Build Configurations <http://docs.platformio.org/page/projectconf/build_configurations.html>`__
|
||||
@@ -42,7 +90,6 @@ PlatformIO 3.0
|
||||
(`issue #1873 <https://github.com/platformio/platformio-core/issues/1873>`_)
|
||||
* Fixed an issue with incorrect handling of a custom package name when using `platformio lib install <http://docs.platformio.org/page/userguide/lib/cmd_install.html>`__ or `platformio platform install <http://docs.platformio.org/page/userguide/platforms/cmd_install.html>`__ commands
|
||||
|
||||
|
||||
3.6.0 (2018-08-06)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -107,7 +154,7 @@ PlatformIO 3.0
|
||||
|
||||
* Simplify configuration for `PIO Unit Testing <https://docs.platformio.org/page/plus/unit-testing.html>`__: separate main program from a test build process, drop
|
||||
requirement for ``#ifdef UNIT_TEST`` guard
|
||||
* Override any option from board manifest in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_env_board.html#more-options>`__
|
||||
* Override any option from board manifest in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_env_board.html#more-options>`__
|
||||
(`issue #1612 <https://github.com/platformio/platformio-core/issues/1612>`_)
|
||||
* Configure a custom path to SVD file using `debug_svd_path <https://docs.platformio.org/page/projectconf/section_env_debug.html#debug-svd-path>`__
|
||||
option
|
||||
@@ -170,7 +217,7 @@ PlatformIO 3.0
|
||||
(`issue #1274 <https://github.com/platformio/platformio-core/issues/1274>`_)
|
||||
* Configure a custom firmware/program name in build directory (`example <https://docs.platformio.org/page/projectconf/advanced_scripting.html#custom-firmware-program-name>`__)
|
||||
* Renamed ``envs_dir`` option to ``build_dir``
|
||||
in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_platformio.html#build-dir>`__
|
||||
in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_platformio.html#build-dir>`__
|
||||
* Refactored code without "arrow" dependency (resolve issue with "ImportError:
|
||||
No module named backports.functools_lru_cache")
|
||||
* Improved support of PIO Unified Debugger for Eclipse Oxygen
|
||||
@@ -205,7 +252,7 @@ PlatformIO 3.0
|
||||
folder for project's header files
|
||||
(`issue #1107 <https://github.com/platformio/platformio-core/issues/1107>`_)
|
||||
* Depend on development platform using VCS URL (Git, Mercurial and Subversion)
|
||||
instead of a name in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_env_general.html#platform>`__.
|
||||
instead of a name in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_env_general.html#platform>`__.
|
||||
Drop support for ``*_stage`` dev/platform names (use VCS URL instead).
|
||||
* Reinstall/redownload package with a new ``-f, --force`` option for
|
||||
`platformio lib install <https://docs.platformio.org/page/userguide/lib/cmd_install.html>`__
|
||||
@@ -226,7 +273,7 @@ PlatformIO 3.0
|
||||
- Parse library source file in pair with a header when they have the same name
|
||||
(`issue #1175 <https://github.com/platformio/platformio-core/issues/1175>`_)
|
||||
- Handle library dependencies defined as VCS or SemVer in
|
||||
`“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_env_general.html#platform>`__
|
||||
`"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf/section_env_general.html#platform>`__
|
||||
(`issue #1155 <https://github.com/platformio/platformio-core/issues/1155>`_)
|
||||
- Added option to configure library `Compatible Mode <https://docs.platformio.org/page/librarymanager/ldf.html#compatibility-mode>`__
|
||||
using `library.json <https://docs.platformio.org/page/librarymanager/config.html>`__
|
||||
@@ -262,7 +309,7 @@ PlatformIO 3.0
|
||||
* Use a root of library when filtering source code using
|
||||
`library.json <https://docs.platformio.org/page/librarymanager/config.html>`__
|
||||
and ``srcFilter`` field
|
||||
* Added ``monitor_*`` options to white-list for `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
* Added ``monitor_*`` options to white-list for `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #982 <https://github.com/platformio/platformio-core/issues/982>`_)
|
||||
* Do not ask for board ID when initialize project for desktop platform
|
||||
* Handle broken PIO Core state and create new one
|
||||
@@ -283,18 +330,18 @@ PlatformIO 3.0
|
||||
- Integration with `Eclipse <https://docs.platformio.org/page/ide/eclipse.html>`__ and `Sublime Text <https://docs.platformio.org/page/ide/sublimetext.html>`__
|
||||
|
||||
* Filter `PIO Unit Testing <https://docs.platformio.org/page/plus/unit-testing.html>`__
|
||||
tests using a new ``test_filter`` option in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
tests using a new ``test_filter`` option in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
or `platformio test --filter <https://docs.platformio.org/page/userguide/cmd_test.html#cmdoption-platformio-test-f>`__ command
|
||||
(`issue #934 <https://github.com/platformio/platformio-core/issues/934>`_)
|
||||
* Custom ``test_transport`` for `PIO Unit Testing <https://docs.platformio.org/page/plus/unit-testing.html>`__ Engine
|
||||
* Configure Serial Port Monitor in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
* Configure Serial Port Monitor in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #787 <https://github.com/platformio/platformio-core/issues/787>`_)
|
||||
* New `monitor <https://docs.platformio.org/page/userguide/cmd_run.html#cmdoption-platformio-run-t>`__
|
||||
target which allows to launch Serial Monitor automatically after successful
|
||||
"build" or "upload" operations
|
||||
(`issue #788 <https://github.com/platformio/platformio-core/issues/788>`_)
|
||||
* Project generator for `VIM <https://docs.platformio.org/page/ide/vim.html>`__
|
||||
* Multi-line support for the different options in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__,
|
||||
* Multi-line support for the different options in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__,
|
||||
such as: ``build_flags``, ``build_unflags``, etc.
|
||||
(`issue #889 <https://github.com/platformio/platformio-core/issues/889>`_)
|
||||
* Handle dynamic ``SRC_FILTER`` environment variable from
|
||||
@@ -306,7 +353,7 @@ PlatformIO 3.0
|
||||
that were installed from repository
|
||||
* Add support for ``.*cc`` extension
|
||||
(`issue #939 <https://github.com/platformio/platformio-core/issues/939>`_)
|
||||
* Handle ``env_default`` in `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
* Handle ``env_default`` in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
when re-initializing a project
|
||||
(`issue #950 <https://github.com/platformio/platformio-core/issues/950>`_)
|
||||
* Use root directory for PIO Home when path contains non-ascii characters
|
||||
@@ -404,10 +451,10 @@ PlatformIO 3.0
|
||||
(`issue #808 <https://github.com/platformio/platformio-core/issues/808>`_,
|
||||
`issue #467 <https://github.com/platformio/platformio-core/issues/467>`_)
|
||||
* Inject system environment variables to configuration settings in
|
||||
`“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
`"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #792 <https://github.com/platformio/platformio-core/issues/792>`_)
|
||||
* Custom boards per project with ``boards_dir`` option in
|
||||
`“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
`"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #515 <https://github.com/platformio/platformio-core/issues/515>`_)
|
||||
* Unix shell-style wildcards for `upload_port <https://docs.platformio.org/page/projectconf/section_env_upload.html#upload-port>`_
|
||||
(`issue #839 <https://github.com/platformio/platformio-core/issues/839>`_)
|
||||
@@ -418,7 +465,7 @@ PlatformIO 3.0
|
||||
* Added new `LDF Modes <https://docs.platformio.org/page/librarymanager/ldf.html#ldf-mode>`__:
|
||||
``chain+`` and ``deep+`` and set ``chain+`` as default
|
||||
* Added global ``lib_extra_dirs`` option to ``[platformio]`` section for
|
||||
`“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
`"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #842 <https://github.com/platformio/platformio-core/issues/842>`_)
|
||||
* Enabled caching by default for API requests and Library Manager (see `enable_cache <https://docs.platformio.org/page/userguide/cmd_settings.html#enable-cache>`__ setting)
|
||||
* Native integration with VIM/Neovim using `neomake-platformio <https://github.com/coddingtonbear/neomake-platformio>`__ plugin
|
||||
@@ -441,7 +488,7 @@ PlatformIO 3.0
|
||||
3.1.0 (2016-09-19)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* New! Dynamic variables/templates for `“platformio.ini” (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
* New! Dynamic variables/templates for `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
|
||||
(`issue #705 <https://github.com/platformio/platformio-core/issues/705>`_)
|
||||
* Summary about processed environments
|
||||
(`issue #777 <https://github.com/platformio/platformio-core/issues/777>`_)
|
||||
|
||||
2
docs
2
docs
Submodule docs updated: cfdb7d8968...3a6c69a1ae
2
examples
2
examples
Submodule examples updated: 322e1f2bb7...9c16f551d7
@@ -14,7 +14,7 @@
|
||||
|
||||
import sys
|
||||
|
||||
VERSION = (3, 6, 2)
|
||||
VERSION = (3, 6, 6)
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
||||
@@ -122,7 +122,7 @@ class State(object):
|
||||
raise exception.HomeDirPermissionsError(dirname(self.path))
|
||||
|
||||
def _unlock_state_file(self):
|
||||
if self._lockfile:
|
||||
if hasattr(self, "_lockfile") and self._lockfile:
|
||||
self._lockfile.release()
|
||||
|
||||
def __del__(self):
|
||||
@@ -226,9 +226,9 @@ class ContentCache(object):
|
||||
newlines = []
|
||||
with open(self._db_path) as fp:
|
||||
for line in fp.readlines():
|
||||
line = line.strip()
|
||||
if "=" not in line:
|
||||
continue
|
||||
line = line.strip()
|
||||
expire, path = line.split("=")
|
||||
if time() < int(expire) and isfile(path) and \
|
||||
path not in paths_for_delete:
|
||||
@@ -352,8 +352,8 @@ def get_cid():
|
||||
pass
|
||||
cid = str(
|
||||
uuid.UUID(
|
||||
bytes=hashlib.md5(str(_uid if _uid else uuid.getnode())).
|
||||
digest()))
|
||||
bytes=hashlib.md5(str(
|
||||
_uid if _uid else uuid.getnode())).digest()))
|
||||
if "windows" in util.get_systype() or os.getuid() > 0:
|
||||
set_state_item("cid", cid)
|
||||
return cid
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=no-member, no-self-use, unused-argument
|
||||
# pylint: disable=no-member, no-self-use, unused-argument, too-many-lines
|
||||
# pylint: disable=too-many-instance-attributes, too-many-public-methods
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from glob import glob
|
||||
from os.path import (basename, commonprefix, dirname, isdir, isfile, join,
|
||||
@@ -64,17 +65,22 @@ class LibBuilderFactory(object):
|
||||
if isfile(join(path, "module.json")):
|
||||
return ["mbed"]
|
||||
|
||||
include_re = re.compile(
|
||||
r'^#include\s+(<|")(Arduino|mbed)\.h(<|")', flags=re.MULTILINE)
|
||||
|
||||
# check source files
|
||||
for root, _, files in os.walk(path, followlinks=True):
|
||||
if "mbed_lib.json" in files:
|
||||
return ["mbed"]
|
||||
for fname in files:
|
||||
if not env.IsFileWithExt(
|
||||
fname, piotool.SRC_BUILD_EXT + piotool.SRC_HEADER_EXT):
|
||||
continue
|
||||
with open(join(root, fname)) as f:
|
||||
content = f.read()
|
||||
if "Arduino.h" in content:
|
||||
if "Arduino.h" in content and include_re.search(content):
|
||||
return ["arduino"]
|
||||
elif "mbed.h" in content:
|
||||
elif "mbed.h" in content and include_re.search(content):
|
||||
return ["mbed"]
|
||||
return []
|
||||
|
||||
@@ -171,10 +177,11 @@ class LibBuilderBase(object):
|
||||
if isdir(join(self.path, "src")) else self.path)
|
||||
|
||||
def get_include_dirs(self):
|
||||
items = [self.src_dir]
|
||||
items = []
|
||||
include_dir = self.include_dir
|
||||
if include_dir and include_dir not in items:
|
||||
items.append(include_dir)
|
||||
items.append(self.src_dir)
|
||||
return items
|
||||
|
||||
@property
|
||||
@@ -256,7 +263,6 @@ class LibBuilderBase(object):
|
||||
|
||||
def process_extra_options(self):
|
||||
with util.cd(self.path):
|
||||
self.env.ProcessUnFlags(self.build_unflags)
|
||||
self.env.ProcessFlags(self.build_flags)
|
||||
if self.extra_script:
|
||||
self.env.SConscriptChdir(1)
|
||||
@@ -266,6 +272,7 @@ class LibBuilderBase(object):
|
||||
"env": self.env,
|
||||
"pio_lib_builder": self
|
||||
})
|
||||
self.env.ProcessUnFlags(self.build_unflags)
|
||||
|
||||
def process_dependencies(self):
|
||||
if not self.dependencies:
|
||||
@@ -488,11 +495,29 @@ class ArduinoLibBuilder(LibBuilderBase):
|
||||
|
||||
@property
|
||||
def src_filter(self):
|
||||
if isdir(join(self.path, "src")):
|
||||
return LibBuilderBase.src_filter.fget(self)
|
||||
src_dir = join(self.path, "src")
|
||||
if isdir(src_dir):
|
||||
src_filter = LibBuilderBase.src_filter.fget(self)
|
||||
for root, _, files in os.walk(src_dir, followlinks=True):
|
||||
found = False
|
||||
for fname in files:
|
||||
if fname.lower().endswith("asm"):
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
continue
|
||||
rel_path = root.replace(src_dir, "")
|
||||
if rel_path.startswith(sep):
|
||||
rel_path = rel_path[1:] + sep
|
||||
src_filter.append("-<%s*.[aA][sS][mM]>" % rel_path)
|
||||
return src_filter
|
||||
|
||||
src_filter = []
|
||||
is_utility = isdir(join(self.path, "utility"))
|
||||
for ext in piotool.SRC_BUILD_EXT + piotool.SRC_HEADER_EXT:
|
||||
# arduino ide ignores files with .asm or .ASM extensions
|
||||
if ext.lower() == "asm":
|
||||
continue
|
||||
src_filter.append("+<*.%s>" % ext)
|
||||
if is_utility:
|
||||
src_filter.append("+<utility%s*.%s>" % (sep, ext))
|
||||
@@ -566,6 +591,111 @@ class MbedLibBuilder(LibBuilderBase):
|
||||
def is_frameworks_compatible(self, frameworks):
|
||||
return util.items_in_list(frameworks, ["mbed"])
|
||||
|
||||
def process_extra_options(self):
|
||||
self._process_mbed_lib_confs()
|
||||
return super(MbedLibBuilder, self).process_extra_options()
|
||||
|
||||
def _process_mbed_lib_confs(self):
|
||||
mbed_lib_paths = [
|
||||
join(root, "mbed_lib.json")
|
||||
for root, _, files in os.walk(self.path)
|
||||
if "mbed_lib.json" in files
|
||||
]
|
||||
if not mbed_lib_paths:
|
||||
return None
|
||||
|
||||
mbed_config_path = None
|
||||
for p in self.env.get("CPPPATH"):
|
||||
mbed_config_path = join(self.env.subst(p), "mbed_config.h")
|
||||
if isfile(mbed_config_path):
|
||||
break
|
||||
else:
|
||||
mbed_config_path = None
|
||||
if not mbed_config_path:
|
||||
return None
|
||||
|
||||
macros = {}
|
||||
for mbed_lib_path in mbed_lib_paths:
|
||||
macros.update(self._mbed_lib_conf_parse_macros(mbed_lib_path))
|
||||
|
||||
self._mbed_conf_append_macros(mbed_config_path, macros)
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def _mbed_normalize_macro(macro):
|
||||
name = macro
|
||||
value = None
|
||||
if "=" in macro:
|
||||
name, value = macro.split("=", 1)
|
||||
return dict(name=name, value=value)
|
||||
|
||||
def _mbed_lib_conf_parse_macros(self, mbed_lib_path):
|
||||
macros = {}
|
||||
cppdefines = str(self.env.Flatten(self.env.subst("$CPPDEFINES")))
|
||||
manifest = util.load_json(mbed_lib_path)
|
||||
|
||||
# default macros
|
||||
for macro in manifest.get("macros", []):
|
||||
macro = self._mbed_normalize_macro(macro)
|
||||
macros[macro['name']] = macro
|
||||
|
||||
# configuration items
|
||||
for key, options in manifest.get("config", {}).items():
|
||||
if "value" not in options:
|
||||
continue
|
||||
macros[key] = dict(
|
||||
name=options.get("macro_name"), value=options.get("value"))
|
||||
|
||||
# overrode items per target
|
||||
for target, options in manifest.get("target_overrides", {}).items():
|
||||
if target != "*" and "TARGET_" + target not in cppdefines:
|
||||
continue
|
||||
for macro in options.get("target.macros_add", []):
|
||||
macro = self._mbed_normalize_macro(macro)
|
||||
macros[macro['name']] = macro
|
||||
for key, value in options.items():
|
||||
if not key.startswith("target.") and key in macros:
|
||||
macros[key]['value'] = value
|
||||
|
||||
# normalize macro names
|
||||
for key, macro in macros.items():
|
||||
if not macro['name']:
|
||||
macro['name'] = key
|
||||
if "." not in macro['name']:
|
||||
macro['name'] = "%s.%s" % (manifest.get("name"),
|
||||
macro['name'])
|
||||
macro['name'] = re.sub(
|
||||
r"[^a-z\d]+", "_", macro['name'], flags=re.I).upper()
|
||||
macro['name'] = "MBED_CONF_" + macro['name']
|
||||
if isinstance(macro['value'], bool):
|
||||
macro['value'] = 1 if macro['value'] else 0
|
||||
|
||||
return {macro["name"]: macro["value"] for macro in macros.values()}
|
||||
|
||||
def _mbed_conf_append_macros(self, mbed_config_path, macros):
|
||||
lines = []
|
||||
with open(mbed_config_path) as fp:
|
||||
for line in fp.readlines():
|
||||
line = line.strip()
|
||||
if line == "#endif":
|
||||
lines.append(
|
||||
"// PlatformIO Library Dependency Finder (LDF)")
|
||||
lines.extend([
|
||||
"#define %s %s" % (name,
|
||||
value if value is not None else "")
|
||||
for name, value in macros.items()
|
||||
])
|
||||
lines.append("")
|
||||
if not line.startswith("#define"):
|
||||
lines.append(line)
|
||||
continue
|
||||
tokens = line.split()
|
||||
if len(tokens) < 2 or tokens[1] not in macros:
|
||||
lines.append(line)
|
||||
lines.append("")
|
||||
with open(mbed_config_path, "w") as fp:
|
||||
fp.write("\n".join(lines))
|
||||
|
||||
|
||||
class PlatformIOLibBuilder(LibBuilderBase):
|
||||
|
||||
@@ -679,10 +809,11 @@ class ProjectAsLibBuilder(LibBuilderBase):
|
||||
return self.env.subst("$PROJECTSRC_DIR")
|
||||
|
||||
def get_include_dirs(self):
|
||||
include_dirs = LibBuilderBase.get_include_dirs(self)
|
||||
include_dirs = []
|
||||
project_include_dir = self.env.subst("$PROJECTINCLUDE_DIR")
|
||||
if isdir(project_include_dir):
|
||||
include_dirs.append(project_include_dir)
|
||||
include_dirs.extend(LibBuilderBase.get_include_dirs(self))
|
||||
return include_dirs
|
||||
|
||||
def get_search_files(self):
|
||||
@@ -750,8 +881,9 @@ class ProjectAsLibBuilder(LibBuilderBase):
|
||||
|
||||
def build(self):
|
||||
self._is_built = True # do not build Project now
|
||||
result = LibBuilderBase.build(self)
|
||||
self.env.PrependUnique(CPPPATH=self.get_include_dirs())
|
||||
return LibBuilderBase.build(self)
|
||||
return result
|
||||
|
||||
|
||||
def GetLibBuilders(env): # pylint: disable=too-many-branches
|
||||
|
||||
@@ -33,10 +33,10 @@ class InoToCPPConverter(object):
|
||||
PROTOTYPE_RE = re.compile(
|
||||
r"""^(
|
||||
(?:template\<.*\>\s*)? # template
|
||||
([a-z_\d\&]+\*?\s+){1,2} # return type
|
||||
([a-z_\d\&]+\*?\s+){1,2} # return type
|
||||
([a-z_\d]+\s*) # name of prototype
|
||||
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments
|
||||
)\s*\{ # must end with {
|
||||
)\s*(\{|;) # must end with `{` or `;`
|
||||
""", re.X | re.M | re.I)
|
||||
DETECTMAIN_RE = re.compile(r"void\s+(setup|loop)\s*\(", re.M | re.I)
|
||||
PROTOPTRS_TPLRE = r"\([^&\(]*&(%s)[^\)]*\)"
|
||||
@@ -162,7 +162,14 @@ class InoToCPPConverter(object):
|
||||
if not prototypes:
|
||||
return contents
|
||||
|
||||
prototype_names = set([m.group(3).strip() for m in prototypes])
|
||||
# skip already declared prototypes
|
||||
declared = set(
|
||||
m.group(1).strip() for m in prototypes if m.group(4) == ";")
|
||||
prototypes = [
|
||||
m for m in prototypes if m.group(1).strip() not in declared
|
||||
]
|
||||
|
||||
prototype_names = set(m.group(3).strip() for m in prototypes)
|
||||
split_pos = prototypes[0].start()
|
||||
match_ptrs = re.search(
|
||||
self.PROTOPTRS_TPLRE % ("|".join(prototype_names)),
|
||||
|
||||
@@ -95,8 +95,10 @@ def LoadPioPlatform(env, variables):
|
||||
for key, value in variables.UnknownVariables().items():
|
||||
if not key.startswith("BOARD_"):
|
||||
continue
|
||||
env.Replace(
|
||||
**{key.upper().replace("BUILD.", ""): base64.b64decode(value)})
|
||||
env.Replace(**{
|
||||
key.upper().replace("BUILD.", ""):
|
||||
base64.b64decode(value)
|
||||
})
|
||||
return
|
||||
|
||||
# update board manifest with a custom data
|
||||
|
||||
@@ -55,7 +55,6 @@ def validate_path(ctx, param, value): # pylint: disable=unused-argument
|
||||
"--build-dir",
|
||||
default=mkdtemp,
|
||||
type=click.Path(
|
||||
exists=True,
|
||||
file_okay=False,
|
||||
dir_okay=True,
|
||||
writable=True,
|
||||
@@ -73,7 +72,7 @@ def validate_path(ctx, param, value): # pylint: disable=unused-argument
|
||||
@click.option("-O", "--project-option", multiple=True)
|
||||
@click.option("-v", "--verbose", is_flag=True)
|
||||
@click.pass_context
|
||||
def cli( # pylint: disable=too-many-arguments
|
||||
def cli( # pylint: disable=too-many-arguments, too-many-branches
|
||||
ctx, src, lib, exclude, board, build_dir, keep_build_dir, project_conf,
|
||||
project_option, verbose):
|
||||
|
||||
@@ -84,7 +83,11 @@ def cli( # pylint: disable=too-many-arguments
|
||||
|
||||
try:
|
||||
app.set_session_var("force_option", True)
|
||||
_clean_dir(build_dir)
|
||||
|
||||
if not keep_build_dir and isdir(build_dir):
|
||||
util.rmtree_(build_dir)
|
||||
if not isdir(build_dir):
|
||||
makedirs(build_dir)
|
||||
|
||||
for dir_name, patterns in dict(lib=lib, src=src).items():
|
||||
if not patterns:
|
||||
@@ -116,11 +119,6 @@ def cli( # pylint: disable=too-many-arguments
|
||||
util.rmtree_(build_dir)
|
||||
|
||||
|
||||
def _clean_dir(dirpath):
|
||||
util.rmtree_(dirpath)
|
||||
makedirs(dirpath)
|
||||
|
||||
|
||||
def _copy_contents(dst_dir, contents):
|
||||
items = {"dirs": set(), "files": set()}
|
||||
|
||||
@@ -135,7 +133,8 @@ def _copy_contents(dst_dir, contents):
|
||||
if dst_dir_name == "src" and len(items['dirs']) == 1:
|
||||
copytree(list(items['dirs']).pop(), dst_dir, symlinks=True)
|
||||
else:
|
||||
makedirs(dst_dir)
|
||||
if not isdir(dst_dir):
|
||||
makedirs(dst_dir)
|
||||
for d in items['dirs']:
|
||||
copytree(d, join(dst_dir, basename(d)), symlinks=True)
|
||||
|
||||
@@ -146,7 +145,10 @@ def _copy_contents(dst_dir, contents):
|
||||
dst_dir = join(dst_dir, mkdtemp(dir=dst_dir))
|
||||
|
||||
for f in items['files']:
|
||||
copyfile(f, join(dst_dir, basename(f)))
|
||||
dst_file = join(dst_dir, basename(f))
|
||||
if f == dst_file:
|
||||
continue
|
||||
copyfile(f, dst_file)
|
||||
|
||||
|
||||
def _exclude_contents(dst_dir, patterns):
|
||||
|
||||
@@ -365,8 +365,8 @@ def platform_update(platforms, only_packages, only_check, json_output):
|
||||
if not pkg_dir:
|
||||
continue
|
||||
latest = pm.outdated(pkg_dir, requirements)
|
||||
if (not latest and not PlatformFactory.newPlatform(pkg_dir).
|
||||
are_outdated_packages()):
|
||||
if (not latest and not PlatformFactory.newPlatform(
|
||||
pkg_dir).are_outdated_packages()):
|
||||
continue
|
||||
data = _get_installed_platform_data(
|
||||
pkg_dir, with_boards=False, expose_packages=False)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath
|
||||
|
||||
import bottle
|
||||
@@ -146,7 +147,8 @@ class ProjectGenerator(object):
|
||||
"project_libdeps_dir": util.get_projectlibdeps_dir(),
|
||||
"systype": util.get_systype(),
|
||||
"platformio_path": self._fix_os_path(
|
||||
util.where_is_program("platformio")),
|
||||
sys.argv[0] if isfile(sys.argv[0])
|
||||
else util.where_is_program("platformio")),
|
||||
"env_pathsep": os.pathsep,
|
||||
"env_path": self._fix_os_path(os.getenv("PATH"))
|
||||
}) # yapf: disable
|
||||
|
||||
@@ -9,6 +9,12 @@ add_custom_target(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
PLATFORMIO_BUILD_VERBOSE ALL
|
||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --verbose
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
PLATFORMIO_UPLOAD ALL
|
||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
|
||||
@@ -21,6 +27,12 @@ add_custom_target(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
PLATFORMIO_MONITOR ALL
|
||||
COMMAND ${PLATFORMIO_CMD} -f -c clion device monitor
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
PLATFORMIO_TEST ALL
|
||||
COMMAND ${PLATFORMIO_CMD} -f -c clion test
|
||||
|
||||
@@ -1,8 +1,24 @@
|
||||
set(ENV{PATH} "{{env_path}}")
|
||||
set(PLATFORMIO_CMD "{{platformio_path}}")
|
||||
# !!! WARNING !!!
|
||||
# PLEASE DO NOT MODIFY THIS FILE!
|
||||
# USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
|
||||
|
||||
SET(CMAKE_C_COMPILER "{{cc_path.replace("\\", "/")}}")
|
||||
SET(CMAKE_CXX_COMPILER "{{cxx_path.replace("\\", "/")}}")
|
||||
% def _normalize_path(path):
|
||||
% if project_dir in path:
|
||||
% path = path.replace(project_dir, "${CMAKE_CURRENT_LIST_DIR}")
|
||||
% elif user_home_dir in path:
|
||||
% if "windows" in systype:
|
||||
% path = path.replace(user_home_dir, "$ENV{HOMEDRIVE}$ENV{HOMEPATH}")
|
||||
% else:
|
||||
% path = path.replace(user_home_dir, "$ENV{HOME}")
|
||||
% end
|
||||
% end
|
||||
% return path.replace("\\", "/")
|
||||
% end
|
||||
|
||||
set(PLATFORMIO_CMD "{{ _normalize_path(platformio_path) }}")
|
||||
|
||||
SET(CMAKE_C_COMPILER "{{ _normalize_path(cc_path) }}")
|
||||
SET(CMAKE_CXX_COMPILER "{{ _normalize_path(cxx_path) }}")
|
||||
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "{{cxx_flags}}")
|
||||
SET(CMAKE_C_FLAGS_DISTRIBUTION "{{cc_flags}}")
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
@@ -13,15 +29,7 @@ add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
|
||||
% end
|
||||
|
||||
% for include in includes:
|
||||
% if include.startswith(user_home_dir):
|
||||
% if "windows" in systype:
|
||||
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
||||
% else:
|
||||
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
||||
% end
|
||||
% else:
|
||||
include_directories("{{include.replace("\\", "/")}}")
|
||||
% end
|
||||
include_directories("{{ _normalize_path(include) }}")
|
||||
% end
|
||||
|
||||
FILE(GLOB_RECURSE SRC_LIST "{{project_src_dir.replace("\\", "/")}}/*.*" "{{project_lib_dir.replace("\\", "/")}}/*.*" "{{project_libdeps_dir.replace("\\", "/")}}/*.*")
|
||||
FILE(GLOB_RECURSE SRC_LIST "{{ _normalize_path(project_src_dir) }}/*.*" "{{ _normalize_path(project_lib_dir) }}/*.*" "{{ _normalize_path(project_libdeps_dir) }}/*.*")
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
% import re
|
||||
% STD_RE = re.compile(r"(\-std=[a-z\+]+\d+)")
|
||||
% cxx_stds = STD_RE.findall(cxx_flags)
|
||||
% cxx_std = cxx_stds[-1] if cxx_stds else ""
|
||||
%
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="0.910961921" name="Default">
|
||||
@@ -6,9 +11,9 @@
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
% if "windows" in systype:
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
% else:
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
% end
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
@@ -21,9 +26,9 @@
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
% if "windows" in systype:
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
% else:
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
% end
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
% for include in includes:
|
||||
-I"{{include}}"
|
||||
-I{{include}}
|
||||
% end
|
||||
% for define in defines:
|
||||
-D{{!define}}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"run"
|
||||
],
|
||||
@@ -14,7 +14,7 @@
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"run"
|
||||
],
|
||||
@@ -23,27 +23,7 @@
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"-f", "-c", "sublimetext",
|
||||
"run",
|
||||
"--target",
|
||||
"clean"
|
||||
],
|
||||
"name": "Clean"
|
||||
},
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"-f", "-c", "sublimetext",
|
||||
"test"
|
||||
],
|
||||
"name": "Test"
|
||||
},
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"run",
|
||||
"--target",
|
||||
@@ -54,7 +34,27 @@
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"run",
|
||||
"--target",
|
||||
"clean"
|
||||
],
|
||||
"name": "Clean"
|
||||
},
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"test"
|
||||
],
|
||||
"name": "Test"
|
||||
},
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"run",
|
||||
"--target",
|
||||
@@ -65,7 +65,7 @@
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"run",
|
||||
"--target",
|
||||
@@ -76,16 +76,24 @@
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"update"
|
||||
],
|
||||
"name": "Update platforms and libraries"
|
||||
},
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"{{ platformio_path }}",
|
||||
"-f", "-c", "sublimetext",
|
||||
"upgrade"
|
||||
],
|
||||
"name": "Upgrade PlatformIO Core"
|
||||
}
|
||||
],
|
||||
"working_dir": "${project_path:${folder}}",
|
||||
"selector": "source.c, source.c++",
|
||||
"path": "{{env_path}}"
|
||||
"selector": "source.c, source.c++"
|
||||
}
|
||||
],
|
||||
"folders":
|
||||
@@ -98,7 +106,7 @@
|
||||
{
|
||||
"sublimegdb_workingdir": "{{project_dir}}",
|
||||
"sublimegdb_exec_cmd": "",
|
||||
"sublimegdb_commandline": "{{platformio_path}} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit"
|
||||
"sublimegdb_commandline": "{{ platformio_path }} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"!!! WARNING !!!": "PLEASE DO NOT MODIFY THIS FILE! USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
|
||||
},
|
||||
{
|
||||
% import platform
|
||||
% from os.path import commonprefix, dirname
|
||||
%
|
||||
@@ -54,13 +56,16 @@
|
||||
% cc_stds = STD_RE.findall(cc_flags)
|
||||
% cxx_stds = STD_RE.findall(cxx_flags)
|
||||
%
|
||||
% # pass only architecture specific flags
|
||||
% cc_m_flags = " ".join([f.strip() for f in cc_flags.split(" ") if f.strip().startswith("-m")])
|
||||
%
|
||||
% if cc_stds:
|
||||
"cStandard": "c{{ cc_stds[-1] }}",
|
||||
% end
|
||||
% if cxx_stds:
|
||||
"cppStandard": "c++{{ cxx_stds[-1] }}",
|
||||
% end
|
||||
"compilerPath": "{{! _escape(cc_path) }} {{! _escape(STD_RE.sub("", cc_flags)) }}"
|
||||
"compilerPath": "{{! _escape(cc_path) }} {{! _escape(cc_m_flags) }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -106,9 +106,10 @@ def update_core_packages(only_check=False, silent=False):
|
||||
|
||||
def shutdown_piohome_servers():
|
||||
port = 8010
|
||||
while port < 8100:
|
||||
while port < 8050:
|
||||
try:
|
||||
requests.get("http://127.0.0.1:%d?__shutdown__=1" % port)
|
||||
requests.get(
|
||||
"http://127.0.0.1:%d?__shutdown__=1" % port, timeout=0.01)
|
||||
except: # pylint: disable=bare-except
|
||||
pass
|
||||
port += 1
|
||||
|
||||
@@ -460,8 +460,7 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
||||
self._manifest = util.load_json(manifest_path)
|
||||
|
||||
self.pm = PackageManager(
|
||||
join(util.get_home_dir(), "packages"),
|
||||
self._manifest.get("packageRepositories"))
|
||||
join(util.get_home_dir(), "packages"), self.package_repositories)
|
||||
|
||||
self.silent = False
|
||||
self.verbose = False
|
||||
@@ -516,6 +515,10 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
||||
def engines(self):
|
||||
return self._manifest.get("engines")
|
||||
|
||||
@property
|
||||
def package_repositories(self):
|
||||
return self._manifest.get("packageRepositories")
|
||||
|
||||
@property
|
||||
def manifest(self):
|
||||
return self._manifest
|
||||
@@ -630,10 +633,8 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
||||
if not isdir(libcore_dir):
|
||||
continue
|
||||
storages.append({
|
||||
"name":
|
||||
"%s-core-%s" % (opts['package'], item),
|
||||
"path":
|
||||
libcore_dir
|
||||
"name": "%s-core-%s" % (opts['package'], item),
|
||||
"path": libcore_dir
|
||||
})
|
||||
|
||||
return storages
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from os import chmod
|
||||
from os.path import exists, islink, join
|
||||
from os.path import exists, join
|
||||
from tarfile import open as tarfile_open
|
||||
from time import mktime
|
||||
from zipfile import ZipFile
|
||||
@@ -56,6 +56,10 @@ class TARArchive(ArchiveBase):
|
||||
def get_item_filename(self, item):
|
||||
return item.name
|
||||
|
||||
@staticmethod
|
||||
def islink(item):
|
||||
return item.islnk() or item.issym()
|
||||
|
||||
|
||||
class ZIPArchive(ArchiveBase):
|
||||
|
||||
@@ -80,6 +84,9 @@ class ZIPArchive(ArchiveBase):
|
||||
def get_item_filename(self, item):
|
||||
return item.filename
|
||||
|
||||
def islink(self, item):
|
||||
raise NotImplementedError()
|
||||
|
||||
def after_extract(self, item, dest_dir):
|
||||
self.preserve_permissions(item, dest_dir)
|
||||
self.preserve_mtime(item, dest_dir)
|
||||
@@ -120,7 +127,9 @@ class FileUnpacker(object):
|
||||
for item in self._unpacker.get_items():
|
||||
filename = self._unpacker.get_item_filename(item)
|
||||
item_path = join(dest_dir, filename)
|
||||
if not islink(item_path) and not exists(item_path):
|
||||
raise exception.ExtractArchiveItemError(filename, dest_dir)
|
||||
|
||||
try:
|
||||
if not self._unpacker.islink(item) and not exists(item_path):
|
||||
raise exception.ExtractArchiveItemError(filename, dest_dir)
|
||||
except NotImplementedError:
|
||||
pass
|
||||
return True
|
||||
|
||||
@@ -203,28 +203,34 @@ def pioversion_to_intstr():
|
||||
|
||||
|
||||
def get_project_optional_dir(name, default=None):
|
||||
data = None
|
||||
paths = None
|
||||
var_name = "PLATFORMIO_%s" % name.upper()
|
||||
if var_name in os.environ:
|
||||
data = os.getenv(var_name)
|
||||
paths = os.getenv(var_name)
|
||||
else:
|
||||
try:
|
||||
config = load_project_config()
|
||||
if (config.has_section("platformio")
|
||||
and config.has_option("platformio", name)):
|
||||
data = config.get("platformio", name)
|
||||
paths = config.get("platformio", name)
|
||||
except exception.NotPlatformIOProject:
|
||||
pass
|
||||
|
||||
if not data:
|
||||
if not paths:
|
||||
return default
|
||||
|
||||
items = []
|
||||
for item in data.split(", "):
|
||||
for item in paths.split(", "):
|
||||
if item.startswith("~"):
|
||||
item = expanduser(item)
|
||||
items.append(abspath(item))
|
||||
return ", ".join(items)
|
||||
paths = ", ".join(items)
|
||||
|
||||
while "$PROJECT_HASH" in paths:
|
||||
paths = paths.replace("$PROJECT_HASH",
|
||||
sha1(get_project_dir()).hexdigest()[:10])
|
||||
|
||||
return paths
|
||||
|
||||
|
||||
def get_home_dir():
|
||||
@@ -314,9 +320,6 @@ def get_projectboards_dir():
|
||||
def get_projectbuild_dir(force=False):
|
||||
path = get_project_optional_dir("build_dir",
|
||||
join(get_project_dir(), ".pioenvs"))
|
||||
if "$PROJECT_HASH" in path:
|
||||
path = path.replace("$PROJECT_HASH",
|
||||
sha1(get_project_dir()).hexdigest()[:10])
|
||||
try:
|
||||
if not isdir(path):
|
||||
os.makedirs(path)
|
||||
@@ -565,16 +568,11 @@ def get_mdns_services():
|
||||
pass
|
||||
|
||||
items.append({
|
||||
"type":
|
||||
service.type,
|
||||
"name":
|
||||
service.name,
|
||||
"ip":
|
||||
".".join([str(ord(c)) for c in service.address]),
|
||||
"port":
|
||||
service.port,
|
||||
"properties":
|
||||
properties
|
||||
"type": service.type,
|
||||
"name": service.name,
|
||||
"ip": ".".join([str(ord(c)) for c in service.address]),
|
||||
"port": service.port,
|
||||
"properties": properties
|
||||
})
|
||||
return items
|
||||
|
||||
@@ -682,7 +680,7 @@ def get_api_result(url, params=None, data=None, auth=None, cache_valid=None):
|
||||
|
||||
PING_INTERNET_IPS = [
|
||||
"192.30.253.113", # github.com
|
||||
"159.122.18.156", # dl.bintray.com
|
||||
"18.195.111.75", # dl.bintray.com
|
||||
"193.222.52.25" # dl.platformio.org
|
||||
]
|
||||
|
||||
@@ -794,17 +792,20 @@ def merge_dicts(d1, d2, path=None):
|
||||
return d1
|
||||
|
||||
|
||||
def get_file_contents(path):
|
||||
try:
|
||||
with open(path) as f:
|
||||
return f.read()
|
||||
except UnicodeDecodeError:
|
||||
with open(path, encoding="latin-1") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def ensure_udev_rules():
|
||||
|
||||
def _rules_to_set(rules_path):
|
||||
result = set([])
|
||||
with open(rules_path, "rb") as fp:
|
||||
for line in fp.readlines():
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
result.add(line)
|
||||
return result
|
||||
return set(l.strip() for l in get_file_contents(rules_path).split("\n")
|
||||
if l.strip() and not l.startswith("#"))
|
||||
|
||||
if "linux" not in get_systype():
|
||||
return None
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from os.path import join
|
||||
from os.path import isfile, join
|
||||
|
||||
from platformio.commands.ci import cli as cmd_ci
|
||||
from platformio.commands.lib import cli as cmd_lib
|
||||
@@ -32,6 +32,36 @@ def test_ci_boards(clirunner, validate_cliresult):
|
||||
validate_cliresult(result)
|
||||
|
||||
|
||||
def test_ci_build_dir(clirunner, tmpdir_factory, validate_cliresult):
|
||||
build_dir = str(tmpdir_factory.mktemp("ci_build_dir"))
|
||||
result = clirunner.invoke(cmd_ci, [
|
||||
join("examples", "wiring-blink", "src", "main.cpp"), "-b", "uno",
|
||||
"--build-dir", build_dir
|
||||
])
|
||||
validate_cliresult(result)
|
||||
assert not isfile(join(build_dir, "platformio.ini"))
|
||||
|
||||
|
||||
def test_ci_keep_build_dir(clirunner, tmpdir_factory, validate_cliresult):
|
||||
build_dir = str(tmpdir_factory.mktemp("ci_build_dir"))
|
||||
result = clirunner.invoke(cmd_ci, [
|
||||
join("examples", "wiring-blink", "src", "main.cpp"), "-b", "uno",
|
||||
"--build-dir", build_dir, "--keep-build-dir"
|
||||
])
|
||||
validate_cliresult(result)
|
||||
assert isfile(join(build_dir, "platformio.ini"))
|
||||
|
||||
# 2nd attempt
|
||||
result = clirunner.invoke(cmd_ci, [
|
||||
join("examples", "wiring-blink", "src", "main.cpp"), "-b", "metro",
|
||||
"--build-dir", build_dir, "--keep-build-dir"
|
||||
])
|
||||
validate_cliresult(result)
|
||||
|
||||
assert "board: uno" in result.output
|
||||
assert "board: metro" in result.output
|
||||
|
||||
|
||||
def test_ci_project_conf(clirunner, validate_cliresult):
|
||||
project_dir = join("examples", "wiring-blink")
|
||||
result = clirunner.invoke(cmd_ci, [
|
||||
|
||||
@@ -170,7 +170,7 @@ def test_global_lib_list(clirunner, validate_cliresult):
|
||||
]
|
||||
versions2 = [
|
||||
'ArduinoJson@5.8.2', 'ArduinoJson@5.10.1', 'AsyncMqttClient@0.8.2',
|
||||
'AsyncTCP@1.0.1', 'NeoPixelBus@2.2.4', 'PJON@07fe9aa', 'PJON@1fb26fd',
|
||||
'NeoPixelBus@2.2.4', 'PJON@07fe9aa', 'PJON@1fb26fd',
|
||||
'PubSubClient@bef5814', 'RFcontrol@77d4eb3f8a', 'RadioHead-1.62@0.0.0'
|
||||
]
|
||||
assert set(versions1) >= set(versions2)
|
||||
|
||||
@@ -49,4 +49,12 @@ void fooCallback(){
|
||||
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void some_extern(const char *fmt, ...);
|
||||
};
|
||||
|
||||
void some_extern(const char *fmt, ...) {
|
||||
|
||||
}
|
||||
|
||||
// юнікод
|
||||
|
||||
@@ -37,7 +37,8 @@ def pytest_generate_tests(metafunc):
|
||||
if not p.is_embedded():
|
||||
continue
|
||||
# issue with "version `CXXABI_1.3.9' not found (required by sdcc)"
|
||||
if "linux" in util.get_systype() and p.name == "intel_mcs51":
|
||||
if "linux" in util.get_systype() and p.name in ("intel_mcs51",
|
||||
"ststm8"):
|
||||
continue
|
||||
examples_dir = join(p.get_dir(), "examples")
|
||||
assert isdir(examples_dir)
|
||||
|
||||
Reference in New Issue
Block a user