Browse Source

Update tests and docs to refer to library.json5

default_compile_flags
vector-of-bool 4 years ago
parent
commit
5565294072
14 changed files with 56 additions and 31 deletions
  1. +11
    -0
      docs/err/invalid-lib-manifest.rst
  2. +1
    -1
      docs/err/invalid-pkg-filesystem.rst
  3. +2
    -2
      docs/err/unknown-usage.rst
  4. +1
    -1
      docs/guide/catalog.rst
  5. +17
    -12
      docs/guide/interdeps.rst
  6. +6
    -5
      docs/guide/packages.rst
  7. +1
    -1
      docs/guide/repo.rst
  8. +2
    -2
      src/dds/error/errors.cpp
  9. +0
    -3
      tests/deps/use-remote/library.dds
  10. +6
    -0
      tests/deps/use-remote/library.json5
  11. +0
    -3
      tests/deps/use-spdlog/project/library.dds
  12. +6
    -0
      tests/deps/use-spdlog/project/library.json5
  13. +0
    -1
      tests/sdist/create/library.dds
  14. +3
    -0
      tests/sdist/create/library.jsonc

+ 11
- 0
docs/err/invalid-lib-manifest.rst View File

@@ -0,0 +1,11 @@
Error: Invalid library manifest
###############################

Every ``dds`` package must contain a valid library manifest for each library
that it exports. These manifests are stored in the library root to which they
correspond, and are stored in JSON5 format in ``library.json5`` (or similarly
named file).

The contents of this file must follow a prescribed content, or ``dds`` will
reject the manifest. Refer to the :ref:`pkgs.libs` documentation page for more
information about how to declare libraries.

+ 1
- 1
docs/err/invalid-pkg-filesystem.rst View File

@@ -7,7 +7,7 @@ and is thoroughly explained on the :doc:`/guide/packages` page.

For exporting/generating a source distribution from a package, the *package
root* requires a ``package.json5`` file and each *library root* requires a
``library.dds`` file.
``library.json5`` file.

.. .
TODO: Create are more detailed reference page for package and library layout,

+ 2
- 2
docs/err/unknown-usage.rst View File

@@ -2,11 +2,11 @@ Error: Unknown Usage/Linking Requirements
#########################################

A library can declare that it *uses* or *links* to another library by using the
``Uses`` and ``Links`` keys in ``library.dds``, respectively.
``uses`` and ``links`` keys in ``library.json5``, respectively.

These requirements are specified by using the ``namespace/name`` pair that
identifies a library. These are defined by both the project's dependencies and
the project itself. If a ``Uses`` or ``Links`` key does not correspond to a
the project itself. If a ``uses`` or ``links`` key does not correspond to a
known library, ``dds`` will not be able to resolve the usage requirements, and
will generate an error.


+ 1
- 1
docs/guide/catalog.rst View File

@@ -48,7 +48,7 @@ that will be added to the catalog. The following options are supported:
``--git-url <url>``
Specify a Git URL to clone from to obtain the package. The root of the
cloned repository must be a package root, but does not necessarily need to
have the ``package.json5`` and ``library.dds`` files if relying on the
have the ``package.json5`` and ``library.json5`` files if relying on the
``--auto-lib`` parameter.

``--git-ref`` **must** be passed with ``--git-url``.

+ 17
- 12
docs/guide/interdeps.rst View File

@@ -198,24 +198,29 @@ Library Dependencies

In ``dds``, library interdependencies are tracked separately from the packages
that contain them. A library must declare its intent to use another library
in the ``library.dds`` at its library root. The minimal content of a
``library.dds`` is the ``Name`` key:
in the ``library.json5`` at its library root. The minimal content of a
``library.json5`` is the ``Name`` key:

.. code-block::
.. code-block:: js

Name: gadgets
{
name: 'gadgets'
}

To announce that a library wishes to *use* another library, use the aptly-named
``Uses`` key:
``uses`` key:

.. code-block:: js
:emphasize-lines: 3-5
:emphasize-lines: 3-7

Name: gadgets

Uses: acme/widgets
Uses: acme/gizmos
Uses: acme/utils
{
name: 'gadgets',
uses: [
'acme/widgets',
'acme/gizmos',
'acme/utils',
],
}

Here is where the package's ``namespace`` key comes into play: A library's
qualified name is specified by joining the ``namespace`` of the containing
@@ -237,6 +242,6 @@ It is the responsibility of package authors to document the ``namespace`` and
However, it is essential that the ``<namespace>/<name>`` pair be
universally unique, so choose wisely!

Once the ``Uses`` key appears in the ``library.dds`` file of a library, ``dds``
Once the ``uses`` key appears in the ``library.dds`` file of a library, ``dds``
will make available the headers for the library being used, and will
transitively propagate that usage requirement to users of the library.

+ 6
- 5
docs/guide/packages.rst View File

@@ -242,13 +242,14 @@ included in downstream binaries, but it will still generate link rules for the
dependencies of a header-only library.

In order for ``dds`` to be able to distribute and interlink libraries, a
``library.dds`` file must be present at the corresponding library root. The
only required key in a ``library.dds`` file is ``Name``:
``library.json5`` file must be present at the corresponding library root. The
only required key in a ``library.json5`` file is ``Name``:

.. code-block:: yaml

Name: my-library
.. code-block:: js

{
name: 'my-library'
}

.. seealso:: More information is discussed on the :ref:`deps.lib-deps` page


+ 1
- 1
docs/guide/repo.rst View File

@@ -62,7 +62,7 @@ package ID as the name of the source distribution directory::
$ ls ./spdlog@1.4.2/
include/
src/
library.dds
library.json5
package.json5



+ 2
- 2
src/dds/error/errors.cpp View File

@@ -234,7 +234,7 @@ which packages are claiming the library name.
)";
case errc::unknown_usage_name:
return R"(
A `Uses` or `Links` field for a library specifies a library of an unknown name.
A `uses` or `links` field for a library specifies a library of an unknown name.
Check your spelling, and check that the package containing the library is
available, either from the `package.json5` or from the `INDEX.lmi` that was used
for the build.
@@ -313,7 +313,7 @@ std::string_view dds::default_error_string(dds::errc ec) noexcept {
case errc::dup_lib_name:
return "More than one library has claimed the same name.";
case errc::unknown_usage_name:
return "A `Uses` or `Links` field names a library that isn't recognized.";
return "A `uses` or `links` field names a library that isn't recognized.";
case errc::none:
break;
}

+ 0
- 3
tests/deps/use-remote/library.dds View File

@@ -1,3 +0,0 @@
Name: dummy

Uses: nlohmann/json

+ 6
- 0
tests/deps/use-remote/library.json5 View File

@@ -0,0 +1,6 @@
{
name: "dummy",
uses: [
'nlohmann/json',
]
}

+ 0
- 3
tests/deps/use-spdlog/project/library.dds View File

@@ -1,3 +0,0 @@
Name: spdlog-user

Uses: spdlog/spdlog

+ 6
- 0
tests/deps/use-spdlog/project/library.json5 View File

@@ -0,0 +1,6 @@
{
name: 'spdlog-user',
uses: [
'spdlog/spdlog',
]
}

+ 0
- 1
tests/sdist/create/library.dds View File

@@ -1 +0,0 @@
Name: foo

+ 3
- 0
tests/sdist/create/library.jsonc View File

@@ -0,0 +1,3 @@
{
"name": "foo"
}

Loading…
Cancel
Save