| 
									
										
										
										
											2016-01-01 20:51:48 +02:00
										 |  |  | ..  Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
 | 
					
						
							| 
									
										
										
										
											2015-11-18 17:33:46 +02:00
										 |  |  |     Licensed under the Apache License, Version 2.0 (the "License");
 | 
					
						
							|  |  |  |     you may not use this file except in compliance with the License.
 | 
					
						
							|  |  |  |     You may obtain a copy of the License at
 | 
					
						
							|  |  |  |        http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  |     Unless required by applicable law or agreed to in writing, software
 | 
					
						
							|  |  |  |     distributed under the License is distributed on an "AS IS" BASIS,
 | 
					
						
							|  |  |  |     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					
						
							|  |  |  |     See the License for the specific language governing permissions and
 | 
					
						
							|  |  |  |     limitations under the License.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | .. |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
 | 
					
						
							|  |  |  | ============
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-14 18:47:50 +02:00
										 |  |  | ``library.json`` is a manifest file of development library. It allows developers
 | 
					
						
							|  |  |  | to keep project in own structure and define:
 | 
					
						
							| 
									
										
										
										
											2014-11-07 22:14:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-14 18:47:50 +02:00
										 |  |  | * location of source code
 | 
					
						
							|  |  |  | * examples list
 | 
					
						
							|  |  |  | * compatible frameworks and platforms
 | 
					
						
							|  |  |  | * library dependencies
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  | * advanced build settings
 | 
					
						
							| 
									
										
										
										
											2015-12-14 18:47:50 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | PlatformIO Library Crawler uses ``library.json`` manifest to extract
 | 
					
						
							|  |  |  | source code from developer's location and keeps cleaned library in own
 | 
					
						
							| 
									
										
										
										
											2015-12-25 00:49:27 +02:00
										 |  |  | Library Storage.
 | 
					
						
							| 
									
										
										
										
											2014-11-07 22:14:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | .. _libjson_authors:
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:13:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | ``authors``
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:13:16 +03:00
										 |  |  | -----------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | *Required* if :ref:`libjson_repository` field is not defined | Type: ``Object``
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | 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
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | * ``maintainer`` Specify "maintainer" status
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:13:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | Examples:
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:13:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  |     "authors":
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:13:16 +03:00
										 |  |  |     {
 | 
					
						
							|  |  |  |         "name": "John Smith",
 | 
					
						
							|  |  |  |         "email": "me@john-smith.com",
 | 
					
						
							|  |  |  |         "url": "http://www.john-smith/contact"
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  |     ...
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "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::
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  |     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
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  |     |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``
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:01:24 +02:00
										 |  |  | The repository in which the source code can be found. The field consists for the
 | 
					
						
							|  |  |  | next items:
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 19:20:12 +03:00
										 |  |  | * ``type`` the only "git", "hg" or "svn" are supported
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:01:24 +02:00
										 |  |  | * ``url``
 | 
					
						
							| 
									
										
										
										
											2016-01-22 23:34:25 +02:00
										 |  |  | * ``branch`` if is not specified, default branch will be used. This field will
 | 
					
						
							|  |  |  |   be ignored if tag/release exists with the value of :ref:`libjson_version`.
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:13:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Example:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "repository":
 | 
					
						
							|  |  |  |     {
 | 
					
						
							| 
									
										
										
										
											2014-10-24 22:59:15 +03:00
										 |  |  |         "type": "git",
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:13:16 +03:00
										 |  |  |         "url": "https://github.com/foo/bar.git"
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | .. _libjson_version:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``version``
 | 
					
						
							|  |  |  | -----------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | *Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
 | 
					
						
							|  |  |  | | Max. Length: 20
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:25:13 +02:00
										 |  |  | A version of the current library source code. Can contain a-z, digits, dots or
 | 
					
						
							|  |  |  | dash. `Semantic Versioning <http://semver.org>`_ IS RECOMMENDED.
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:25:13 +02:00
										 |  |  | :Case 1:
 | 
					
						
							| 
									
										
										
										
											2016-01-04 01:07:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:25:13 +02:00
										 |  |  |     :ref:`libjson_version` and :ref:`libjson_repository` fields are defined.
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:30:28 +02:00
										 |  |  |     The :ref:`libjson_repository` is hosted on GitHub or Bitbucket.
 | 
					
						
							| 
									
										
										
										
											2016-01-04 01:07:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:25:13 +02:00
										 |  |  |     |PIOAPICR| will lookup for release tag named as value of :ref:`libjson_version`
 | 
					
						
							|  |  |  |     or with ``v`` prefix (you do not need to pass this ``v`` prefix to the
 | 
					
						
							|  |  |  |     :ref:`libjson_version` field).
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :Case 2:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     :ref:`libjson_version` and :ref:`libjson_repository` fields are defined
 | 
					
						
							|  |  |  |     and :ref:`libjson_repository` does not contain tag/release with value of
 | 
					
						
							|  |  |  |     :ref:`libjson_version`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 23:34:25 +02:00
										 |  |  |     |PIOAPICR| will use the latest source code from :ref:`libjson_repository`
 | 
					
						
							|  |  |  |     and link it with specified :ref:`libjson_version`. If :ref:`libjson_repository`
 | 
					
						
							|  |  |  |     ``branch`` is not specified, then default branch will be used.
 | 
					
						
							|  |  |  |     Also, if you push new commits to :ref:`libjson_repository`
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:25:13 +02:00
										 |  |  |     and do not update :ref:`libjson_version` field, the library will not be
 | 
					
						
							|  |  |  |     updated until you change the :ref:`libjson_version`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :Case 3:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     :ref:`libjson_version` field is not defined and :ref:`libjson_repository`
 | 
					
						
							|  |  |  |     field is defined.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     |PIOAPICR| will use the
 | 
					
						
							|  |  |  |     `CVS <http://en.wikipedia.org/wiki/Concurrent_Versions_System>`_ revision from
 | 
					
						
							|  |  |  |     the latest commit as "current version". For example, ``13`` (*SVN*) or first
 | 
					
						
							| 
									
										
										
										
											2016-01-22 23:34:25 +02:00
										 |  |  |     10 chars of *SHA* digest ``e4564b7da4`` (*Git*). If :ref:`libjson_repository`
 | 
					
						
							|  |  |  |     ``branch`` is not specified, then default branch will be used.
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:25:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     We recommend to use :ref:`libjson_version` field and specify the real release
 | 
					
						
							| 
									
										
										
										
											2016-04-14 00:12:03 +03:00
										 |  |  |     version and make appropriate tag in the :ref:`libjson_repository`. In other
 | 
					
						
							| 
									
										
										
										
											2016-01-22 22:25:13 +02:00
										 |  |  |     case, users will receive updates for library with each new commit to
 | 
					
						
							|  |  |  |     :ref:`libjson_repository`.
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. note::
 | 
					
						
							| 
									
										
										
										
											2016-01-04 01:07:42 +02:00
										 |  |  |     |PIOAPICR| updates library only if:
 | 
					
						
							|  |  |  |         - the :ref:`libjson_version` is changed
 | 
					
						
							|  |  |  |         - ``library.json`` is modified
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-31 00:47:03 +02:00
										 |  |  | Example:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "repository":
 | 
					
						
							|  |  |  |     {
 | 
					
						
							|  |  |  |         "type": "git",
 | 
					
						
							|  |  |  |         "url": "https://github.com/foo/bar.git"
 | 
					
						
							|  |  |  |     },
 | 
					
						
							|  |  |  |     "version": "1.0.0"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-15 19:57:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | ``license``
 | 
					
						
							|  |  |  | -----------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | A license of the library. You can check
 | 
					
						
							|  |  |  | `the full list of SPDX license IDs <https://spdx.org/licenses/>`_. Ideally you
 | 
					
						
							|  |  |  | should pick one that is `OSI <https://opensource.org/licenses/alphabetical>`_
 | 
					
						
							|  |  |  | approved.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "license": "Apache-2.0"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-31 00:47:03 +02:00
										 |  |  | .. _libjson_downloadurl:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``downloadUrl``
 | 
					
						
							|  |  |  | ---------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | *Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | It is the *HTTP URL* to the archived source code of library. It should end
 | 
					
						
							|  |  |  | with the type of archive (``.zip`` or ``.tar.gz``).
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 23:34:25 +02:00
										 |  |  | .. note::
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     :ref:`libjson_downloadurl` has higher priority than
 | 
					
						
							|  |  |  |     :ref:`libjson_repository`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-30 01:41:08 +02:00
										 |  |  | Example with fixed release/tag on GitHub:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "version": "1.0.0",
 | 
					
						
							|  |  |  |     "downloadUrl": "https://github.com/foo/bar/archive/v1.0.0.tar.gz",
 | 
					
						
							|  |  |  |     "include": "bar-1.0.0"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | See more ``library.json`` :ref:`library_creating_examples`.
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-27 21:54:47 +02:00
										 |  |  | .. _libjson_url:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``url``
 | 
					
						
							|  |  |  | -------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | *Optional* | Type: ``String`` | Max. Length: 255
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-27 21:55:30 +02:00
										 |  |  | Home page of library (if is different from :ref:`libjson_repository` url).
 | 
					
						
							| 
									
										
										
										
											2015-03-27 21:54:47 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | |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
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | |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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-30 01:41:08 +02:00
										 |  |  | See more ``library.json`` :ref:`library_creating_examples`.
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:27:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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.
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:27:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | .. _libjson_frameworks:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``frameworks``
 | 
					
						
							|  |  |  | --------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | *Optional* | Type: ``String`` or ``Array``
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | A list with compatible frameworks. The available framework types are defined in
 | 
					
						
							|  |  |  | the :ref:`platforms` section.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-17 13:28:56 +03:00
										 |  |  | If the library is compatible with the all frameworks, then you can use ``*``
 | 
					
						
							|  |  |  | symbol:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "frameworks": "*"
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. _libjson_platforms:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``platforms``
 | 
					
						
							|  |  |  | -------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | *Optional* | Type: ``String`` or ``Array``
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | A list with compatible platforms. The available platform types are
 | 
					
						
							|  |  |  | defined in :ref:`platforms` section.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-17 13:28:56 +03:00
										 |  |  | If the library is compatible with the all platforms, then you can use ``*``
 | 
					
						
							|  |  |  | symbol:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "platforms": "*"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:27:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. _libjson_dependencies:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``dependencies``
 | 
					
						
							|  |  |  | ----------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | *Optional* | Type: ``Array`` or ``Object``
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:27:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-07 18:14:33 +03:00
										 |  |  | A list of dependent libraries. They will be installed automatically with
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:27:33 +03:00
										 |  |  | :ref:`cmd_lib_install` command.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  | Allowed requirements for dependent library:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * ``name`` | Type: ``String``
 | 
					
						
							|  |  |  | * ``authors`` | Type: ``String`` or ``Array``
 | 
					
						
							|  |  |  | * ``frameworks`` | Type: ``String`` or ``Array``
 | 
					
						
							|  |  |  | * ``platforms`` | Type: ``String`` or ``Array``
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:27:33 +03:00
										 |  |  | Example:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "dependencies":
 | 
					
						
							|  |  |  |     [
 | 
					
						
							| 
									
										
										
										
											2014-10-18 20:03:38 +03:00
										 |  |  |         {
 | 
					
						
							|  |  |  |             "name": "Library-Foo",
 | 
					
						
							|  |  |  |             "authors":
 | 
					
						
							|  |  |  |             [
 | 
					
						
							|  |  |  |                 "Jhon Smith",
 | 
					
						
							|  |  |  |                 "Andrew Smith"
 | 
					
						
							|  |  |  |             ]
 | 
					
						
							|  |  |  |         },
 | 
					
						
							|  |  |  |         {
 | 
					
						
							|  |  |  |             "name": "Library-Bar",
 | 
					
						
							|  |  |  |             "frameworks": "FrameworkFoo, FrameworkBar"
 | 
					
						
							|  |  |  |         }
 | 
					
						
							| 
									
										
										
										
											2014-09-06 22:27:33 +03:00
										 |  |  |     ]
 | 
					
						
							| 
									
										
										
										
											2014-09-24 21:40:37 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-30 01:41:08 +02:00
										 |  |  | See more ``library.json`` :ref:`library_creating_examples`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-24 21:40:37 +03:00
										 |  |  | .. _libjson_examples:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``examples``
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  | ------------
 | 
					
						
							| 
									
										
										
										
											2014-09-24 21:40:37 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | *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": [
 | 
					
						
							| 
									
										
										
										
											2016-01-20 01:24:21 +02:00
										 |  |  |         "[Ee]xamples/*/*.c",
 | 
					
						
							|  |  |  |         "[Ee]xamples/*/*.cpp",
 | 
					
						
							|  |  |  |         "[Ee]xamples/*/*.h",
 | 
					
						
							| 
									
										
										
										
											2015-12-03 20:02:17 +02:00
										 |  |  |         "[Ee]xamples/*/*.ino",
 | 
					
						
							| 
									
										
										
										
											2014-09-24 21:40:37 +03:00
										 |  |  |         "[Ee]xamples/*/*.pde"
 | 
					
						
							|  |  |  |     ]
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. _libjson_build:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``build``
 | 
					
						
							|  |  |  | ------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | *Optional* | Type: ``Object``
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Specify advanced settings, options and flags for the build system. Possible
 | 
					
						
							|  |  |  | options:
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-15 18:41:16 +03:00
										 |  |  | .. list-table::
 | 
					
						
							|  |  |  |     :header-rows:  1
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     * - Option
 | 
					
						
							|  |  |  |       - Type
 | 
					
						
							|  |  |  |       - Description
 | 
					
						
							|  |  |  |     * - ``flags``
 | 
					
						
							|  |  |  |       - ``String`` or ``Array``
 | 
					
						
							|  |  |  |       - Extra flags to control preprocessing, compilation, assembly and
 | 
					
						
							|  |  |  |         linking processes. More details :ref:`projectconf_build_flags`
 | 
					
						
							|  |  |  |     * - ``unflags``
 | 
					
						
							|  |  |  |       - ``String`` or ``Array``
 | 
					
						
							|  |  |  |       - Remove base/initial flags which were set by development
 | 
					
						
							|  |  |  |         platform. More details :ref:`projectconf_build_unflags`
 | 
					
						
							|  |  |  |     * - ``srcFilter``
 | 
					
						
							|  |  |  |       - ``String`` or ``Array``
 | 
					
						
							|  |  |  |       - Specify which source files should be included/excluded
 | 
					
						
							|  |  |  |         from build process. More details :ref:`projectconf_src_filter`
 | 
					
						
							|  |  |  |     * - ``extraScript``
 | 
					
						
							|  |  |  |       - ``String``
 | 
					
						
							|  |  |  |       - Launch extra script before build process.
 | 
					
						
							|  |  |  |         More details :ref:`projectconf_extra_script`
 | 
					
						
							| 
									
										
										
										
											2016-07-24 20:04:09 +03:00
										 |  |  |     * - ``libArchive``
 | 
					
						
							|  |  |  |       - ``Boolean``
 | 
					
						
							|  |  |  |       - Archive object files to Static Library. This is default behavior of
 | 
					
						
							|  |  |  |         PlatformIO Build System (``"libArchive": true``).
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | **Examples**
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 1. Custom macros/defines
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "build": {
 | 
					
						
							|  |  |  |         "flags": "-D MYLIB_REV=0.1.2 -DRELEASE"
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 2. Extra includes for C preprocessor
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "build": {
 | 
					
						
							| 
									
										
										
										
											2016-07-15 18:41:16 +03:00
										 |  |  |         "flags": [
 | 
					
						
							|  |  |  |             "-I inc",
 | 
					
						
							|  |  |  |             "-I inc/target_x13"
 | 
					
						
							|  |  |  |         ]
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 3. Force to use ``C99`` standard instead ``C11``
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "build": {
 | 
					
						
							|  |  |  |         "unflags": "-std=gnu++11",
 | 
					
						
							|  |  |  |         "flags": "-std=c99"
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-15 19:57:55 +03:00
										 |  |  | 4. Build source files (``c, cpp, h``) at the top level of the library
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "build": {
 | 
					
						
							|  |  |  |         "srcFilter": [
 | 
					
						
							|  |  |  |             "+<*.c>",
 | 
					
						
							|  |  |  |             "+<*.cpp>",
 | 
					
						
							|  |  |  |             "+<*.h>"
 | 
					
						
							|  |  |  |         ]
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 5. Extend PlatformIO Build System with own extra script
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: javascript
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     "build": {
 | 
					
						
							|  |  |  |         "extraScript": "generate_headers.py"
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``generate_headers.py``
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: python
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-15 18:41:16 +03:00
										 |  |  |     Import('env')
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  |     # print env.Dump()
 | 
					
						
							| 
									
										
										
										
											2016-07-15 18:41:16 +03:00
										 |  |  |     env.Append(
 | 
					
						
							|  |  |  |         CPPDEFINES=["HELLO=WORLD", "TAG=1.2.3", "DEBUG"],
 | 
					
						
							|  |  |  |         CPPPATH=["inc", "inc/devices"]
 | 
					
						
							|  |  |  |     )
 | 
					
						
							| 
									
										
										
										
											2016-07-15 16:12:07 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # some python code that generates headers files "on-the-fly"
 |