mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Allow to disable library archiving ("*.ar") // Resolve #719
This commit is contained in:
39
HISTORY.rst
39
HISTORY.rst
@ -13,28 +13,33 @@ PlatformIO 3.0
|
||||
(`issue #479 <https://github.com/platformio/platformio/issues/479>`_)
|
||||
* Unit Testing for Embedded (`docs <http://docs.platformio.org/en/latest/platforms/unit_testing.html>`__)
|
||||
(`issue #408 <https://github.com/platformio/platformio/issues/408>`_)
|
||||
* New Library Build System: intelligent dependency finder that interprets
|
||||
C Preprocessor conditional macros,
|
||||
`library deep search <http://docs.platformio.org/en/latest/projectconf.html#lib-deep-search>`__,
|
||||
`library compatibility level <http://docs.platformio.org/en/latest/projectconf.html#lib-compat-level>`__,
|
||||
support for the 3rd party manifests (Arduino IDE ``library.properties``,
|
||||
ARM mbed ``module.json``)
|
||||
(`issue #432 <https://github.com/platformio/platformio/issues/432>`_)
|
||||
* New `lib_extra_dirs <http://docs.platformio.org/en/latest/projectconf.html#lib-extra-dirs>`__ option for project environment.
|
||||
Multiple custom library locations!
|
||||
(`issue #537 <https://github.com/platformio/platformio/issues/537>`_)
|
||||
* Handle extra build flags and build script from
|
||||
`library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
||||
(`issue #289 <https://github.com/platformio/platformio/issues/289>`_)
|
||||
* Check library compatibility with project environment before building
|
||||
(`issue #415 <https://github.com/platformio/platformio/issues/415>`_)
|
||||
* New Intelligent Library Build System
|
||||
|
||||
+ `Library Dependency Finder <http://docs.platformio.org/en/latest/faq.html#how-works-library-dependency-finder-ldf>`__
|
||||
that interprets C Preprocessor conditional macros and nested includes/chain
|
||||
+ Check library compatibility with project environment before building
|
||||
(`issue #415 <https://github.com/platformio/platformio/issues/415>`_)
|
||||
+ Control Library Dependency Finder for compatibility using
|
||||
`lib_compat_level <http://docs.platformio.org/en/latest/projectconf.html#lib-compat-level>`__
|
||||
option
|
||||
+ Custom library storages/directories with
|
||||
`lib_extra_dirs <http://docs.platformio.org/en/latest/projectconf.html#lib-extra-dirs>`__ option
|
||||
(`issue #537 <https://github.com/platformio/platformio/issues/537>`_)
|
||||
+ Handle extra build flags, source filters and build script from
|
||||
`library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
||||
(`issue #289 <https://github.com/platformio/platformio/issues/289>`_)
|
||||
+ Allowed to disable library archiving (``*.ar``)
|
||||
(`issue #719 <https://github.com/platformio/platformio/issues/719>`_)
|
||||
+ Show detailed build information about dependent libraries
|
||||
(`issue #617 <https://github.com/platformio/platformio/issues/617>`_)
|
||||
+ Support for the 3rd party manifests (Arduino IDE "library.properties"
|
||||
and ARM mbed "module.json")
|
||||
|
||||
* Print human-readable information when processing environments without
|
||||
``-v, --verbose`` option
|
||||
(`issue #721 <https://github.com/platformio/platformio/issues/721>`_)
|
||||
* Added ``license`` field to `library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
|
||||
(`issue #522 <https://github.com/platformio/platformio/issues/522>`_)
|
||||
* Show detailed build information about dependent libraries
|
||||
(`issue #617 <https://github.com/platformio/platformio/issues/617>`_)
|
||||
* Embedded Board compatibility with more than one development platform
|
||||
(`issue #456 <https://github.com/platformio/platformio/issues/456>`_)
|
||||
|
||||
|
@ -461,6 +461,10 @@ options:
|
||||
- ``String``
|
||||
- Launch extra script before build process.
|
||||
More details :ref:`projectconf_extra_script`
|
||||
* - ``libArchive``
|
||||
- ``Boolean``
|
||||
- Archive object files to Static Library. This is default behavior of
|
||||
PlatformIO Build System (``"libArchive": true``).
|
||||
|
||||
**Examples**
|
||||
|
||||
|
@ -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