forked from platformio/platformio-core
Allow to disable library archiving ("*.ar") // Resolve #719
This commit is contained in:
1 parent
01c0b45ea2
commit
187315fc08
5 files changed
+66
-33
No files matched your search
@@ -14,7 +14,7 @@
|
||||
|
||||
import sys
|
||||
|
||||
VERSION = (3, 0, "0.dev10")
|
||||
VERSION = (3, 0, "0.dev11")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
||||
@@ -121,6 +121,10 @@ class LibBuilderBase(object):
|
||||
def extra_script(self):
|
||||
return None
|
||||
|
||||
@property
|
||||
def lib_archive(self):
|
||||
return True
|
||||
|
||||
@property
|
||||
def is_built(self):
|
||||
return self._is_built
|
||||
@@ -162,7 +166,12 @@ class LibBuilderBase(object):
|
||||
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"):
|
||||
self.env.AppendUnique(**{key: env.get(key)})
|
||||
|
||||
return env.BuildLibrary(self.build_dir, self.src_dir, self.src_filter)
|
||||
if self.lib_archive:
|
||||
return env.BuildLibrary(
|
||||
self.build_dir, self.src_dir, self.src_filter)
|
||||
else:
|
||||
return env.BuildSources(
|
||||
self.build_dir, self.src_dir, self.src_filter)
|
||||
|
||||
|
||||
class UnknownLibBuilder(LibBuilderBase):
|
||||
@@ -260,6 +269,12 @@ class PlatformIOLibBuilder(LibBuilderBase):
|
||||
return self._manifest.get("build").get("extra_script")
|
||||
return LibBuilderBase.extra_script.fget(self)
|
||||
|
||||
@property
|
||||
def lib_archive(self):
|
||||
if "libArchive" in self._manifest.get("build", {}):
|
||||
return self._manifest.get("build").get("libArchive")
|
||||
return LibBuilderBase.lib_archive.fget(self)
|
||||
|
||||
def is_platform_compatible(self, platform):
|
||||
items = self._manifest.get("platforms")
|
||||
if not items:
|
||||
@@ -315,7 +330,9 @@ def find_and_build_deps(env, lib_builders, scanner,
|
||||
lb.append_to_cpppath()
|
||||
# start builder
|
||||
for lb in target_lbs:
|
||||
libs.append(lb.build())
|
||||
lib_node = lb.build()
|
||||
if lib_node:
|
||||
libs.append(lib_node)
|
||||
|
||||
if env.get("LIB_DEEP_SEARCH", "").lower() == "true":
|
||||
for lb in target_lbs:
|
||||
@@ -377,7 +394,9 @@ def BuildDependentLibraries(env, src_dir):
|
||||
libs.extend(find_and_build_deps(
|
||||
env, lib_builders, scanner, lb.src_dir, lb.src_filter))
|
||||
if not lb.is_built:
|
||||
libs.append(lb.build())
|
||||
lib_node = lb.build()
|
||||
if lib_node:
|
||||
libs.append(lib_node)
|
||||
|
||||
# process project source code
|
||||
libs.extend(find_and_build_deps(
|
||||
|
||||
@@ -85,24 +85,24 @@ def BuildProgram(env):
|
||||
env.Append(
|
||||
CPPPATH=["$PROJECTSRC_DIR"],
|
||||
LIBS=deplibs,
|
||||
LIBPATH=["$BUILD_DIR"]
|
||||
)
|
||||
|
||||
sources = env.CollectBuildFiles(
|
||||
"$BUILDSRC_DIR", "$PROJECTSRC_DIR",
|
||||
src_filter=env.get("SRC_FILTER"), duplicate=False)
|
||||
LIBPATH=["$BUILD_DIR"],
|
||||
PIOBUILDFILES=env.CollectBuildFiles(
|
||||
"$BUILDSRC_DIR",
|
||||
"$PROJECTSRC_DIR",
|
||||
src_filter=env.get("SRC_FILTER"),
|
||||
duplicate=False))
|
||||
|
||||
if "test" in COMMAND_LINE_TARGETS:
|
||||
sources.extend(env.ProcessTest())
|
||||
env.Append(PIOBUILDFILES=env.ProcessTest())
|
||||
|
||||
if not sources and not COMMAND_LINE_TARGETS:
|
||||
if not env['PIOBUILDFILES'] and not COMMAND_LINE_TARGETS:
|
||||
env.Exit(
|
||||
"Error: Nothing to build. Please put your source code files "
|
||||
"to '%s' folder" % env.subst("$PROJECTSRC_DIR"))
|
||||
|
||||
program = env.Program(
|
||||
join("$BUILD_DIR", env.subst("$PROGNAME")),
|
||||
sources
|
||||
env['PIOBUILDFILES']
|
||||
)
|
||||
|
||||
if set(["upload", "uploadlazy", "program"]) & set(COMMAND_LINE_TARGETS):
|
||||
@@ -262,11 +262,15 @@ def BuildFrameworks(env, frameworks):
|
||||
|
||||
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
|
||||
lib = env.Clone()
|
||||
return lib.Library(
|
||||
return lib.StaticLibrary(
|
||||
lib.subst(variant_dir),
|
||||
lib.CollectBuildFiles(
|
||||
variant_dir, src_dir, src_filter=src_filter)
|
||||
)
|
||||
variant_dir, src_dir, src_filter=src_filter))
|
||||
|
||||
|
||||
def BuildSources(env, variant_dir, src_dir, src_filter=None):
|
||||
DefaultEnvironment().Append(PIOBUILDFILES=env.Clone().CollectBuildFiles(
|
||||
variant_dir, src_dir, src_filter=src_filter))
|
||||
|
||||
|
||||
def exists(_):
|
||||
@@ -283,4 +287,5 @@ def generate(env):
|
||||
env.AddMethod(CollectBuildFiles)
|
||||
env.AddMethod(BuildFrameworks)
|
||||
env.AddMethod(BuildLibrary)
|
||||
env.AddMethod(BuildSources)
|
||||
return env
|
||||
Reference in new issue
Block a user