Files
platformio-core/docs/librarymanager/config.rst

308 lines
6.8 KiB
ReStructuredText
Raw Normal View History

.. |PIOAPICR| replace:: *PlatformIO Library Registry Crawler*
2014-10-22 23:52:17 +03:00
.. _library_config:
2014-09-06 13:44:45 +03:00
library.json
============
2014-11-07 22:14:44 +02:00
``library.json`` is a manifest file of development library.
Initially it was
developed for :ref:`librarymanager`, but later was accepted by worldwide embedded
community like a **standard library specification**.
A data in ``library.json`` should be represented
in `JSON-style <http://en.wikipedia.org/wiki/JSON>`_ via
2014-09-06 22:13:16 +03:00
`associative array <http://en.wikipedia.org/wiki/Associative_array>`_
2014-11-07 22:14:44 +02:00
(name/value pairs). An order doesn't matter. The allowable fields
(names from pairs) are described below.
2014-09-06 13:44:45 +03:00
2014-09-06 22:13:16 +03:00
.. contents::
.. _libjson_name:
``name``
--------
**Required** | Type: ``String`` | Max. Length: 50
2014-09-07 18:14:33 +03:00
A name of the library.
2014-09-06 22:13:16 +03:00
* Must be unique.
* Should be slug style for simplicity, consistency and compatibility.
2014-09-07 18:14:33 +03:00
Example: *Arduino-SPI*
* Title Case, Aa-z, can contain digits and dashes (but not start/end
2014-09-06 22:13:16 +03:00
with them).
* Consecutive dashes are not allowed.
.. _libjson_description:
``description``
---------------
**Required** | Type: ``String`` | Max. Length: 255
2014-09-09 23:16:36 +03:00
The field helps users to identify and search for your library with a brief
description. Describe the hardware devices (sensors, boards and etc.) which
are suitable with it.
2014-09-06 22:13:16 +03:00
.. _libjson_keywords:
``keywords``
------------
**Required** | Type: ``String`` | Max. Length: 255
2014-09-09 23:16:36 +03:00
Used for search by keyword. Helps to make your library easier to discover
without people needing to know its name.
2014-09-06 22:13:16 +03:00
2014-09-07 18:14:33 +03:00
The keyword should be lowercased, can contain a-z, digits and dash (but not
start/end with them). A list from the keywords can be specified with
2014-09-09 23:16:36 +03:00
separator ``,``
2014-09-07 18:14:33 +03:00
2014-09-06 22:13:16 +03:00
.. _libjson_authors:
2014-09-06 22:13:16 +03:00
``authors``
2014-09-06 22:13:16 +03:00
-----------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``Object``
or ``Array``
2014-09-06 22:13:16 +03:00
2014-09-07 18:14:33 +03:00
An author contact information
2014-09-06 22:13:16 +03:00
* ``name`` Full name (**Required**)
* ``email``
* ``url`` An author's contact page
* ``maintainer`` Specify "maintainer" status
2014-09-06 22:13:16 +03:00
Examples:
2014-09-06 22:13:16 +03:00
.. code-block:: javascript
"authors":
2014-09-06 22:13:16 +03:00
{
"name": "John Smith",
"email": "me@john-smith.com",
"url": "http://www.john-smith/contact"
}
...
"authors":
[
{
"name": "John Smith",
"email": "me@john-smith.com",
"url": "http://www.john-smith/contact"
},
{
"name": "Andrew Smith",
"email": "me@andrew-smith.com",
"url": "http://www.andrew-smith/contact",
"maintainer": true
}
]
2014-09-06 22:13:16 +03:00
.. note::
You can omit :ref:`libjson_authors` field and define
2014-09-09 23:16:36 +03:00
:ref:`libjson_repository` field. Only *GitHub-based* repository is
2014-09-07 18:14:33 +03:00
supported now. In this case
|PIOAPICR| will use information from
2014-09-06 22:13:16 +03:00
`GitHub API Users <https://developer.github.com/v3/users/>`_.
.. _libjson_repository:
``repository``
--------------
*Required* if :ref:`libjson_downloadurl` field is not defined | Type: ``Object``
The repository in which the source code can be found.
Example:
.. code-block:: javascript
"repository":
{
"type": "git",
2014-09-06 22:13:16 +03:00
"url": "https://github.com/foo/bar.git"
}
.. _libjson_downloadurl:
``downloadUrl``
---------------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
2014-09-09 23:16:36 +03:00
It is the *HTTP URL* to the archived source code of library. It should end
with the type of archive (``.zip`` or ``.tar.gz``).
2014-09-06 22:13:16 +03:00
.. _libjson_version:
``version``
-----------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
| Max. Length: 20
A version of the current library source code.
* Can contain a-z, digits, dots or dash.
* `Semantic Versioning <http://semver.org>`_ is recommended.
* A `CVS <http://en.wikipedia.org/wiki/Concurrent_Versions_System>`_
revision from the latest commit. Example: ``13`` (*SVN*) or first 10
chars of *SHA* digest ``e4564b7da4`` (*Git*).
.. note::
You can omit :ref:`libjson_version` field and define
:ref:`libjson_repository` field. In this case
|PIOAPICR| will use the *CVS*-revision from the latest commit.
2014-09-06 22:13:16 +03:00
.. _libjson_include:
``include``
-----------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
If :ref:`libjson_include` field is a type of ``String``, then
|PIOAPICR| will recognize it like a "relative path inside
2014-09-07 18:14:33 +03:00
repository/archive to library source code". See example below where the only
2014-09-06 22:13:16 +03:00
source code from the relative directory ``LibrarySourceCodeHere`` will be
included.
.. code-block:: javascript
"include": "some/child/dir/LibrarySourceCodeHere"
If :ref:`libjson_include` field is a type of ``Array``, then
|PIOAPICR| firstly will apply :ref:`libjson_exclude` filter and
2014-09-06 22:13:16 +03:00
then include only directories/files which match with :ref:`libjson_include`
patterns.
Example:
.. code-block:: javascript
"include":
[
"dir/*.[ch]pp",
"dir/examples/*",
"*/*/*.h"
]
Pattern Meaning
.. list-table::
:header-rows: 1
* - Pattern
- Meaning
* - ``*``
- matches everything
* - ``?``
- matches any single character
* - ``[seq]``
- matches any character in seq
* - ``[!seq]``
- matches any character not in seq
2014-09-06 22:13:16 +03:00
.. _libjson_exclude:
``exclude``
-----------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
2014-09-07 18:14:33 +03:00
Exclude the directories and files which match with :ref:`libjson_exclude`
2014-09-06 22:13:16 +03:00
patterns.
.. _libjson_frameworks:
``frameworks``
--------------
*Optional* | Type: ``String`` or ``Array``
A list with compatible frameworks. The available framework types are defined in
the :ref:`platforms` section.
.. _libjson_platforms:
``platforms``
-------------
*Optional* | Type: ``String`` or ``Array``
A list with compatible platforms. The available platform types are
defined in :ref:`platforms` section.
.. _libjson_dependencies:
``dependencies``
----------------
*Optional* | Type: ``Array`` or ``Object``
2014-09-07 18:14:33 +03:00
A list of dependent libraries. They will be installed automatically with
:ref:`cmd_lib_install` command.
Allowed requirements for dependent library:
* ``name`` | Type: ``String``
* ``authors`` | Type: ``String`` or ``Array``
* ``frameworks`` | Type: ``String`` or ``Array``
* ``platforms`` | Type: ``String`` or ``Array``
Example:
.. code-block:: javascript
"dependencies":
[
{
"name": "Library-Foo",
"authors":
[
"Jhon Smith",
"Andrew Smith"
]
},
{
"name": "Library-Bar",
"frameworks": "FrameworkFoo, FrameworkBar"
}
]
2014-09-24 21:40:37 +03:00
.. _libjson_examples:
``examples``
----------------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
A list of example patterns. This field is predefined with default value:
.. code-block:: javascript
"examples": [
"[Ee]xamples/*/*.ini",
"[Ee]xamples/*/*.pde"
]