Asset Bundle

Asset Bundle

An asset bundle is an archive that contains executables, libraries, static data or any other artifacts that are required by an app/applet. An asset bundle is represented on the platform as a hidden file which in turn is referenced by a visible record object of type AssetBundle. The record object must have:

  • A type AssetBundle
  • A property with key version and value specifying a version number of the asset
  • A details JSON object of the following form:

    { "archiveFileId": {"$dnanexus_link": "hidden_arcive_file_id"} }

The record can be created using the following command:

dx new record -o assetname --type AssetBundle [...]

The record's name is used to identify the asset; see below for an example.

Example:

dx new record -o bwa --type AssetBundle --property version=0.0.1 --details '{"archiveFileId": {"$dnanexus_link": "file-Bq31x500kXGgQ0ZG0G5G6v84"}}' --close

An app/applet can refer to an asset bundle using the runSpec.assetDepends metadata field in dxapp.json. This is a convenient alternative to specifying the runSpec.bundledDepends directly. The asset bundle can be specified in either one of the following two ways:

1.

"assetDepends": [
    {
        "id": "asset_bundle_record_id"
    }
]

In this scenario, the record object with the given ID is found.

2.

"assetDepends": [
    {
        "name": "asset_bundle_record_name",
        "project": "asset_bundle_record_project_id",
        "version": "asset_bundle_record_version_number",
        "folder": "asset_bundle_record_folder_name"
    }
]

In this scenario, we search for a record object of type AssetBundle with the given name, project, folder and with property version.

For each entry in the assetDepends, during the app/applet build process, the file specified by the the asset bundle's details.archiveFileId field will be added to the runSpec.bundledDepends of the executable.

Last edited by Phil Sung, 2016-03-02 06:43:30

 Feedback