diff --git a/HISTORY.rst b/HISTORY.rst index d5f4f19a..34bddd26 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,9 +7,11 @@ PlatformIO 3.0 3.5.5 (2018-??-??) ~~~~~~~~~~~~~~~~~~ -* Fixed `PIO Unit Testing `__ - issue with a shared code between main and test programs when ``UNIT_TEST`` - macro was not set in a build environment +* `PIO Unit Testing `__: + + - Documented `Project Shared Code `__ + - Force building of project source code using `test_build_project_src `__ option + - Fixed missed ``UNIT_TEST`` macro for unit test components/libraries 3.5.4 (2018-07-03) ~~~~~~~~~~~~~~~~~~ diff --git a/docs b/docs index a77ecd12..e2505d2f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a77ecd12952ff66b799357d505e9a09c24a4a5ec +Subproject commit e2505d2fa9af757f9984417edae98c271e1c52ee diff --git a/examples b/examples index 8e11abaa..965ab1cb 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 8e11abaafcfac758252f1df820d694a873e09e36 +Subproject commit 965ab1cb2852d06b652b49944830d2f81d563db1 diff --git a/platformio/builder/main.py b/platformio/builder/main.py index caafda5b..79732f1c 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -68,6 +68,9 @@ commonvars.AddVariables( ("UPLOAD_FLAGS",), ("UPLOAD_RESETMETHOD",), + # test options + ("TEST_BUILD_PROJECT_SRC",), + # debug options ("DEBUG_TOOL",), ("DEBUG_SVD_PATH",), @@ -76,7 +79,8 @@ commonvars.AddVariables( MULTILINE_VARS = [ "EXTRA_SCRIPTS", "PIOFRAMEWORK", "BUILD_FLAGS", "SRC_BUILD_FLAGS", - "BUILD_UNFLAGS", "SRC_FILTER", "LIB_DEPS", "LIB_IGNORE", "LIB_EXTRA_DIRS" + "BUILD_UNFLAGS", "UPLOAD_FLAGS", "SRC_FILTER", "LIB_DEPS", "LIB_IGNORE", + "LIB_EXTRA_DIRS" ] DEFAULT_ENV_OPTIONS = dict( diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index ab4cd9ec..d880d386 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -61,10 +61,11 @@ def _build_project_deps(env): # extra build flags from `platformio.ini` projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS")) - if "__test" in COMMAND_LINE_TARGETS: + is_test = "__test" in COMMAND_LINE_TARGETS + if is_test: projenv.BuildSources("$BUILDTEST_DIR", "$PROJECTTEST_DIR", "$PIOTEST_SRC_FILTER") - else: + if not is_test or env['TEST_BUILD_PROJECT_SRC'] == "true": projenv.BuildSources("$BUILDSRC_DIR", "$PROJECTSRC_DIR", env.get("SRC_FILTER")) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index c61dbc06..4bb74482 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -125,32 +125,33 @@ class EnvironmentProcessor(object): DEFAULT_DUMP_OPTIONS = ("platform", "framework", "board") - KNOWN_PLATFORMIO_OPTIONS = ("description", "env_default", "home_dir", - "lib_dir", "libdeps_dir", "include_dir", - "src_dir", "build_dir", "data_dir", "test_dir", - "boards_dir", "lib_extra_dirs") + KNOWN_PLATFORMIO_OPTIONS = [ + "description", "env_default", "home_dir", "lib_dir", "libdeps_dir", + "include_dir", "src_dir", "build_dir", "data_dir", "test_dir", + "boards_dir", "lib_extra_dirs" + ] - KNOWN_ENV_OPTIONS = ("platform", "framework", "board", "build_flags", - "src_build_flags", "build_unflags", "src_filter", - "extra_scripts", "targets", "upload_port", - "upload_protocol", "upload_speed", "upload_flags", - "upload_resetmethod", "lib_deps", "lib_ignore", - "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "lib_archive", "piotest", "test_transport", - "test_filter", "test_ignore", "test_port", - "test_speed", "debug_tool", "debug_port", - "debug_init_cmds", "debug_extra_cmds", "debug_server", - "debug_init_break", "debug_load_cmd", - "debug_load_mode", "debug_svd_path", "monitor_port", - "monitor_speed", "monitor_rts", "monitor_dtr") + KNOWN_ENV_OPTIONS = [ + "platform", "framework", "board", "build_flags", "src_build_flags", + "build_unflags", "src_filter", "extra_scripts", "targets", + "upload_port", "upload_protocol", "upload_speed", "upload_flags", + "upload_resetmethod", "lib_deps", "lib_ignore", "lib_extra_dirs", + "lib_ldf_mode", "lib_compat_mode", "lib_archive", "piotest", + "test_transport", "test_filter", "test_ignore", "test_port", + "test_speed", "test_build_project_src", "debug_tool", "debug_port", + "debug_init_cmds", "debug_extra_cmds", "debug_server", + "debug_init_break", "debug_load_cmd", "debug_load_mode", + "debug_svd_path", "monitor_port", "monitor_speed", "monitor_rts", + "monitor_dtr" + ] - IGNORE_BUILD_OPTIONS = ("test_transport", "test_filter", "test_ignore", - "test_port", "test_speed", "debug_port", - "debug_init_cmds", "debug_extra_cmds", - "debug_server", "debug_init_break", - "debug_load_cmd", "debug_load_mode", - "monitor_port", "monitor_speed", "monitor_rts", - "monitor_dtr") + IGNORE_BUILD_OPTIONS = [ + "test_transport", "test_filter", "test_ignore", "test_port", + "test_speed", "debug_port", "debug_init_cmds", "debug_extra_cmds", + "debug_server", "debug_init_break", "debug_load_cmd", + "debug_load_mode", "monitor_port", "monitor_speed", "monitor_rts", + "monitor_dtr" + ] REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"}