Implement unified project workspace storage ".pio" // Resolve #1778

This commit is contained in:
Ivan Kravets
2019-05-20 17:01:54 +03:00
parent 774380c2ef
commit 5fe4de626b
14 changed files with 47 additions and 38 deletions

View File

@ -7,20 +7,24 @@ PlatformIO 4.0
4.0.0 (2019-??-??)
~~~~~~~~~~~~~~~~~~
* Python 3 support
(`issue #895 <https://github.com/platformio/platformio-core/issues/895>`_)
* Share common (global) options between declared build environments using ``[env]`` section in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__
(`issue #1643 <https://github.com/platformio/platformio-core/issues/1643>`_)
* Include external configuration files in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with `extra_configs <http://docs.platformio.org/page/projectconf/section_platformio.html#extra-configs>`__ option
(`issue #1590 <https://github.com/platformio/platformio-core/issues/1590>`_)
* Override default `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with a custom using ``-c, --project-conf`` option for `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__, `platformio debug <http://docs.platformio.org/page/userguide/cmd_debug.html>`__, or `platformio test <http://docs.platformio.org/page/userguide/cmd_test.html>`__ commands
(`issue #1913 <https://github.com/platformio/platformio-core/issues/1913>`_)
* Override default source and include directories for a library via `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__ manifest using ``includeDir`` and ``srcDir`` fields
* Added support for the latest Python "Click" package (CLI Builder)
(`issue #349 <https://github.com/platformio/platformio-core/issues/349>`_)
* Deprecated ``--only-check`` PlatformIO Core CLI option for "update" sub-commands, please use ``--dry-run`` instead
* Removed line-buffering from `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__ command which was leading to omitting progress bar from upload tools
(`issue #856 <https://github.com/platformio/platformio-core/issues/856>`_)
* **PlatformIO-based Project**
- Implemented unified project workspace storage (`workspace_dir <http://docs.platformio.org/page/projectconf/section_platformio.html#workspace-dir>`__ -> ``.pio``) for PlatformIO Build System, Library Dependency Finder, and other internal services (`issue #1778 <https://github.com/platformio/platformio-core/issues/1778>`_)
- Moved ``.pioenvs`` build directory to workspace storage ``.pio/build``
- Share common (global) options between build environments using ``[env]`` section in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ (`issue #1643 <https://github.com/platformio/platformio-core/issues/1643>`_)
- Include external configuration files in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with `extra_configs <http://docs.platformio.org/page/projectconf/section_platformio.html#extra-configs>`__ option (`issue #1590 <https://github.com/platformio/platformio-core/issues/1590>`_)
- Override default `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with a custom using ``-c, --project-conf`` option for `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__, `platformio debug <http://docs.platformio.org/page/userguide/cmd_debug.html>`__, or `platformio test <http://docs.platformio.org/page/userguide/cmd_test.html>`__ commands (`issue #1913 <https://github.com/platformio/platformio-core/issues/1913>`_)
* **Infrastructure**
- Python 3 support (`issue #895 <https://github.com/platformio/platformio-core/issues/895>`_)
- Added support for the latest Python "Click" package (CLI) (`issue #349 <https://github.com/platformio/platformio-core/issues/349>`_)
- Removed line-buffering from `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__ command which was leading to omitting progress bar from upload tools (`issue #856 <https://github.com/platformio/platformio-core/issues/856>`_)
* **Miscellaneous**
- Override default source and include directories for a library via `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__ manifest using ``includeDir`` and ``srcDir`` fields
- Deprecated ``--only-check`` PlatformIO Core CLI option for "update" sub-commands, please use ``--dry-run`` instead
PlatformIO 3.0
--------------

2
docs

Submodule docs updated: 6e0004755a...c7591d260b

View File

@ -34,7 +34,8 @@ from platformio.proc import get_pythonexe_path
from platformio.project.helpers import (
get_project_dir, get_project_optional_dir, get_projectbuild_dir,
get_projectdata_dir, get_projectinclude_dir, get_projectlib_dir,
get_projectlibdeps_dir, get_projectsrc_dir, get_projecttest_dir)
get_projectlibdeps_dir, get_projectsrc_dir, get_projecttest_dir,
get_projectworkspace_dir)
AllowSubstExceptions(NameError)
@ -108,6 +109,7 @@ DEFAULT_ENV_OPTIONS = dict(
UNIX_TIME=int(time()),
PIOHOME_DIR=util.get_home_dir(),
PROJECT_DIR=get_project_dir(),
PROJECTWORKSPACE_DIR=get_projectworkspace_dir(),
PROJECTINCLUDE_DIR=get_projectinclude_dir(),
PROJECTSRC_DIR=get_projectsrc_dir(),
PROJECTTEST_DIR=get_projecttest_dir(),

View File

@ -359,7 +359,7 @@ def init_cvs_ignore(project_dir):
if isfile(conf_path):
return
with open(conf_path, "w") as fp:
fp.writelines([".pio\n", ".pioenvs\n", ".piolibdeps\n"])
fp.writelines([".pio\n", ".piolibdeps\n"])
def fill_project_envs(ctx, project_dir, board_ids, project_option, env_prefix,

View File

@ -263,6 +263,11 @@ def _autoinstall_libdeps(ctx, libraries, verbose=False):
def _clean_build_dir(build_dir):
# remove legacy ".pioenvs" folder
legacy_build_dir = join(get_project_dir(), ".pioenvs")
if isdir(legacy_build_dir) and legacy_build_dir != build_dir:
util.rmtree_(legacy_build_dir)
structhash_file = join(build_dir, "structure.hash")
proj_hash = calculate_project_hash()

View File

@ -1,5 +1,4 @@
.pio
.pioenvs
.piolibdeps
.clang_complete
.gcc-flags.json

View File

@ -1,4 +1,3 @@
.pio
.pioenvs
.piolibdeps
CMakeListsPrivate.txt

View File

@ -12,8 +12,5 @@
<excludeRoots>
<file path="$PROJECT_DIR$/.pio" />
</excludeRoots>
<excludeRoots>
<file path="$PROJECT_DIR$/.pioenvs" />
</excludeRoots>
</component>
</project>

View File

@ -1,4 +1,3 @@
.pio
.pioenvs
.piolibdeps
.clang_complete

View File

@ -11,7 +11,7 @@
<itemPath>nbproject/private/launcher.properties</itemPath>
</logicalFolder>
</logicalFolder>
<sourceFolderFilter>^(nbproject|.pio|.pioenvs)$</sourceFolderFilter>
<sourceFolderFilter>^(nbproject|.pio)$</sourceFolderFilter>
<sourceRootList>
<Elem>.</Elem>
</sourceRootList>

View File

@ -1,5 +1,4 @@
.pio
.pioenvs
.piolibdeps
.clang_complete
.gcc-flags.json

View File

@ -1,5 +1,4 @@
.pio
.pioenvs
.piolibdeps
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json

View File

@ -46,6 +46,7 @@ KNOWN_PLATFORMIO_OPTIONS = [
# Dirs
"home_dir",
"workspace_dir",
"lib_dir",
"libdeps_dir",
"include_dir",

View File

@ -73,6 +73,23 @@ def get_project_optional_dir(name, default=None):
return paths
def get_projectworkspace_dir():
return get_project_optional_dir("workspace_dir",
join(get_project_dir(), ".pio"))
def get_projectbuild_dir(force=False):
path = get_project_optional_dir("build_dir",
join(get_projectworkspace_dir(), "build"))
try:
if not isdir(path):
os.makedirs(path)
except Exception as e: # pylint: disable=broad-except
if not force:
raise Exception(e)
return path
def get_projectlib_dir():
return get_project_optional_dir("lib_dir", join(get_project_dir(), "lib"))
@ -101,18 +118,6 @@ def get_projectboards_dir():
join(get_project_dir(), "boards"))
def get_projectbuild_dir(force=False):
path = get_project_optional_dir("build_dir",
join(get_project_dir(), ".pioenvs"))
try:
if not isdir(path):
os.makedirs(path)
except Exception as e: # pylint: disable=broad-except
if not force:
raise Exception(e)
return path
def get_projectdata_dir():
return get_project_optional_dir("data_dir", join(get_project_dir(),
"data"))