cmcfarlen commented on code in PR #11008:
URL: https://github.com/apache/trafficserver/pull/11008#discussion_r1478317078


##########
doc/developer-guide/plugins/building-plugins.en.rst:
##########
@@ -22,3 +22,58 @@
 Building Plugins
 ****************
 
+The traffic server build provides two ways to help you build your own plugins.
+First, it provides a pkg-config file name ts.pc installed in `lib/pkgconfig`.
+You can use this to discover include and library directories needed to build
+your plugin.  The other provided option is a cmake find-package script that 
both
+locates the traffic server libraries, but also provides some function for
+building a plugin as well as verifying that the plugin produced is loadable by
+traffic server.
+
+Example Plugin Project
+======================
+
+.. code-block:: text
+
+   cmake_minimum_required(VERSION 3.20..3.27)
+   project(ats-plugin-test)
+
+   find_package(tsapi REQUIRED)
+
+   enable_testing()
+
+   add_atsplugin(myplugin myplugin.cc)
+   verify_remap_plugin(myplugin)
+
+This example :file:`CMakeLists.txt` finds the tsapi package which provides the
+:func:`add_atsplugin` and :func:`verify_remap_plugin` functions.
+:func:`add_atsplugin` does all of the necessary cmake commands to build a
+plugins module .so.  The function takes the plugin target name and a list of
+source files that make up the project.  If the plugin requires additional
+libraries, those can be linked with the :func:`target_link_libraries` cmake
+function.
+
+After the plugin target is created, a verify test target can be created.  This
+will add a cmake test declaration and at test time, will run traffic_server in
+its verify plugin mode.  There are two verify functions provided,
+:func:`verify_remap_plugin` and :func:`verify_global_plugin`.  Use the relevant
+function for your plugin type.  The test will fail if either your plugin does
+not define the required init function (:func:`TSRemapInit` or 
:func:`TSPluginInit`),
+or if your plugin calls any undefined symbols.

Review Comment:
   I suppose you could request both tests.  This isn't a separate command for 
traffic_server afaik.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to