You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.4KB

  1. .. highlight:: yaml
  2. Library and Package Dependencies
  3. ################################
  4. ``dds`` considers that all libraries belong to a single *package*, but a single
  5. package may contain one or more *libraries*. For this reason, and to better
  6. interoperate with other build and packaging tools, we consider the issues of
  7. package dependencies and library dependencies separately.
  8. .. _deps.pkg-deps:
  9. Package Dependencies
  10. ********************
  11. Consider that we are creating a package ``acme-gadgets@4.3.6``. We declare the
  12. name and version in the ``package.dds`` in the package root:
  13. .. code-block::
  14. Name: acme-gadgets
  15. Version: 4.3.6
  16. Namespace: acme
  17. .. note::
  18. The ``Namespace`` field is required, but will be addressed in the
  19. :ref:`deps.lib-deps` section.
  20. Suppose that our package's libraries build upon the libraries in the
  21. ``acme-widgets`` package, and that we require version ``1.4.3`` or newer, but
  22. not as new as ``2.0.0``. Such a dependency can be declared with the ``Depends``
  23. key:
  24. .. code-block::
  25. :emphasize-lines: 5
  26. Name: acme-gadgets
  27. Version: 4.3.6
  28. Namespace: acme
  29. Depends: acme-widgets ^1.4.3
  30. If we wish to declare additional dependencies, we simply declare them with
  31. additional ``Depends`` keys
  32. .. code-block::
  33. :emphasize-lines: 5-7
  34. Name: acme-gadgets
  35. Version: 4.3.6
  36. Namespace: acme
  37. Depends: acme-widgets ^1.4.3
  38. Depends: acme-gizmos ~5.6.5
  39. Depends: acme-utils ^3.3.0
  40. When ``dds`` attempts to build a project, it will first build the dependency
  41. solution by iteratively scanning the dependencies of the containing project and
  42. all transitive dependencies.
  43. .. note::
  44. Unlike other packaging tools, ``dds`` will find a solution with the
  45. *lowest* possible version that satisfies the given requirements for each
  46. package.
  47. .. _deps.lib-deps:
  48. Library Dependencies
  49. ********************
  50. In ``dds``, library interdependencies are tracked separately from the packages
  51. that contain them. A library must declare its intent to use another library
  52. in the ``library.dds`` at its library root. The minimal content of a
  53. ``library.dds`` is the ``Name`` key:
  54. .. code-block::
  55. Name: gadgets
  56. To announce that a library wishes to *use* another library, use the aptly-named
  57. ``Uses`` key:
  58. .. code-block::
  59. :emphasize-lines: 3-5
  60. Name: gadgets
  61. Uses: acme/widgets
  62. Uses: acme/gizmos
  63. Uses: acme/utils
  64. Here is where the package's ``Namespace`` key comes into play: A library's
  65. qualified name is specified by joining the ``Namespace`` of the containing
  66. package with the ``Name`` of the library within that package with a ``/``
  67. between them.
  68. It is the responsibility of package authors to document the ``Namespace`` and
  69. ``Name`` of the packages and libraries that they distribute.
  70. .. note::
  71. The ``Namespace`` of a package is completely arbitrary, and need not relate
  72. to a C++ ``namespace``.
  73. .. note::
  74. The ``Namespace`` need not be unique to a single package. For example, a
  75. single organization (Like Acme Inc.) can share a single ``Namespace`` for
  76. many of their packages and libraries.
  77. However, it is essential that the ``<Namespace>/<Name>`` pair be
  78. universally unique, so choose wisely!
  79. Once the ``Uses`` key appears in the ``library.dds`` file of a library, ``dds``
  80. will make available the headers for the library being used, and will
  81. transitively propagate that usage requirement to users of the library.