Main Content

padv.util.unpackExternalCodeCache

Unpack code generation target from Simulink cache files

    Description

    padv.util.unpackExternalCodeCache(cacheFiles) unpacks the code generation target from the Simulink® cache files, cacheFiles.

    An external code cache allows your team to generate code in parallel while maintaining up-to-date task results. For information on parallel code generation, see the property GenerateExternalCodeCache for the built-in task padv.builtin.task.GenerateCode.

    If your team generates code in parallel by generating an external code cache, downstream tasks that depend on the generated code need to unpack the generated code target before running the task action. Built-in tasks that depend on generated code, like padv.builtin.task.AnalyzeModelCode, unpack the code generation target by using the utility function padv.util.unpackExternalCodeCache.

    This functionality requires CI/CD Automation for Simulink Check.

    example

    Examples

    collapse all

    Generate and unpack code generation target.

    Open the parallel code generation example.

    processAdvisorParallelExampleStart

    Generate code by running a code generation task iteration. For example, run the code generation task on the reference model OuterLoop_Control.

    runprocess(Tasks = "padv.builtin.task.GenerateCode", ...
        FilterArtifact = fullfile("02_Models","OuterLoop_Control", ...
        "specification","OuterLoop_Control.slx"));

    Find the external code cache file by using the built-in query.

    q = padv.builtin.query.FindExternalCodeCache;
    artifactsArray = run(q);

    Unpack the cache file.

    padv.util.unpackExternalCodeCache(artifactsArray);

    Input Arguments

    collapse all

    Absolute or relative address for external code cache files, specified as either an array of padv.Artifact objects, a cell array of character vectors, or a string array.

    The built-in code generation task, padv.builtin.task.GenerateCode, generates these cache files when you specify the task property GenerateExternalCodeCache as true.

    The files must be:

    • .slxc.bk files

    • compatible with the slxcunpack function

    • inside the project root folder