Mode "include" and "exclude" options to "export" field for the library.json

This commit is contained in:
Ivan Kravets
2016-08-22 00:03:27 +03:00
parent f5b4cb0ae8
commit d420e956e9
2 changed files with 41 additions and 25 deletions

View File

@@ -25,8 +25,8 @@ to keep project in own structure and define:
* advanced build settings * advanced build settings
PlatformIO Library Crawler uses ``library.json`` manifest to extract PlatformIO Library Crawler uses ``library.json`` manifest to extract
source code from developer's location and keeps cleaned library in own source code from developer's location and keeps a cleaned library in own
Library Storage. Library Registry.
A data in ``library.json`` should be represented A data in ``library.json`` should be represented
in `JSON-style <http://en.wikipedia.org/wiki/JSON>`_ via in `JSON-style <http://en.wikipedia.org/wiki/JSON>`_ via
@@ -270,17 +270,32 @@ See more ``library.json`` :ref:`library_creating_examples`.
Home page of library (if is different from :ref:`libjson_repository` url). Home page of library (if is different from :ref:`libjson_repository` url).
.. _libjson_include: .. _libjson_export:
``export``
----------
*Optional* | Type: ``Object``
Explain PlatformIO Library Crawler which content from the repository/archive
should be exported as "source code" of the library. This option is useful if
need to exclude extra data (test code, docs, images, PDFs, etc). It allows to
reduce size of the final archive.
Possible options:
* ``include``
* ``exclude``
``include`` ``include``
----------- ~~~~~~~~~~~
*Optional* | Type: ``String`` or ``Array`` | *Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_ `Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
If :ref:`libjson_include` field is a type of ``String``, then If ``include`` field is a type of ``String``, then |PIOAPICR| will recognize
|PIOAPICR| will recognize it like a "relative path inside it like a "relative path inside repository/archive to library source code".
repository/archive to library source code". See example below where the only See example below where the only
source code from the relative directory ``LibrarySourceCodeHere`` will be source code from the relative directory ``LibrarySourceCodeHere`` will be
included. included.
@@ -288,21 +303,23 @@ included.
"include": "some/child/dir/LibrarySourceCodeHere" "include": "some/child/dir/LibrarySourceCodeHere"
If :ref:`libjson_include` field is a type of ``Array``, then If ``include`` field is a type of ``Array``, then |PIOAPICR| firstly will
|PIOAPICR| firstly will apply :ref:`libjson_exclude` filter and apply ``exclude`` filter and then include only directories/files
then include only directories/files which match with :ref:`libjson_include` which match with ``include`` patterns.
patterns.
Example: Example:
.. code-block:: javascript .. code-block:: javascript
"export": {
"include": "include":
[ [
"dir/*.[ch]pp", "dir/*.[ch]pp",
"dir/examples/*", "dir/examples/*",
"*/*/*.h" "*/*/*.h"
] ]
}
Pattern Meaning Pattern Meaning
@@ -322,16 +339,14 @@ Pattern Meaning
See more ``library.json`` :ref:`library_creating_examples`. See more ``library.json`` :ref:`library_creating_examples`.
.. _libjson_exclude:
``exclude`` ``exclude``
----------- ~~~~~~~~~~~
*Optional* | Type: ``String`` or ``Array`` | *Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_ `Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
Exclude the directories and files which match with :ref:`libjson_exclude` Exclude the directories and files which match with ``exclude`` patterns.
patterns.
.. _libjson_frameworks: .. _libjson_frameworks:

View File

@@ -32,9 +32,8 @@ There are a several ways how to share your library with the whole world
(see `examples <https://github.com/platformio/platformio-libmirror/tree/master/configs>`_). (see `examples <https://github.com/platformio/platformio-libmirror/tree/master/configs>`_).
You can hold a lot of libraries (split into separated folders) inside one of You can hold a lot of libraries (split into separated folders) inside one of
the repository/archive. In this case please use :ref:`libjson_include` the repository/archive. In this case, you need to specify ``include`` option of
field to specify the relative path to your library's source code. :ref:`libjson_export` field to relative path to your library's source code.
At GitHub At GitHub
^^^^^^^^^ ^^^^^^^^^
@@ -132,7 +131,9 @@ of **required** fields in the :ref:`library_config` will look like:
}, },
"version": "2.2", "version": "2.2",
"downloadUrl": "http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip", "downloadUrl": "http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip",
"include": "OneWire", "export": {
"include": "OneWire"
},
"frameworks": "arduino", "frameworks": "arduino",
"platforms": "atmelavr" "platforms": "atmelavr"
} }