Skip to content

PackageDefinition

marchbold edited this page Jun 25, 2021 · 9 revisions

Package

A package defines a library and it's dependencies.

  • version
  • location
  • dependencies
  • Android manifest additions
  • iOS Info Additions and Entitlements
  • required configuration variables to be inserted into the above

A package is a single package file comprised of a series of files in a structure with a main "package definition" file.

Structure

A package is a zip file containing the following structure:

|____ package.json
|____ README.md
|____ CHANGELOG.md
|____ LICENSE.md
|____ android.xml
|____ ios.xml
|____ lib /
  |____ [ANY SWC LIBRARIES CONTAINED IN THIS PACKAGE]
|____ src /
  |____ [ANY AS3 SOURCE CONTAINED IN THIS PACKAGE]
|____ ane /
  |____ [ANY EXTENSIONS CONTAINED IN THIS PACKAGE]

All of the content is optional, except the package definition json and a README.md file. All of the content packaged will be included in a build so don't include the source for a swc alongside the swc or you will end up with duplicate definitions. (You should create two different packages if you wish to create a source and compiled version of your package).

Normally a package should contain only one of the directories: lib, src, ane.

Index

A file(s) containing information about the library.

package.json:

{
    "id": "com.package.example",
    "name": "Example package definition",
    "url": "https://example.com/package/",
    "description": "An example of a package definition",
    "type": "swc",

    "version":"1.0.0",
    "checksum" : "XXXXXXXXX",
    "dependencies": [
        { 
            "id": "com.package.dependency.a", 
            "version": "2.4.0"
        },
        { 
            "id": "com.package.dependency.b", 
            "version": "3.1.0"
        },
        "com.package.dependency.c:4.0.0", 
    ],
    "configuration": [
        "packageParam",
        "requiredParam:required",
        {
            "name": "paramName",
            "required": "true"
        }
    ],
    "sourceUrl": "https://example.com/package/swc/v1.0/com.package.example.zip"
}

Creating a package

To create a package use the create command to construct a basic template:

apm create

You can specify a subdirectory to be used to keep content in a subdirectory if required:

apm create packageFolder

This will ask a few questions (package name, identifier, version etc) and will create something similar to the following structure populated with the data:

|____package.json
|____README.md
|____ane
|____lib
|____src

Building a package

Once you have completed placing your content in the structure you can use the build command to construct the package zip.

apm build 

(or use the folder name if you have if in a subdirectory apm build packageFolder)

This will verify the content and then construct a zip file which you can publish.

Publishing

TODO

Clone this wiki locally