Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

115 lines
3.3KB

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