Shared cache directory for the build derived files // Resolve #2674

This commit is contained in:
Ivan Kravets
2019-06-15 18:53:13 +03:00
parent bd8ba738cf
commit fbdfe31f17
5 changed files with 14 additions and 3 deletions

View File

@ -39,6 +39,7 @@ PlatformIO 4.0
- Print platform package details, such as version, VSC source and commit (`issue #2155 <https://github.com/platformio/platformio-core/issues/2155>`_)
- 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 development platform upload command with a custom `upload_command <http://docs.platformio.org/page/projectconf/section_env_upload.html#upload-command>`__ (`issue #2599 <https://github.com/platformio/platformio-core/issues/2599>`_)
- Configure a shared folder for the derived files (objects, firmwares, ELFs) from a build system using `build_cache_dir <http://docs.platformio.org/page/projectconf/section_platformio.html#build-cache-dir>`__ option (`issue #2674 <https://github.com/platformio/platformio-core/issues/2674>`_)
- Fixed an issue when ``-U`` in ``build_flags`` does not remove macro previously defined via ``-D`` flag (`issue #2508 <https://github.com/platformio/platformio-core/issues/2508>`_)
* **Infrastructure**

2
docs

Submodule docs updated: 668c8b0d89...6ca558b253

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from os import environ
from os.path import join
from os import environ, makedirs
from os.path import isdir, join
from time import time
import click
@ -67,6 +67,7 @@ DEFAULT_ENV_OPTIONS = dict(
PROJECTTEST_DIR=project_helpers.get_project_test_dir(),
PROJECTDATA_DIR=project_helpers.get_project_data_dir(),
PROJECTBUILD_DIR=project_helpers.get_project_build_dir(),
BUILDCACHE_DIR=project_helpers.get_project_optional_dir("build_cache_dir"),
BUILD_DIR=join("$PROJECTBUILD_DIR", "$PIOENV"),
BUILDSRC_DIR=join("$BUILD_DIR", "src"),
BUILDTEST_DIR=join("$BUILD_DIR", "test"),
@ -96,6 +97,11 @@ env.Replace(
for key in list(clivars.keys()) if key in env
})
if env.subst("$BUILDCACHE_DIR"):
if not isdir(env.subst("$BUILDCACHE_DIR")):
makedirs(env.subst("$BUILDCACHE_DIR"))
env.CacheDir("$BUILDCACHE_DIR")
if int(ARGUMENTS.get("ISATTY", 0)):
# pylint: disable=protected-access
click._compat.isatty = lambda stream: True

View File

@ -210,6 +210,8 @@ def _delete_file(path):
@util.memoized()
def _get_compiler_type(env):
if env.subst("$CC").endswith("-gcc"):
return "gcc"
try:
sysenv = environ.copy()
sysenv['PATH'] = str(env['ENV']['PATH'])

View File

@ -66,6 +66,8 @@ ProjectOptions = OrderedDict([
sysenvvar="PLATFORMIO_PACKAGES_DIR"),
ConfigPlatformioOption(name="cache_dir",
sysenvvar="PLATFORMIO_CACHE_DIR"),
ConfigPlatformioOption(name="build_cache_dir",
sysenvvar="PLATFORMIO_BUILD_CACHE_DIR"),
ConfigPlatformioOption(name="workspace_dir",
sysenvvar="PLATFORMIO_WORKSPACE_DIR"),
ConfigPlatformioOption(name="build_dir",