Skip to content

Commit 40ece1a

Browse files
committed
refactor: now that there is always emqx_plugin_helper as dependency
we can delete map_sets from the example.
1 parent 5971485 commit 40ece1a

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ The plugin skeleton created by the `rebar3 new emqx-plugin` represents a single
7474

7575
```
7676
.
77-
├── LICENSE
7877
├── Makefile
79-
├── priv
80-
│   ├── ...
8178
├── README.md
8279
├── rebar.config
8380
├── scripts
8481
│   ├── ...
82+
├── priv
83+
│   ├── ...
8584
└── src
8685
├── my_emqx_plugin_app.erl
8786
├── my_emqx_plugin.app.src
@@ -90,13 +89,12 @@ The plugin skeleton created by the `rebar3 new emqx-plugin` represents a single
9089
└── my_emqx_plugin_sup.erl
9190
```
9291

93-
* `src` - The code of the plugin's OTP application.
94-
* `priv` - The directory for the plugin's configuration files and configuration schema. It contains some example files.
95-
* `rebar.config` - The rebar3 configuration file used to build the application and pack it into a release.
9692
* `Makefile` - The entry point for building the plugin.
97-
* `scripts` - Helper scripts for the `Makefile`.
9893
* `README.md` - Documentation placeholder.
99-
* `LICENSE` - The plugin's sample license file.
94+
* `rebar.config` - The rebar3 configuration file used to build the application and pack it into a release.
95+
* `scripts` - Helper scripts for the `Makefile`.
96+
* `priv` - The directory for the plugin's configuration files and configuration schema. It contains some example files.
97+
* `src` - The code of the plugin's OTP application.
10098

10199
#### `rebar.config`
102100

@@ -112,21 +110,21 @@ In the `deps` section, you can add dependencies to other OTP applications that y
112110
```erlang
113111
{deps,
114112
[
115-
...
116-
%% this is my plugin's dependency
117-
{map_sets, "1.1.0"}
113+
{emqx_plugin_helper, {git, "https://github.com/emqx/emqx-plugin-helper.git", {tag, "v5.9.0"}}}
114+
%% more dependencies
118115
]}.
119116
```
120117

121-
The skeleton adds a single extra dependency to the plugin: `map_sets`. It may be removed if not needed. See
122-
[`rebar3` dependency documentation](https://www.rebar3.org/docs/configuration/dependencies/) for more details.
118+
The skeleton adds an extra dependency to the plugin: `emqx_plugin_helper`.
119+
It is usually needed for plugin code to make use of the record definitions and macros provided in the header files.
120+
See [`rebar3` dependency documentation](https://www.rebar3.org/docs/configuration/dependencies/) for more details.
123121

124122
In the `relx` section, you specify the release name and version, and the list of applications to be included in the release.
125123

126124
```erlang
127125
{relx, [ {release, {my_emqx_plugin, "1.0.0"},
128126
[ my_emqx_plugin
129-
, map_sets
127+
, emqx_plugin_helper
130128
]}
131129
...
132130
]}.
@@ -241,7 +239,7 @@ When a plugin is built into a release, the package structure is as follows:
241239

242240
```
243241
└── my_emqx_plugin-1.1.0.tar.gz
244-
   ├── map_sets-1.1.0
242+
   ├── emqx_plugin_helper_vsn-5.9.0
245243
   ├── my_emqx_plugin-0.1.0
246244
   ├── README.md
247245
   └── release.json
@@ -272,7 +270,7 @@ I.e. the tarball contains the compiled applications (listed in the `relx` sectio
272270
"metadata_vsn": "0.2.0",
273271
"rel_apps": [
274272
"my_emqx_plugin-0.1.0",
275-
"map_sets-1.1.0"
273+
"emqx_plugin_helper-5.9.0"
276274
],
277275
"rel_vsn": "1.1.0",
278276
"with_config_schema": true

emqx-plugin-templates/rebar.config

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
{{=@@ @@=}}
22
%% -*- mode: erlang -*-
33
{deps, [
4-
{emqx_plugin_helper,
5-
{git, "https://github.com/emqx/emqx-plugin-helper.git", {tag, "@@emqx_plugin_helper_vsn@@"}}},
6-
%% this is my plugin's dependency
7-
{map_sets, "1.1.0"}
4+
{emqx_plugin_helper, {git, "https://github.com/emqx/emqx-plugin-helper.git", {tag, "@@emqx_plugin_helper_vsn@@"}}}
85
]}.
96

107
{plugins, [
11-
{emqx_plugin_helper,
12-
{git, "https://github.com/emqx/emqx-plugin-helper.git", {tag, "@@emqx_plugin_helper_vsn@@"}}},
13-
{erlfmt, "1.6.0"}
8+
{emqx_plugin_helper, {git, "https://github.com/emqx/emqx-plugin-helper.git", {tag, "@@emqx_plugin_helper_vsn@@"}}}
149
]}.
1510

11+
{project_plugins, [{erlfmt, "1.6.0"}]}.
12+
1613
{erl_opts, [debug_info]}.
1714

1815
%% this is the release version, different from app vsn in .app file
1916
{relx, [
2017
{release, {@@name@@, "@@version@@"}, [
2118
@@name@@,
22-
emqx_plugin_helper,
23-
map_sets
19+
emqx_plugin_helper
2420
]},
2521
{dev_mode, false},
2622
{include_erts, false},

emqx-plugin-templates/src/emqx_plugin_template.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{vsn, "@@app_vsn@@"},
55
{modules, []},
66
{registered, [@@name@@_sup]},
7-
{applications, [kernel, stdlib, emqx_plugin_helper, map_sets]},
7+
{applications, [kernel, stdlib, emqx_plugin_helper]},
88
{mod, {@@name@@_app, []}},
99
{env, []},
1010
{licenses, ["@@license@@"]},

0 commit comments

Comments
 (0)