Creating Packages
DPM packages are defined by a YAML spec file with the extension .dspec.yaml . The spec describes the package, the compiler / platform combinations it supports, the source files and projects to include, and any dependencies on other packages.
Scaffold a starter spec with dpm spec and build it with dpm pack :
dpm spec VSoft.CommandLine
dpm pack VSoft.CommandLine.dspec.yaml -o=i:\dpmfeed
dpm pack produces one .dpkg file per compiler / platform combination defined in targetPlatforms .
Root structure
Key |
Required |
Description |
|---|---|---|
|
no |
Minimum DPM client version required to install or build this package. Note the literal spaces in the key. |
|
no |
Package kind: |
|
yes |
Package identity and descriptive metadata. |
|
no |
Spec-wide variables, referenced as |
|
yes |
Sequence of compiler / platform combinations this package supports. |
|
yes |
Sequence of build templates referenced by |
Skeleton:
min dpm client version: 1.0
metadata:
...
variables:
...
targetPlatforms:
- ...
templates:
- name: default
...
metadata
The metadata section identifies the package and provides descriptive information shown by clients and on the server ui.
Field |
Required |
Description |
|---|---|---|
|
yes |
Package id, e.g. |
|
yes |
Semantic version, e.g. |
|
yes |
Short description of the package. |
|
yes |
Sequence of author names. |
|
no |
URL of the project home page. |
|
no |
URL of the source code repository. |
|
no |
Repository type, e.g. |
|
no |
Default branch name in the repository. |
|
no |
Specific commit hash, or |
|
no |
SPDX license identifier, e.g. |
|
no |
Copyright notice. |
|
no |
Path inside the package to a 64x64 image (PNG with transparent background) shown in the UI. |
|
no |
Path to a README file inside the package. |
|
no |
Release notes text or a path to a release notes file. |
|
no |
Sequence of searchable tags. |
|
no |
Sequence of UI frameworks supported: |
|
no |
|
|
no |
|
Example:
metadata:
id: VSoft.VirtualListView
version: 1.0.0
description: Virtual List View control.
authors:
- Vincent Parrett
projectUrl: https://github.com/VSoftTechnologies/VSoft.VirtualListView
repositoryUrl: https://github.com/VSoftTechnologies/VSoft.VirtualListView
license: Apache-2.0
copyright: Vincent Parrett and contributors
tags:
- list
- virtual
frameworks:
- VCL
Package id rules
The id is validated when the spec is loaded (during dpm pack and when a client reads the package). An invalid id causes the pack to fail. The rules are:
Dotted segments - the id is two or more segments separated by dots (
.), conventionallyOrganisation.PackageName(e.g.VSoft.CommandLine). At least one dot is required.First segment - must start with an ASCII letter and be at least 3 characters long.
Allowed characters - ASCII letters (
A-Z,a-z), digits (0-9) and underscore (_) within each segment, with.as the segment separator. Hyphens, spaces and other punctuation are not allowed.Subsequent segments - each segment after a dot must be at least 1 character.
Length - 100 characters maximum.
Matching is case-insensitive, though ids are conventionally PascalCase.
Example |
Valid |
Reason |
|---|---|---|
|
yes |
|
|
yes |
digits are allowed within a segment |
|
yes |
more than two segments are fine |
|
no |
no dot - needs at least two segments |
|
no |
first segment is shorter than 3 characters |
|
no |
must start with a letter |
|
no |
hyphen is not allowed |
targetPlatforms
targetPlatforms is a sequence of entries that each declare which compiler(s) and platform(s) the package supports. Each entry uses exactly one of three compiler-specification forms.
Single compiler:
targetPlatforms:
- compiler: 12.0
platforms: [Win32, Win64]
template: default
Compiler range (inclusive on both ends):
targetPlatforms:
- compiler from: XE2
compiler to: 12.0
platforms: [Win32, Win64]
template: default
Note: compiler from and compiler to contain literal spaces - they are not camel case.
Discrete list of compilers:
targetPlatforms:
- compilers: [XE2, XE7, 12.0]
platforms: [Win32, Win64]
template: default
Per-entry fields:
Field |
Required |
Description |
|---|---|---|
|
one of the three |
A single compiler version. |
|
one of the three |
Lower bound of an inclusive compiler range. Used with |
|
one of the three |
Upper bound of an inclusive compiler range. Used with |
|
one of the three |
Sequence of compiler versions. |
|
yes |
Sequence of platforms supported by this entry. See the platform list below. |
|
no |
Name of a |
|
no |
Mapping of variable overrides applied only to this entry. |
Supported compiler versions
Value |
Delphi version |
|---|---|
|
Delphi XE2 |
|
Delphi XE3 |
|
Delphi XE4 |
|
Delphi XE5 |
|
Delphi XE6 |
|
Delphi XE7 |
|
Delphi XE8 |
|
Delphi 10 Seattle |
|
Delphi 10.1 Berlin |
|
Delphi 10.2 Tokyo |
|
Delphi 10.3 Rio |
|
Delphi 10.4 Sydney |
|
Delphi 11 Alexandria |
|
Delphi 12 Athens |
|
Delphi 13 |
Supported platforms
Value |
Description |
|---|---|
|
Windows 32-bit |
|
Windows 64-bit |
|
Windows on ARM64EC |
|
macOS 32-bit (legacy) |
|
macOS 64-bit Intel |
|
macOS ARM64 (Apple Silicon) |
|
Android 32-bit |
|
Android 64-bit |
|
iOS 32-bit (legacy) |
|
iOS 64-bit |
|
iOS Simulator (Intel) |
|
iOS Simulator (ARM64) |
|
Linux 64-bit |
Not every platform is valid for every compiler - older compilers only target Windows, and design-time packages are limited to Win32 and Win64 (plus Win64 from Delphi 12 onwards).
templates
templates is a sequence of named build templates. Each targetPlatforms entry references a template by name (defaulting to default ). A template describes the dependencies, source files, and projects that go into the package.
Field |
Description |
|---|---|
|
Template identifier. Required. |
|
Sequence of dependency entries. |
|
Sequence of source-file entries to include in the package. |
|
Sequence of runtime package projects to build. |
|
Sequence of design-time package projects to build. |
|
Sequence of package projects for DPM to generate for source-only libraries that ship no |
|
Mapping of IDE environment variables to set while the package is loaded in the IDE. |
dependencies
Each dependency declares another DPM package that must be installed alongside this one. Use the special token $version$ to pin to the current package's own version.
dependencies:
- id: Spring4D.Core
version: "[2.0.0,)"
- id: VSoft.SemanticVersion
version: "[1.0.0,2.0.0]"
- id: MyCompany.Shared
version: $version$
- id: Indy.System
version: bundled
Field |
Required |
Description |
|---|---|---|
|
yes |
Dependency package id. |
|
yes |
Version range, or the special token |
The special version
bundleddeclares a dependency on a library that ships with the Delphi IDE (such as Indy) and has no DPM package. See Bundled Dependencies .
source
source Each entry maps one or more files from the project's working tree into the package archive.
source:
- src: ./src/*.pas
dest: src
exclude:
- "*.dcu"
- "Test*.pas"
- src: ./inc/*.inc
dest: inc
- src: ./resources/*.res
dest: src
copyToLib: true
- src: ./bin/Win32/*.dll
copyToBin: Win32
Field |
Required |
Description |
|---|---|---|
|
yes |
Relative path or glob describing which files to include. Supports |
|
no |
Destination folder within the package. If omitted, the relative directory structure is preserved. |
|
no |
Sequence of glob patterns to exclude from this |
|
no |
When |
|
no |
A platform name, e.g. |
build
build lists runtime package projects (.dpk / .dproj ) to compile into the package.
build:
- project: ./packages/$packageSource$/MyPackage.dproj
platforms: [Win32, Win64]
defines: RELEASE;DPM
Field |
Required |
Description |
|---|---|---|
|
yes |
Path to a |
|
no |
Sequence of platforms to build. Defaults to the platforms of the enclosing |
|
no |
Semicolon-separated additional compiler defines. |
|
no |
Extra package names (e.g. |
design
design lists design-time package projects to build. Design-time packages are installed into the IDE and so are limited to Win32 (and Win64 from Delphi 12 onwards).
design:
- project: ./packages/$packageSource$/MyPackageDesign.dproj
platforms: [Win32]
defines: DESIGNTIME
libPrefix: dcl
libSuffix: "280"
Field |
Required |
Description |
|---|---|---|
|
yes |
Path to a design-time |
|
no |
Defaults to |
|
no |
Semicolon-separated compiler defines. |
|
no |
Extra package names (e.g. |
|
no |
Override library prefix. Defaults to |
|
no |
Override library suffix, e.g. |
|
no |
Override library version string. |
package definitions
Some libraries ship only .pas source and no Delphi package projects (.dpk / .dproj ) - this is common for packageKind: git source libraries. The package definitions section describes the package projects DPM should generate for such a library. On install, DPM renders the .dpk / .dproj into the package cache and the matching build / design entry compiles them, so consumers still get precompiled, IDE-installable packages.
Note the literal space in the package definitions key - it is not camel case.
package definitions:
- project: ./packages/MyLibR.dproj # path + name to generate
kind: runtime # optional - inferred when omitted (see below)
requires: # extra requires beyond rtl
- vcl
files: # globs (same syntax as a source src)
- ./src/*.pas
exclude: # optional - file-name globs to drop
- "*.Tests.pas"
platforms: [Win32, Win64] # optional - overrides targetPlatform platforms
- project: ./packages/MyLibDesign.dproj
kind: design
requires: [vcl, MyLibR]
files: [./design/*.pas, ./design/*.dfm]
Field |
Required |
Description |
|---|---|---|
|
yes |
Path + name of the |
|
yes |
Globs for the units to include ( |
|
no |
|
|
no |
Packages added to the dpk |
|
no |
Glob patterns (matched against file names) removed from the matched |
|
no |
Overrides the enclosing |
Note: Because
kindinference keys offdesignide, a design package that lists onlyvcl/fmxin its requires should setkind: designexplicitly.
environment variables
A template may declare IDE environment variables that DPM sets while the package is loaded in the IDE, and clears (restoring any previous value) when it is removed.
templates:
- name: default
design:
- project: ./packages/MyLibDesign.dproj
environmentVariables:
MYLIBDIR: $packageDir$ # a custom variable pointing at the package
PATH: $packageDir$\Binary\Shared # appended to PATH (never replaces it)
How they behave:
Process environment only. DPM sets these on the running IDE process , so the compiler / MSBuild and any DLLs the IDE loads inherit them. It does not write the IDE's persistent registry environment variables, so they are not the same as Tools | Options
$(Var)project macros. State is session-scoped and rebuilt each time the package is restored / loaded.Distinct from
variables. The variables section is pack-time text substitution baked into the spec when packing;environmentVariablesare applied on the consumer machine at install / load time.PATHis append-only. ThePATHkey (case-insensitive) is appended to (semicolon-separated directories supported) and reference counted - never replaced. Directories present onPATHat IDE startup are never removed.Conflict policy. For a non-
PATHvariable that already exists in the process environment, its value is captured, overwritten, and restored when the last package that set it is removed.
Values are expanded in two stages:
Stage |
What is expanded |
|---|---|
Pack time |
Package- and |
Install time (IDE) |
|
$packageDir$is exclusive toenvironmentVariablesvalues. They are the only values DPM processes at install time, so using$packageDir$anywhere else in the spec (asrc,project,dest, regularvariablesvalue, etc.) is an error at pack time .
For system stability and to prevent executable-hijack redirection, packing fails if a package declares any of a set of reserved variable names (compared case-insensitively). PATH is allowed (append-only) and is not reserved. The reserved names are:
Executable redirection:
PATHEXT,COMSPEC,SYSTEMROOT,WINDIR,SYSTEMDRIVE.OS / user profile:
TEMP,TMP,USERPROFILE,PUBLIC,HOMEDRIVE,HOMEPATH,APPDATA,LOCALAPPDATA,PROGRAMDATA,ALLUSERSPROFILE,PROGRAMFILES,PROGRAMFILES(X86),PROGRAMW6432,COMMONPROGRAMFILES(and(X86)/W6432),USERNAME,USERDOMAIN,COMPUTERNAME,LOGONSERVER,OS,NUMBER_OF_PROCESSORS,PROCESSOR_ARCHITECTURE(andW6432),PROCESSOR_IDENTIFIER.RAD Studio built-ins:
BDS,BDSBIN,BDSINCLUDE,BDSLIB,BDSCOMMONDIR,BDSUSERDIR,BDSPROJECTSDIR,BDSPLATFORMSDKSDIR,BDSCATALOGREPOSITORY(andALLUSERS),DELPHI,BCB,FRAMEWORKDIR,FRAMEWORKVERSION.
variables
variables are reusable values you can reference anywhere in the spec using $name$ substitution. Use them to avoid repeating compiler-specific folder names or build flags.
Variables can be declared at the spec root and overridden per targetPlatforms entry:
variables:
packageSource: "Delphi $compilernoprefix$ $compilerCodeName$"
targetPlatforms:
- compiler: delphi10.0
platforms: [Win32, Win64]
# override for this compiler version
variables:
packageSource: "Delphi 10 $compilerCodeName$"
Variable values may themselves contain other variables (see below).
Built in variables
dpm pack expands $name$ references before processing the spec. Names are matched case-insensitively , and references may appear in paths, file globs, defines , and other variable values. An unknown name causes the pack to fail - only the variables listed below (plus any you defined in variables or supplied via dpm pack -variables=name=value;... ) are valid.
Example expansions are shown for Delphi 12.0 (Athens). The same variables work for every supported compiler.
Variable |
Expands to |
|---|---|
|
Package version. Defaults to |
|
Compiler version (the lowercase enum name), e.g. |
|
Alias for |
|
Compiler version without the |
|
Major number only, with no prefix and no minor, e.g. |
|
Compiler with the dot removed, e.g. |
|
Delphi release code name from 10.0 onwards, e.g. |
|
|
|
Internal Delphi compiler version as an integer string, e.g. |
|
Simplified compiler version used by some - xe2-xe8, then 100, 101,102, 103,104,110,120,130 |
|
DCC lib suffix for the compiler, e.g. |
|
BDS / RAD Studio product version, e.g. |
Any name you define under variables: (at the spec root or per targetPlatforms entry) is also available as $name$ , and variable values may themselves reference other variables.
Complete example
min dpm client version: 1.0
metadata:
id: Gabr42.OmniThreadLibrary
version: 3.7.12
description: A powerful threading library for Delphi.
authors:
- Primož Gabrijelčič
projectUrl: https://github.com/gabr42/OmniThreadLibrary
repositoryUrl: https://github.com/gabr42/OmniThreadLibrary
license: BSD-3-Clause
copyright: Primož Gabrijelčič
readme: README.md
tags:
- threading
- async
variables:
packageSource: "Delphi $compilernoprefix$ $compilerCodeName$"
targetPlatforms:
- compiler from: XE2
compiler to: XE8
platforms: [Win32, Win64]
- compiler: 10.0
platforms: [Win32, Win64]
variables:
packageSource: "Delphi 10 $compilerCodeName$"
- compiler from: 10.1
compiler to: 13.0
platforms: [Win32, Win64]
templates:
- name: default
# Omnithread has all source in the root, so we specify dest to move it where we want it
source:
- src: ./*.pas
dest: src
- src: ./*.inc
dest: src
- src: ./LICENSE.txt
dest: src
- src: ./src/**/*.pas
dest: src/src
exclude:
- ./tests/**
- ./examples/**
- src: ./packages/$packageSource$/**
dest: src/packages/$packageSource$
build:
- project: ./src/packages/$packageSource$/OmniThreadLibraryRuntime.dproj
design:
- project: ./src/packages/$packageSource$/OmniThreadLibraryDesigntime.dproj
See also
spec command - scaffold a new
.dspec.yaml.pack command - build
.dpkgfiles from a spec.prepare command - generate per-compiler dpk/dproj subfolders.
Version Range - the dependency version range syntax.