Main Content

compiler.build.ProductionServerArchiveOptions

Options for building deployable archives

Description

example

opts = compiler.build.ProductionServerArchiveOptions(FunctionFiles) creates a ProductionServerArchiveOptions object using the MATLAB® functions specified by FunctionFiles. Use the ProductionServerArchiveOptions object as an input to the compiler.build.productionServerArchive function.

example

opts = compiler.build.ProductionServerArchiveOptions(FunctionFiles,Name,Value) creates a ProductionServerArchiveOptions object with options specified using one or more name-value arguments. Options include the archive name, output directory, and additional files to include.

Examples

collapse all

Create a ProductionServerArchiveOptions object from a function file.

For this example, use the file magicsquare.m located in matlabroot\extern\examples\compiler.

appFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m');
opts = compiler.build.ProductionServerArchiveOptions(appFile)
opts = 

  ProductionServerArchiveOptions with properties:

            ArchiveName: 'magicsquare'
          FunctionFiles: {'C:\Program Files\MATLAB\R2021b\extern\examples\compiler\magicsquare.m'}
     FunctionSignatures: ''
        AdditionalFiles: {}
    AutoDetectDataFiles: on
        SupportPackages: {'autodetect'}
              OutputDir: '.\magicsquareproductionServerArchive'
                Verbose: off

You can modify the property values of an existing ProductionServerArchiveOptions object using dot notation. For example, enable verbose output.

opts.Verbose = 'on'
opts = 

  ProductionServerArchiveOptions with properties:

            ArchiveName: 'magicsquare'
          FunctionFiles: {'C:\Program Files\MATLAB\R2021b\extern\examples\compiler\magicsquare.m'}
     FunctionSignatures: ''
        AdditionalFiles: {}
    AutoDetectDataFiles: on
        SupportPackages: {'autodetect'}
              OutputDir: '.\magicsquareproductionServerArchive'
                Verbose: on

Use the DotNETAssemblyOptions object as an input to the compiler.build.productionServerArchive (MATLAB Compiler SDK) function to build a production server archive.

compiler.build.productionServerArchive(opts);

Create a production server archive using a ProductionServerArchiveOptions object.

Create a ProductionServerArchiveOptions object using the function files myfunc1.m and myfunc2.m. Use name-value arguments to specify the output directory, enable verbose output, and disable automatic detection of data files.

opts = compiler.build.ProductionServerArchiveOptions(["myfunc1.m","myfunc2.m"],...
    'ArchiveName','MyServer',...
    'OutputDir','D:\Documents\MATLAB\work\ProductionServer',...
    'AutoDetectDataFiles','off')
opts = 

  ProductionServerArchiveOptions with properties:

            ArchiveName: 'MyServer'
          FunctionFiles: {2×1 cell}
     FunctionSignatures: ''
        AdditionalFiles: {}
    AutoDetectDataFiles: off
        SupportPackages: {'autodetect'}
              OutputDir: 'D:\Documents\MATLAB\work\ProductionServer'
                Verbose: off

You can modify the property values of an existing ProductionServerArchiveOptions object using dot notation. For example, enable verbose output.

opts.Verbose = 'on'
opts = 

  ProductionServerArchiveOptions with properties:

            ArchiveName: 'MyServer'
          FunctionFiles: {2×1 cell}
     FunctionSignatures: ''
        AdditionalFiles: {}
    AutoDetectDataFiles: off
        SupportPackages: {'autodetect'}
              OutputDir: 'D:\Documents\MATLAB\work\ProductionServer\'
                Verbose: on

Use the ProductionServerArchiveOptions object as an input to the compiler.build.productionServerArchive function to build a production server archive.

buildResults = compiler.build.productionServerArchive(opts);

Input Arguments

collapse all

Files implementing MATLAB functions, specified as a character vector, a string scalar, a string array, or a cell array of character vectors. File paths can be relative to the current working directory or absolute. Files must have a .m extension.

Example: ["myfunc1.m","myfunc2.m"]

Data Types: char | string | cell

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Verbose','on'

Name of the deployable archive, specified as a character vector or a string scalar. The default name of the generated archive is the first entry of the FunctionFiles argument.

Example: 'ArchiveName','MyMagic'

Data Types: char | string

Flag to automatically include data files, specified as 'on' or 'off', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState (MATLAB).

  • If you set this property to 'on', then data files that you provide as inputs to certain functions (such as load and fopen) are automatically included in the production server archive.

  • If you set this property to 'off', then you must add data files to the archive using the AdditionalFiles property.

Example: 'AutoDetectDataFiles','off'

Data Types: logical

Path to a JSON file that details the signatures of all functions listed in FunctionFiles, specified as a character vector or a string scalar. For information on specifying function signatures, see MATLAB Function Signatures in JSON.

Example: 'FunctionSignatures','D:\Documents\MATLAB\work\magicapp\signatures.json'

Data Types: char | string

Path to the output directory where the build files are saved, specified as a character vector or a string scalar. The path can be relative to the current working directory or absolute.

The default name of the build folder is the archive name appended with productionServerArchive.

Example: 'OutputDir','D:\Documents\MATLAB\work\MyMagicproductionServerArchive'

Support packages to include, specified as one of the following options:

  • 'autodetect' (default) — The dependency analysis process detects and includes the required support packages automatically.

  • 'none' — No support packages are included. Using this option can cause runtime errors.

  • A string scalar, character vector, or cell array of character vectors — Only the specified support packages are included. To list installed support packages or those used by a specific file, see compiler.codetools.deployableSupportPackages (MATLAB Compiler).

.

Example: 'SupportPackages',{'Deep Learning Toolbox Converter for TensorFlow Models','Deep Learning Toolbox Model for Places365-GoogLeNet Network'}

Data Types: char | string | cell

Build verbosity, specified as 'on' or 'off', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState (MATLAB).

  • If you set this property to 'on', then the MATLAB command window displays progress information indicating compiler output during the build process.

  • If you set this property to 'off', then the command window does not display progress information.

Example: 'Verbose','off'

Data Types: logical

Output Arguments

collapse all

Production server archive build options, returned as a ProductionServerArchiveOptions object.

Introduced in R2020b