Main Content

updateDependency

Update dependency information

Since R2024b

    Description

    pkg = updateDependency(pkg,depName,verRange) updates the version ranges of the specified dependencies and returns the specified package object with updated properties. The package pkg must be in editable mode.

    example

    Examples

    collapse all

    The pkg object represents the MyPackage, which depends on MyOtherPackage. Update MyPackage so that it requires MyOtherPackage to be version 2.0.0 or higher.

    pkg = updateDependency(pkg,"MyOtherPackage",">=2.0.0")
    pkg = 
    
      Package with properties:
    
       Package Definition
                         Name: "MyPackage"
                  DisplayName: "MyPackage"
                      Version: 1.0.0 (1×1 Version)
                      Summary: ""
                  Description: "This is my first Package"
                     Provider: <missing>
                      Folders: PackageApp (1×1 PackageFolder)
                 Dependencies: "MyOtherPackage@>=2.0.0"
         ReleaseCompatibility: "*"
                  FormerNames: ""
                           ID: "cabe1581-671d-40a2-8137-2b17847a9c65"
    
       Package Installation
                    Installed: 0
                     Editable: 1
        InstalledAsDependency: 0
                  PackageRoot: "C:\MyCode\MyPackage"
        InstalledDependencies: ""
          MissingDependencies: ""
    
       Repository
                   Repository: [0×0 Repository]
    
      help MyPackage

    Input Arguments

    collapse all

    Package, specified as a matlab.mpm.Package object.

    Package dependencies to update, specified as a string array, character vector, or cell array of character vectors containing the name of the dependencies to update.

    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: VersionRange="1.2.3"

    Example: VersionRange="1.2.3-alpha"

    Example: VersionRange="1.2.3-alpha+exp"

    Example: VersionRange=">2.1.13"

    Example: VersionRange=">2.1.13 <=2.1.15"

    Example: VersionRange="<2.1.13 || >2.1.15"

    Version History

    Introduced in R2024b