matlab.mpm.Dependency - Package dependency - MATLAB (original) (raw)

Package dependency

Since R2024b

Description

A dependency is a package that a different package depends on. Usematlab.mpm.Dependency objects to specify package dependencies for amatlab.mpm.Package object.

Creation

Syntax

Description

`dep` = matlab.mpm.Dependency([name](#mw%5F3d3263c2-c564-4e34-9993-2fe58ddfd67b),[verRange](#mw%5F92a2fc23-4e6e-4a46-95cc-ac7c217bf2b9),[id](#mw%5F73a0ad21-51cf-43ac-94a9-ff5b2a45fa42)) creates a dependency object using the specified package name, version, and identifier.

example

Input Arguments

expand all

Dependency name, specified as a string scalar or character vector containing the name of the dependency.

This argument sets the Name property.

Example: "MyOtherPackage"

Version range, specified as a string scalar, character vector, or matlab.mpm.Version object. This option limits the output to only packages whose Version property is within the specified version range.

Version syntax follows the Semantic Versioning 2.0.0 format: _`<major version>`_._`<minor version>`_._`<patch version>`_, where each version number must be a nonnegative integer, for example1.2.3. You can optionally specify a pre-release version by adding-_`<pre-release version>`_ to the end of the version, for example 1.2.3-alpha. Optionally specify a build version by adding +_`<build version>`_.

Specify a range of versions by including the <,<=, >, or >= operators in front of a version number. For example, >2.1.13 specifies all versions greater than 2.1.13. Specify more than one range separated by white space to further limit matches. For example, >2.1.13 <=2.1.15 includes versions 2.1.14 and2.1.15, but not 2.1.13 or2.1.16. Use the || operator to designate multiple acceptable version ranges. For example, <2.1.13 || >2.1.15 includes versions less than 2.1.13 and greater than 2.1.15, but not 2.1.14.

Example: "1.2.3"

Example: "1.2.3-alpha"

Example: "1.2.3-alpha+exp"

Example: ">2.1.13"

Example: ">2.1.13 <=2.1.15"

Example: "<2.1.13 || >2.1.15"

Package UUID, specified as a string scalar or character vector containing a universally unique identifier (UUID) of the dependency.

This argument sets the ID property.

Example: "9ecfea6b-1710-4fb9-aa66-e4750f0e8251"

Properties

expand all

Dependency name, specified as a string scalar or character vector containing the name of the dependency.

Version range, specified as a string scalar, character vector, or matlab.mpm.Version object. By default, this property is "*", which represents all versions.

Version syntax follows the Semantic Versioning 2.0.0 format: _`<major version>`_._`<minor version>`_._`<patch version>`_, where each version number must be a nonnegative integer, for example1.2.3. You can optionally specify a pre-release version by adding-_`<pre-release version>`_ to the end of the version, for example 1.2.3-alpha. Optionally specify a build version by adding +_`<build version>`_.

Specify a range of versions by including the <,<=, >, or >= operators in front of a version number. For example, >2.1.13 specifies all versions greater than 2.1.13. Specify more than one range separated by white space to further limit matches. For example, >2.1.13 <=2.1.15 includes versions 2.1.14 and2.1.15, but not 2.1.13 or2.1.16. Use the || operator to designate multiple acceptable version ranges. For example, <2.1.13 || >2.1.15 includes versions less than 2.1.13 and greater than 2.1.15, but not 2.1.14.

Package UUID, returned as a string scalar containing a universally unique identifier (UUID) of the dependency.

Resolved dependency version, returned as a matlab.mpm.Version object. When installing the dependency package, MATLAB sets this property using the installed version of the dependency.

Example: matlab.mpm.Version("1.2.3")

Examples

collapse all

Create a package dependency using a package namedMyPackageDependency.

dep = matlab.mpm.Dependency("MyPackageDependency","1.2.3","4ca03e45-70d0-44b3-b0e5-ac18cf32d534")

dep =

Dependency with properties:

           Name: "MyPackageDependency"
   VersionRange: "1.2.3"
             ID: "4ca03e45-70d0-44b3-b0e5-ac18cf32d534"
ResolvedVersion: <missing>

Extended Capabilities

Version History

Introduced in R2024b