Skip to content

Commit 18c1729

Browse files
add brief description of common extension points (#53)
* add brief description of common extension points * Apply suggestions from code review Co-Authored-By: Marya Belanger <[email protected]>
1 parent 1bb8da8 commit 18c1729

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

developer/extension-point.rst

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Extension points
2+
================
3+
4+
The following describes some of the extension points and how they are used.
5+
6+
VerbExtensionPoint
7+
------------------
8+
9+
This extension point is used by the ``colcon`` command.
10+
Each verb extension defines custom logic which can be invoked by calling ``colcon <verb>``.
11+
Each verb extension can add command line arguments to the verb specific subparser in ``argparse``.
12+
13+
PackageDiscoveryExtensionPoint
14+
------------------------------
15+
16+
This extension point is used by verb extensions.
17+
Each package discovery extension can add command line arguments which are grouped in the "Discovery arguments" section of the usage help.
18+
Each extension returns a set of package descriptors which identify a package with the tuple path, name, and type.
19+
While a package discovery extension only provides candidate paths it uses the package identification extension point to determine if a path contains a package.
20+
21+
If explicit arguments are provided for any package discovery extensions only those extension are being used.
22+
Otherwise the package discovery extensions which provide a default value are used.
23+
24+
PackageIdentificationExtensionPoint
25+
-----------------------------------
26+
27+
This extension point is used by package discovery extensions.
28+
A package identification extension determines if a given path contains a package and returns the tuple path, name, and type.
29+
30+
Package identification extensions are grouped by their priority.
31+
The extensions are invoked in order of their priority and the first extension successfully identifying a package stops further extensions from being considered.
32+
33+
If multiple extensions have the same priority they are all invoked.
34+
If more than one extension within the priority group identifies the package in the given path the result must be identical or a warning is printed and the path is skipped.
35+
36+
PackageAugmentationExtensionPoint
37+
---------------------------------
38+
39+
This extension point is used by verb extensions after packages have been discovered and identified.
40+
A package augmentation extension can add arbitrary information to a package descriptor, like additional dependencies.
41+
42+
PackageSelectionExtensionPoint
43+
------------------------------
44+
45+
This extension point is used by verb extensions after packages have been discovered, identified, and augmented.
46+
Each package selection extension adds command line arguments which are grouped in the "Package selection arguments" section of the usage help.
47+
48+
By default all packages are selected.
49+
Each extension can select / unselect matching package decorators based on the passed arguments.
50+
If arguments for multiple extensions are being passed the combined boolean flag is a logical ``AND`` combination.
51+
52+
TaskExtensionPoint
53+
------------------
54+
55+
This extension point is used by verb extensions after packages have been discovered, identified, and augmented.
56+
Each task extension implements the logic for the combination of a ``verb`` and a ``package type``, e.g. building a Python package.
57+
58+
In order to be invoked a task extension needs parameters provided by a context object.
59+
A job object brings those two together.
60+
61+
ExecutorExtensionPoint
62+
----------------------
63+
64+
This extension point is used by some verb extensions to execute a set of jobs.
65+
The executor extension with the highest priority is used by default.
66+
67+
ShellExtensionPoint
68+
-------------------
69+
70+
This extension point is used by some task extensions to generate shells scripts to setup the environment or create environment hooks for each supported shell.
71+
Each extension implements the logic for a specific shell.
72+
For the primary shells each extension also provides the environment to run commands.
73+
74+
EnvironmentExtensionPoint
75+
-------------------------
76+
77+
This extension point is used by some task extensions as well as shell extensions to create environment hooks for each supported shell.
78+
Each extension creates environment hooks for a specific environment variable and uses the shell extensions to generate scripts for each supported shell.
79+
80+
EventHandlerExtensionPoint
81+
--------------------------
82+
83+
This extension point defines how events are handled.
84+
An event can be any kind of object, like a line of output, a job starting, progressing or ending, or a command executing.
85+
Every event is dispatched to all extensions in order of their priority.

index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Information about development is also available:
4545
developer/bootstrap
4646
developer/environment
4747
developer/program-flow
48+
developer/extension-point
4849
developer/contribution
4950
developer/changelog
5051

spelling_wordlist.txt

+2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ prepend
1818
prepended
1919
pytest
2020
refactored
21+
subparser
2122
symlink
2223
symlinks
2324
templated
25+
unselect
2426
venv
2527
workflow
2628
yaml

0 commit comments

Comments
 (0)