ZX: set dep

zx set dep PackageID

Adds or updates a dependency specified for the current project.

Note that this command requires a fully-qualified PackageID; partial version numbers are not permittied. Current versions can be queried from the Zomp network using the "latest" and "list versions" commands.

REMEMBER: Because dependencies are statically defined, version updates to existing deps, inclusion of new deps and removal of existing deps require (at least) a patch version increase to the dependent project and submission of the new patch version of the package to the hosting realm.

Adding a Dependency

There are two cases where a project must define its dependencies:

  1. Application execution dependencies
  2. Library dependency version recommendations

Applications and dependent packages are fetched, built and launched by ZX at runtime, and for this reason must declare all of their dependencies explicitly. Dependencies are statically defined in a flat list. ZX does not recurse through the probable dependency tree and resolve latest versions of dependencies automatically; it instead builds and includes exactly the package versions an application defines as its dependencies every time a specific application version is launched. This means that the burden of deconflicting the dependency graph is left up to the developer and/or the packager. This process is dramatically assisted, however, by the fact that all dependencies will themselves possess a complete, flat list of their own dependencies, meaning developers/packagers do not need to deeply traverse the dependency graph themselves but instead only require referencing a single layer.

In connection with the paragraph above, authors and packagers of library code that depends on other packagers must provide dependency information about their libraries to make their own dependencies researchable by authors of applications or other libraries using them.

The "list deps" command is provided by to make discovery of dependencies more user-friendly (who wants to manually run a bajillion "list" commands?).

For example, if a project "otpr-foo" depends on "otpr-bar" which depends on "otpr-baz" and "otpr-balls", but none of these have yet been declared in the current project:

ceverett@takoyaki:~/code/foo$ zx list deps
ceverett@takoyaki:~/code/foo$ zx latest otpr-bar
3.2.0
ceverett@takoyaki:~/code/foo$ zx set dep otpr-bar-3.2.0
ceverett@takoyaki:~/code/foo$ zx list deps otpr-bar-3.2.0
otpr-balls-0.3.1
otpr-baz-1.3.2
ceverett@takoyaki:~/code/foo$ zx set dep otpr-baz-1.3.2
ceverett@takoyaki:~/code/foo$ zx set dep otpr-balls-0.3.1
ceverett@takoyaki:~/code/foo$ zx list deps
otpr-balls-0.3.1
otpr-bar-3.2.0
otpr-baz-1.3.2
ceverett@takoyaki:~/code/foo$ 

In the case where several packages all depend on different versions of a common dependency it is the job of the packager to determine which versions of a set of dependencies can work together and specify those versions as the dependencies of the current package version being worked on.

Because packages must adhere strictly to the semver recommendation there is a strong potential for the further development of automatic dependency compatibility resolution tools for the purpose of easing the burden faced by packagers of very large projects, though this work has not yet been engaged.

Updating a Dependency Version

Once a dependency is defined by a package its version is fixed. If want to change the version number of a dependency you simply run "set dep" again and the current dependency definition will be overwritten with the new version. Continuing from the previous example:

ceverett@takoyaki:~/code/foo$ zx set dep otpr-balls-1.2.0
ceverett@takoyaki:~/code/foo$ zx list deps
otpr-balls-1.2.0
otpr-bar-3.2.0
otpr-baz-1.3.2
ceverett@takoyaki:~/code/foo$