Main Content

matlab.mpm.Dependency

Package dependency

Since R2024b

    Description

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

    Creation

    Description

    dep = matlab.mpm.Dependency(name,verRange,id) 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 example 1.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 and 2.1.15, but not 2.1.13 or 2.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 identifier, specified as a string scalar or character vector containing a unique identifier 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 example 1.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 and 2.1.15, but not 2.1.13 or 2.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 identifier, returned as a string scalar containing a unique identifier 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 named MyPackageDependency.

    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>

    Version History

    Introduced in R2024b