// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page distributing-plugins.html
    \title Distributing Extensions and Plugins

    To make your extension or plugin available to a wider range of users, publish
    it as a \QC extension or plugin that users can discover and install in the
    \uicontrol Extensions mode.

    You can also distribute archives of Lua extensions or binary builds
    of C++-based plugins that users can install in \uicontrol Edit >
    \uicontrol Preferences > \uicontrol Extensions >
    \uicontrol {Install Extensions}.

    \section1 Publishing Extensions

    The default distribution channel for extensions is the \QC \l{The Registry}
    {extension registry}.

    Before publishing an extension, read the Qt Extension Publisher Agreement.

    To publish an extension, follow the instructions in the registry repository.

    Users can add their own extension registries, as described in
    \l{\QC: Install extensions}.

    \section1 Creating Binaries of C++-Based Plugins

    If your C++-based plugin runs and works on multiple platforms, you should
    provide binary builds for all of the supported platforms.

    \QC currently supports:

    \list
        \li Windows
        \li Linux
        \li \macos
    \endlist

    See the toplevel \l{README.md} file in \QC's sources for a more
    detailed list.

    The \uicontrol {\QC Plugin} wizard already creates a template for
    \l{GitHub Actions} which can be used to create binaries if you host your
    plugin sources on GitHub. See the \c {README.md} that is created at the
    same location for details.

    You can also use the provided GitHub Actions workflow as inspiration for
    another build service of your choice.

    \section1 Packaging

    The easiest way to package your plugin is to simply provide a zip file
    that the user can unpack to the correct location for \QC to find it.
    \QC makes that easy for the user by providing an \uicontrol{Install
    Plugin} button in the \uicontrol Help > \uicontrol {About Plugins} dialog
    (or \uicontrol {\QC} > \uicontrol {About Plugins} on \macos). The
    user chooses a zip file with the plugin, and \QC unpacks that to the
    appropriate location.

    The following sections describe the options you have for the plugin's
    contents layout.

    \section2 Single Library

    Using a single library is the preferred and simplest option. You provide a
    single plugin library file that has all required resources compiled into it
    with \l{The Qt Resource System}. This imposes some limitations because you
    cannot depend on additional binaries, nor extend some parts of \QC
    that rely on external files, like the generic highlighter. You can still
    \l{\QC: Add wizards}{add wizard templates} this way, by adding the
    path to the resource directory into your QRC file with
    ProjectExplorer::JsonWizardFactory::addWizardPath(). Registering
    documentation and translations can be done in similar ways.

    \section3 Summary

    \list
        \li Single library as single item in a zip file.
        \li Resources compiled into the library with \l{The Qt Resource System}.
        \li Can be installed locally for a single user for all compatible
            \QC installations.
        \li Can be installed into a \QC installation for all users.
    \endlist

    \section2 Multiple Files Following \QC's Filesystem Layout

    This is a more flexible solution with regards to what the plugin can do,
    but more complicated to set up. This allows the plugin to ship additional
    binaries and arbitrary resources.

    Since the filesystem layout varies heavily between platforms, the build
    system of \QC provides variables like \c IDE_DATA_PATH and \c
    IDE_LIBEXEC_PATH. If you build your plugin with CMake, you should use the
    provided \c add_qtc_library, \c add_qtc_executable and similar functions
    as well.

    At runtime you can access these platform dependent locations with
    Core::ICore::resourcePath() and Core::ICore::libexecPath().

    Plugins that are distributed this way cannot be installed locally for a
    single user. They must be installed into the \QC installation
    directly.

    \section3 Summary

    \list
        \li Multiple files following standard filesystem layout.
        \li Use \QC specific variables and functions in build system.
        \li Use Core::ICore to find the locations at runtime.
        \li Can only be installed into a \QC installation for all users.
    \endlist
*/
