mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Minor improvements
This commit is contained in:
@ -111,7 +111,7 @@ class LibBuilderFactory(object):
|
||||
return []
|
||||
|
||||
|
||||
class LibBuilderBase(object):
|
||||
class LibBuilderBase:
|
||||
|
||||
CLASSIC_SCANNER = SCons.Scanner.C.CScanner()
|
||||
CCONDITIONAL_SCANNER = SCons.Scanner.C.CConditionalScanner()
|
||||
@ -514,7 +514,7 @@ class ArduinoLibBuilder(LibBuilderBase):
|
||||
return os.path.join(self.path, "include")
|
||||
|
||||
def get_include_dirs(self):
|
||||
include_dirs = LibBuilderBase.get_include_dirs(self)
|
||||
include_dirs = super().get_include_dirs()
|
||||
if os.path.isdir(os.path.join(self.path, "src")):
|
||||
return include_dirs
|
||||
if os.path.isdir(os.path.join(self.path, "utility")):
|
||||
@ -612,7 +612,7 @@ class MbedLibBuilder(LibBuilderBase):
|
||||
return LibBuilderBase.src_dir.fget(self) # pylint: disable=no-member
|
||||
|
||||
def get_include_dirs(self):
|
||||
include_dirs = LibBuilderBase.get_include_dirs(self)
|
||||
include_dirs = super().get_include_dirs()
|
||||
if self.path not in include_dirs:
|
||||
include_dirs.append(self.path)
|
||||
|
||||
@ -833,7 +833,7 @@ class PlatformIOLibBuilder(LibBuilderBase):
|
||||
return util.items_in_list(frameworks, self._manifest.get("frameworks") or ["*"])
|
||||
|
||||
def get_include_dirs(self):
|
||||
include_dirs = LibBuilderBase.get_include_dirs(self)
|
||||
include_dirs = super().get_include_dirs()
|
||||
|
||||
# backwards compatibility with PlatformIO 2.0
|
||||
if (
|
||||
@ -872,14 +872,14 @@ class ProjectAsLibBuilder(LibBuilderBase):
|
||||
project_include_dir = self.env.subst("$PROJECT_INCLUDE_DIR")
|
||||
if os.path.isdir(project_include_dir):
|
||||
include_dirs.append(project_include_dir)
|
||||
for include_dir in LibBuilderBase.get_include_dirs(self):
|
||||
for include_dir in super().get_include_dirs():
|
||||
if include_dir not in include_dirs:
|
||||
include_dirs.append(include_dir)
|
||||
return include_dirs
|
||||
|
||||
def get_search_files(self):
|
||||
# project files
|
||||
items = LibBuilderBase.get_search_files(self)
|
||||
items = super().get_search_files()
|
||||
# test files
|
||||
if "test" in self.env.GetBuildType():
|
||||
items.extend(
|
||||
@ -994,7 +994,7 @@ class ProjectAsLibBuilder(LibBuilderBase):
|
||||
|
||||
def build(self):
|
||||
self.is_built = True # do not build Project now
|
||||
result = LibBuilderBase.build(self)
|
||||
result = super().build()
|
||||
self.env.PrependUnique(CPPPATH=self.get_include_dirs())
|
||||
return result
|
||||
|
||||
|
@ -168,7 +168,7 @@ def ProcessProjectDeps(env):
|
||||
if not env.get("PIOBUILDFILES") and not COMMAND_LINE_TARGETS:
|
||||
sys.stderr.write(
|
||||
"Error: Nothing to build. Please put your source code files "
|
||||
"to '%s' folder\n" % env.subst("$PROJECT_SRC_DIR")
|
||||
"to the '%s' folder\n" % env.subst("$PROJECT_SRC_DIR")
|
||||
)
|
||||
env.Exit(1)
|
||||
|
||||
@ -321,23 +321,16 @@ def BuildFrameworks(env, frameworks):
|
||||
)
|
||||
env.Exit(1)
|
||||
|
||||
board_frameworks = env.BoardConfig().get("frameworks", [])
|
||||
if frameworks == ["platformio"]:
|
||||
if board_frameworks:
|
||||
frameworks.insert(0, board_frameworks[0])
|
||||
else:
|
||||
sys.stderr.write("Error: Please specify `board` in `platformio.ini`\n")
|
||||
env.Exit(1)
|
||||
|
||||
for f in frameworks:
|
||||
if f == "arduino":
|
||||
# Arduino IDE appends .o the end of filename
|
||||
supported_frameworks = env.BoardConfig().get("frameworks", [])
|
||||
for name in frameworks:
|
||||
if name == "arduino":
|
||||
# Arduino IDE appends .o to the end of filename
|
||||
Builder.match_splitext = scons_patched_match_splitext
|
||||
if "nobuild" not in COMMAND_LINE_TARGETS:
|
||||
env.ConvertInoToCpp()
|
||||
|
||||
if f in board_frameworks:
|
||||
SConscript(env.GetFrameworkScript(f), exports="env")
|
||||
if name in supported_frameworks:
|
||||
SConscript(env.GetFrameworkScript(name), exports="env")
|
||||
else:
|
||||
sys.stderr.write("Error: This board doesn't support %s framework!\n" % f)
|
||||
env.Exit(1)
|
||||
|
@ -22,7 +22,7 @@ from platformio.test.result import TestCase, TestCaseSource, TestStatus
|
||||
from platformio.test.runners.base import TestRunnerBase
|
||||
|
||||
|
||||
class DoctestTestCaseParser:
|
||||
class GoogletestTestCaseParser:
|
||||
|
||||
# Examples:
|
||||
# [ RUN ] FooTest.Bar
|
||||
@ -95,7 +95,7 @@ class GoogletestTestRunner(TestRunnerBase):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self._tc_parser = DoctestTestCaseParser()
|
||||
self._tc_parser = GoogletestTestCaseParser()
|
||||
os.environ["GTEST_COLOR"] = "no" # disable ANSI symbols
|
||||
|
||||
def configure_build_env(self, env):
|
||||
|
Reference in New Issue
Block a user