Adaptive Framework 0.9.0

Usage

When invoking afwdev, you may specify general options, followed by a subcommand, followed by subcommand-specific options.

afwdev [options...] {subcommand} [subcommand-options...]

Command afwdev is a development tool used to create, extend, maintain, and test an Adaptive Framework (AFW) Package.

An AFW package can be the one that holds the AFW core (afw) or other AFW packages that contains AFW applications, commands, extensions, layouts, servers, test data, etc.


General Options

The following are a list of general options, which may be used for all subcommands:

OptionDescription
--debugInclude maximum detail in output including afwdev debug info.
--quietOnly output errors.
--verboseInclude more detail in output.
--nopromptDo not prompt for missing or invalid arguments. The --prompt argument overrides this argument.
--promptPrompt for all missing optional arguments even if they normally would not be.
--versionDisplay version information.
--version-stringDisplay version string information (no git info).

Subcommands

The following subcommands are available:

SubcommandDescription
add-adaptor-typeAdd a new adaptor type
add-content-typeAdd a new content type
add-core-interfaceAdd a core interface
add-log-typeAdd a new log type
afwdev-parser-infoafwdev parse info as xml
buildBuild afw package
ebnfGenerate EBNF diagrams
forRun a command in a set of directories.
generateProcess /generate/
make-afw-packageMake a AFW package directory.
make-commandMake a new command
make-extensionMake a new extension
settingsPrint settings
taskRun a personalized afwdev task
testRun tests
validateValidate json files using JSON Schemas

add-adaptor-type

This will add skeletons for the basic interfaces afw_adaptor_factory, afw_adaptor, and afw_adaptor_session for a new adaptor type to an existing srcdir. The implementation_id specified will be the adaptor type. If additional interfaces are needed, use subcommand add-core-interface.

The following options may be used for the add-adaptor-type subcommand:

OptionDescription
<implementation_id>Implementation id of this {thing}.
--srcdirName of source directory for this {thing}.
--prefixThe prefix for file names in the source directory for this {thing}.
--briefA brief description for this {thing} without an ending period.
--descriptionThe description for this {thing}.

add-content-type

This will add skeletons for interfaces afw_content_type and afw_content_type_object_list_writer for a new content type to an existing srcdir, plus add a .c to generate/manifest/content_type/. The implementation_id specified will be the content type id.

The following options may be used for the add-content-type subcommand:

OptionDescription
<implementation_id>Implementation id of this {thing}.
--srcdirName of source directory for this {thing}.
--prefixThe prefix for file names in the source directory for this {thing}.
--briefA brief description for this {thing} without an ending period.
--descriptionThe description for this {thing}.

add-core-interface

This will add a skeleton for a core interface to an existing scrdir.

The following options may be used for the add-core-interface subcommand:

OptionDescription
<interface>The name of the core interface to add.
<implementation_id>Implementation id of this {thing}.
--srcdirName of source directory for this {thing}.
--prefixThe prefix for file names in the source directory for this {thing}.
--briefA brief description for this {thing} without an ending period.
--descriptionThe description for this {thing}.

add-log-type

This will add the skeletons for the interfaces afw_log_factory and afw_log for a new log type to and existing srcdir. The implementation_id specified will be the log type id. If additional interfaces are needed, use subcommand add-core-interface.

The following options may be used for the add-log-type subcommand:

OptionDescription
<implementation_id>Implementation id of this {thing}.
--srcdirName of source directory for this {thing}.
--prefixThe prefix for file names in the source directory for this {thing}.
--briefA brief description for this {thing} without an ending period.
--descriptionThe description for this {thing}.

afwdev-parser-info

This subcommand will write the info used for afwdev argument parse to json.

The following options may be used for the afwdev-parser-info subcommand:

OptionDescription
<output_path>Output file path for {thing}.

build

This subcommand will build an AFW package using information from the afw-package.json file.

The build switches --cmake, --docker, --docs, --js provide build type context that other switches, such as --clean, --install, and --generate will execute under. The --all selects all of those contexts.

The following options may be used for the build subcommand:

OptionDescription
--allThis is short for for the build type context switches --cmake, --docker, --docs, and --js.
--cdevThis is a shortcut to enable common switches used during C development.
--cleanClean the build directory for each selected build type context before starting the build.
--cmakeThis is the build type context switch to build everything that uses cmake in the AFW package. If no other build type context switches are specified, this is the default.
--dockerThis is the build type context switch to build docker related parts of the AFW package.
--docsThis is the build type context switch to build the docs for the AFW package.
--generateCall afwdev generate --srcdir-pattern \* before build.
--installInstall the built AFW package.
--jobsAdd -jobs [N] to make. If not specified, the "make_jobs_argument" property in the afwdev-settings.json file will be used if it exists.
--jsBuild JavaScript related parts of the AFW package.
--maxloopThis option is used by analyze-build. Specify the number of times a block can be visited before giving up. Increase for more comprehensive coverage at a cost of speed.
--prefixThis is the directory path that is prepended onto all install directories.
--scanUse clang analyze-build to analyze C source after compilation. Errors will cause the build to fail.
--sudoUse sudo command when doing the install.

ebnf

This will generate EBNF diagrams from core syntax.ebnf.

for

This will run a command in a set of directories identified by the --set-name argument.

The set name is the name of the settings['forSets'] property that has the list of directories to use.

Use the afwdev settings command and its --help for more information.

The following options may be used for the for subcommand:

OptionDescription
<command>This is the command to run in a set of directories. If the command has arguments, it needs to be in quotes. Backslashes ('\') will need to be escaped with a backslash. Multiple commands can be separated by "&&".
--ignore-errorsIf specified, the failure of a command in one directory will not stop the running of the command in the remaining directories.
--set-nameThis is the "set name" used to identify the set of directories in which to run the command.

generate

Process generate/ directories. The SRCDIR_PATTERN is based on a subset of the rules used by unix shell and indicates that all matching directories that contain a generate/ directory should be processed. See src/afwdev/doc/generate.txt in the AdaptiveFramework core package for more information.

The following options may be used for the generate subcommand:

OptionDescription
--srcdir-pattern name pattern

make-afw-package

This will make a new skeleton Adaptive Framework AFW package directory. The implementation_id specified will be the AFW Package Id and afw_package_dir_path it the new AFW packages directory path. An AFW package can hold AFW applications, commands, extensions, etc. The first afwdev make-extension issued in this AFW package will hold the package's manifest.

The following options may be used for the make-afw-package subcommand:

OptionDescription
<implementation_id>Implementation id of this {thing}.
<afw_package_dir_path>Directory path of new AFW package.
--briefA brief description for this {thing} without an ending period.
--descriptionThe description for this {thing}.

make-command

This will make a new command skeleton directory. The implementation_id specified will be the command name. Although more common for extensions, add-* subcommands can be used to add interfaces to this command.

The following options may be used for the make-command subcommand:

OptionDescription
<implementation_id>Implementation id of this {thing}.
--srcdirName of source directory for this {thing}.
--prefixThe prefix for file names in the source directory for this {thing}.
--nameThe command name.
--briefA brief description for this {thing} without an ending period.
--descriptionThe description for this {thing}.

make-extension

This will make a new extension skeleton directory that can hold implementations of AFW interfaces. The implementation_id specified will be the extension id. Use add-* subcommands to add interfaces to this extension.

The following options may be used for the make-extension subcommand:

OptionDescription
<implementation_id>Implementation id of this {thing}.
--srcdirName of source directory for this {thing}.
--prefixThe prefix for file names in the source directory for this {thing}.
--nameThe base part of library name (without .so). The name must begin with "lib".
--briefA brief description for this {thing} without an ending period.
--descriptionThe description for this {thing}.

settings

This will print the settings used by afwdev. " An "afwdev-settings.json" and/or an "afw.code-space" file located in the current AFW package directory, one of its parents or your home directory is used to produce these settings when afwdev starts. If none of these files exist, settings apply to your current AFW package directory.

Information from "afwdev-settings.json" is load into settings first then normalized.

If the "afwPackages" property does not exist, it will be constructed from paths in the folders of "afw.code-space" that contain an "afw-package.json" file or with a single entry for the current AFW package's root directory.

If a "forSets['default']" property doesn't exist, one is created with all of the paths in "afwPackages".

All paths in settings are normalized to their full path with a '/' at the end of all directory names.

The path to the "code-space" file can be explicitly specified with a "code_workspace_path" property in "afwdev-settings.json".

The default make --jobs argument for afwdev build can be specified with the "make_jobs_argument" property. For example, "make_jobs_argument":"--jobs 4" will run make using 4 threads if the -jobs argument is not specified on afwdev build.

task

This will run the command(s) supplied by the "tasks" object property of afwdev-settings.json with a property name matching the specified task_name. Multiple commands can be separated by "&&". The failure of a command will cause the remaining commands to be skipped.

The following options may be used for the task subcommand:

OptionDescription
<task_name>The task name.

test

Run tests for one more more source directories.

The following options may be used for the test subcommand:

OptionDescription
--bailStop after [N] failed test.
--listList tests (do not run)
--tagsTest tags to match and run
--errorsOnly show errors.
--coverageList test coverage
--srcdir-pattern name pattern
--watchWatch for changes and re-run tests
--jobsAdd -jobs [N] to test. If not specified, the "test_jobs_argument" property in the afwdev-settings.json file will be used if it exists.
--env-modeThe test environment mode to use.
--outputWhere to send test output (default is stdout).
--jsRun Javascript and Web App tests.

validate

This command will validate json files using JSON Schemas in the generate/schemas/afw/ directory.

The pattern of objects to be validated are specified using the --pattern argument. The default for pattern is "src/*/generate*/objects/*/*.json".

This pattern can have "*", "?", and "**" wildcards, much like Unix style pathname patterns. The "**" wildcard will match any number of directories and subdirectories. For example, the pattern "src/**/objects/*/*.json" will match all *.json files in the objects/ directory of any subdirectory of the src/ package directory. '*' will match any number of characters except a '/' and '?' will match any single character except a '/'.

If the pattern starts with a "/", it will be treated as an absolute path. If it does not start with a "/", it will be treated as a relative path within the afw package root directory that afwdev is operating on.

If a json file contains a "$schema" property, the value of that property will be used to determine the schema to use. Otherwise, the schema will be determined by the parent directory of the file. For example, if the json file is in the "src/afw/generate/objects/_AdaptiveDataType_" directory, the "_AdaptiveDataType_.json" schema in the "generated/schemas/afw/" directory will be used.

The following options may be used for the validate subcommand:

OptionDescription
--errorsOnly show validation errors.
--bailStop on first validation failure.
--patternOne or more patterns, separated with a semicolon (';'), of files to validate.

Examples


Directory structure of an AFW package
-------------------------------------

The basic structure of an AFW package is:

<AFW package root directory>
|-- doc/                         # Generated docs                   
|-- generated/                   # Produced by generate subcommand
|   |-- *.cmake                  # Generated cmake files
|-- src/                         # Commonly src/ contains source directories
|   |-- <SRCDIR>/                # One or more command, extension, or server
|       |-- generate/            # Processed by generate subcommand
|       |-- generated/           # Produced by generate subcommand
|       |   |-- c source         # Generated *.h and .c files
|       |   |-- *.cmake          # Generated cmake files
|       |   |-- ...              # Other generated files and directories
|       |-- c source             # <SRCDIR>_*.h and .c files
|       |-- CMakeLists.txt       # CMakeLists.txt for <SRCDIR>
|       |-- ...                  # Other source files and directories
|-- .editorconfig                # Source editor coding style
|-- .gitattributes               # Command git attributes for pathnames
|-- .gitignore                   # Command git files to ignore
|-- afw-package.json             # AFW package file managed by the afwdev
|-- CMakeLists.txt               # Root CMakeLists.txt for afw package
|-- COPYING                      # Licensing information.
|-- Doxyfile                     # Doxygen configuration file
|-- LICENSE                      # The license.
|-- package.json                 # Used to build a JavaScript package
|-- <PACKAGE_ID>_git_info.sh     # Used to produce <PACKAGE_ID>_git_info.h
|-- <PACKAGE_ID>_git_info.h      # Header file containing git information
|-- README.md                    # Repository README.md
|-- miscellaneous directories    # Other directories
|-- miscellaneous files          # Other files

Zero or more <SRCDIR> directories can exist.  Each <SRCDIR> contains the
source for one command, extension, or server implementation provided by the
AFW package. There can also be <SRCDIR> directories for other buildtypes.
This information is kept in afw-package.json.

All make-* subcommands make a new directory. The make-afw-package subcommand
makes a skeleton package directory that includes an afw-package.json file.
The other make-* subcommands make a skeleton directory in the src/ directory
and adds an entry to the afw-package.json "srcdir" property.

All add-* subcommands expect an existing "srcdir" entry in the afw-package.json
file that is either their implementation id or the value specified with the
--srcdir argument.

All add-* and make-* subcommands produces files with @todo comments that
should be searched for and replaced as appropriate.

If certain optional arguments are not specified, a prompt will occur that
allows the default value to be overridden. If the --noprompt argument is
specified or the specific optional argument is defined to never prompt, this
prompting will not occur. Specify the --prompt argument to insure prompting
occurs for all missing optional parameters.

Examples
--------

1) Make an AFW package "mypackage" in directory ~/mypackage:

    afwdev make-afw-package mypackage ~/mypackage

2) Make an extension "myextension" srcdir in "mypackage":

    cd ~/mypackage
    afwdev make-extension myextension

3) Add an adaptor type with id "myadaptor" to "myextension":

    cd ~/mypackage
    afwdev add-adaptor-type myadaptor --srcdir myextension

4) Make command "mycommand" srcdir in "mypackage":

    cd ~/mypackage
    afwdev make-command mycommand

5) Generate afwdev maintained files for "mypackage" after changes:

    cd ~/mypackage
    afwdev generate --srcdir-pattern \*

6) Run tests defined in "mypackage":

    cd ~/mypackage
    afwdev test --srcdir-pattern \*

7) Run tests defined in "mypackage" and show only errors:

    cd ~/mypackage
    afwdev test --errors --srcdir-pattern \*