From d1a73807e7cea59bcbbbc164e9fbd8e5d702d149 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Dec 2024 12:47:31 -0600 Subject: [PATCH 01/20] CXX-3199 generate API docs with generated headers --- CMakeLists.txt | 22 ++- Doxyfile | 14 +- src/bsoncxx/CMakeLists.txt | 72 +++++++-- src/bsoncxx/include/bsoncxx/doc.hpp | 2 +- .../v_noabi/bsoncxx/config/prelude.hpp | 6 +- .../include/bsoncxx/v_noabi/bsoncxx/fwd.hpp | 147 +----------------- .../bsoncxx/v_noabi/bsoncxx/stdx/optional.hpp | 4 +- .../v_noabi/bsoncxx/stdx/string_view.hpp | 4 +- .../v_noabi/bsoncxx/config/config.hpp.in | 29 ++++ .../v_noabi/bsoncxx/config/version.hpp.in | 41 +++++ src/mongocxx/CMakeLists.txt | 72 +++++++-- src/mongocxx/include/mongocxx/doc.hpp | 2 +- .../v_noabi/mongocxx/config/prelude.hpp | 6 +- .../include/mongocxx/v_noabi/mongocxx/fwd.hpp | 141 +---------------- .../v_noabi/mongocxx/config/config.hpp.in | 7 + .../v_noabi/mongocxx/config/version.hpp.in | 49 ++++++ 16 files changed, 284 insertions(+), 334 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2af682b4e..76742d5112 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,12 +283,30 @@ add_custom_target(hugo-deploy VERBATIM ) -add_custom_target(docs_dir_current +add_custom_target(docs_source_directory + VERBATIM + + # Clear any existing files in the target directory. + COMMAND ${CMAKE_COMMAND} -E remove_directory + ${MONGO_CXX_DRIVER_SOURCE_DIR}/build/doxygen/install + + # Manually "install" all headers without requiring compilation. + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${MONGO_CXX_DRIVER_SOURCE_DIR}/src/bsoncxx/include + ${MONGO_CXX_DRIVER_BINARY_DIR}/src/bsoncxx/lib + ${MONGO_CXX_DRIVER_SOURCE_DIR}/build/doxygen/install/include + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${MONGO_CXX_DRIVER_SOURCE_DIR}/src/mongocxx/include + ${MONGO_CXX_DRIVER_BINARY_DIR}/src/mongocxx/lib + ${MONGO_CXX_DRIVER_SOURCE_DIR}/build/doxygen/install/include +) + +add_custom_target(docs_target_directory COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current ) add_custom_target(doxygen-current - DEPENDS docs_dir_current + DEPENDS docs_source_directory docs_target_directory WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile VERBATIM diff --git a/Doxyfile b/Doxyfile index 7eea1e7cd6..b35e311325 100644 --- a/Doxyfile +++ b/Doxyfile @@ -181,8 +181,7 @@ FULL_PATH_NAMES = YES # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = . \ - src/bsoncxx/include \ - src/mongocxx/include + build/doxygen/install/include # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -192,8 +191,7 @@ STRIP_FROM_PATH = . \ # using the -I flag. STRIP_FROM_INC_PATH = . \ - src/bsoncxx/include \ - src/mongocxx/include + build/doxygen/install/include # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't @@ -943,8 +941,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = src/bsoncxx/include \ - src/mongocxx/include \ +INPUT = build/doxygen/install/include \ etc/apidocmenu.md # This tag can be used to specify the character encoding of the source files @@ -2398,10 +2395,7 @@ SEARCH_INCLUDES = YES # RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. -INCLUDE_PATH = src/bsoncxx/include/bsoncxx/v_noabi \ - src/mongocxx/include/mongocxx/v_noabi \ - src/bsoncxx/include \ - src/mongocxx/include +INCLUDE_PATH = build/doxygen/install/include # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt index 7e4cade1c9..7e8057fe13 100644 --- a/src/bsoncxx/CMakeLists.txt +++ b/src/bsoncxx/CMakeLists.txt @@ -127,18 +127,66 @@ endif() if(1) function(bsoncxx_install_export_header TARGET) set(bsoncxx_export_header_custom_content "") - string(APPEND bsoncxx_export_header_custom_content - "\n" - "#undef BSONCXX_DEPRECATED_EXPORT\n" - "#undef BSONCXX_DEPRECATED_NO_EXPORT\n" - "\n" - "#if defined(_MSC_VER)\n" - "#define BSONCXX_ABI_CDECL __cdecl\n" - "#else\n" - "#define BSONCXX_ABI_CDECL\n" - "#endif\n" - "\n" - "#define BSONCXX_ABI_EXPORT_CDECL(...) BSONCXX_ABI_EXPORT __VA_ARGS__ BSONCXX_ABI_CDECL\n" + string(APPEND bsoncxx_export_header_custom_content [[ + +#undef BSONCXX_DEPRECATED_EXPORT +#undef BSONCXX_DEPRECATED_NO_EXPORT + +#if defined(_MSC_VER) +#define BSONCXX_ABI_CDECL __cdecl +#else +#define BSONCXX_ABI_CDECL +#endif + +#define BSONCXX_ABI_EXPORT_CDECL(...) BSONCXX_ABI_EXPORT __VA_ARGS__ BSONCXX_ABI_CDECL + +/// +/// @file +/// Provides macros to control the set of symbols exported in the ABI. +/// +/// @warning For internal use only! +/// + +/// +/// @def BSONCXX_ABI_EXPORT +/// @hideinitializer +/// Exports the associated entity as part of the ABI. +/// +/// @warning For internal use only! +/// + +/// +/// @def BSONCXX_ABI_NO_EXPORT +/// @hideinitializer +/// Excludes the associated entity from being part of the ABI. +/// +/// @warning For internal use only! +/// + +/// +/// @def BSONCXX_ABI_CDECL +/// @hideinitializer +/// Expands to `__cdecl` when built with MSVC on Windows. +/// +/// @warning For internal use only! +/// + +/// +/// @def BSONCXX_ABI_EXPORT_CDECL +/// @hideinitializer +/// Equivalent to @ref BSONCXX_ABI_EXPORT with @ref BSONCXX_ABI_CDECL. +/// +/// @warning For internal use only! +/// + +/// +/// @def BSONCXX_DEPRECATED +/// @hideinitializer +/// Declares the associated entity as deprecated. +/// +/// @warning For internal use only! +/// +]] ) generate_export_header(${TARGET} BASE_NAME BSONCXX_ABI diff --git a/src/bsoncxx/include/bsoncxx/doc.hpp b/src/bsoncxx/include/bsoncxx/doc.hpp index d091ac0f79..eff340e0a1 100644 --- a/src/bsoncxx/include/bsoncxx/doc.hpp +++ b/src/bsoncxx/include/bsoncxx/doc.hpp @@ -24,7 +24,7 @@ /// /// -/// @dir bsoncxx/include/bsoncxx +/// @dir include/bsoncxx /// Provides headers declaring entities in @ref bsoncxx /// diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp index 152361a20f..76d516ea4e 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp @@ -107,10 +107,10 @@ /// /// @par Includes /// - @ref bsoncxx/v_noabi/bsoncxx/config/compiler.hpp -/// - @ref bsoncxx-v_noabi-bsoncxx-config-config-hpp -/// - @ref bsoncxx-v_noabi-bsoncxx-config-export-hpp +/// - @ref bsoncxx/v_noabi/bsoncxx/config/config.hpp +/// - @ref bsoncxx/v_noabi/bsoncxx/config/export.hpp /// - @ref bsoncxx/v_noabi/bsoncxx/config/util.hpp -/// - @ref bsoncxx-v_noabi-bsoncxx-config-version-hpp +/// - @ref bsoncxx/v_noabi/bsoncxx/config/version.hpp /// /// This header uses macro pragmas to guard macros defined by the bsoncxx library for internal use /// by "pushing" their prior definition onto the stack before use by bsoncxx headers. diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp index 79bc756d31..820086c027 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp @@ -52,7 +52,7 @@ /// Aggregate of all forward headers declaring entities in @ref bsoncxx::v_noabi. /// /// @par Includes -/// - All header files under @ref src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx "bsoncxx/v_noabi/bsoncxx" whose filename ends with `-fwd.hpp`. +/// - All header files under `bsoncxx/v_noabi/bsoncxx` whose filename ends with `-fwd.hpp`. /// /// @@ -93,151 +93,6 @@ /// @dir bsoncxx/v_noabi/bsoncxx/config /// Provides headers related to bsoncxx library configuration. /// -/// @par Generated Headers -/// Generated headers are documented by the following pages: -/// - @ref bsoncxx-v_noabi-bsoncxx-config-config-hpp -/// - @ref bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// - @ref bsoncxx-v_noabi-bsoncxx-config-version-hpp -/// - -#if defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR) - -/// -/// @defgroup bsoncxx-v_noabi-bsoncxx-config-config-hpp bsoncxx/v_noabi/bsoncxx/config/config.hpp -/// This page documents macros provided by the generated header -/// `bsoncxx/v_noabi/bsoncxx/config/config.hpp`. -/// -/// @name bsoncxx/v_noabi/bsoncxx/config/config.hpp -/// -/// These macros are provided by @ref bsoncxx-v_noabi-bsoncxx-config-config-hpp "config.hpp", -/// **NOT** by @ref bsoncxx/v_noabi/bsoncxx/fwd.hpp "fwd.hpp" (where this is documented in source)! -/// -/// @{ -/// - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-config-hpp -/// Defined when configured to use bsoncxx's own C++17 polyfill implementations. -/// -#define BSONCXX_POLY_USE_IMPLS - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-config-hpp -/// Defined when configured to use the C++ standard library for C++17 features. -/// -#define BSONCXX_POLY_USE_STD - -/// -/// @} -/// - -/// -/// @defgroup bsoncxx-v_noabi-bsoncxx-config-export-hpp bsoncxx/v_noabi/bsoncxx/config/export.hpp -/// This page documents macros provided by the generated header -/// `bsoncxx/v_noabi/bsoncxx/config/export.hpp`. -/// -/// @name bsoncxx/v_noabi/bsoncxx/config/export.hpp -/// -/// These macros are provided by @ref bsoncxx-v_noabi-bsoncxx-config-export-hpp "export.hpp", -/// **NOT** by @ref bsoncxx/v_noabi/bsoncxx/fwd.hpp "fwd.hpp" (where this is documented in source)! -/// -/// @{ -/// - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// Exports the associated entity as part of the ABI. -/// -/// @warning For internal use only! -/// -#define BSONCXX_ABI_EXPORT - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// Excludes the associated entity from being part of the ABI. -/// -/// @warning For internal use only! -/// -#define BSONCXX_ABI_NO_EXPORT - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// Expands to `__cdecl` when built with MSVC on Windows. -/// -/// @warning For internal use only! -/// -#define BSONCXX_ABI_CDECL - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// Equivalent to @ref BSONCXX_ABI_EXPORT with @ref BSONCXX_ABI_CDECL. -/// -/// @warning For internal use only! -/// -#define BSONCXX_ABI_EXPORT_CDECL(...) BSONCXX_ABI_EXPORT __VA_ARGS__ BSONCXX_ABI_CDECL - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// Declares the associated entity as deprecated. -/// -/// @warning For internal use only! -/// -#define BSONCXX_DEPRECATED - -/// -/// @} -/// - -/// -/// @defgroup bsoncxx-v_noabi-bsoncxx-config-version-hpp bsoncxx/v_noabi/bsoncxx/config/version.hpp -/// This page documents macros provided by the generated header -/// `bsoncxx/v_noabi/bsoncxx/config/version.hpp`. -/// -/// @name bsoncxx/v_noabi/bsoncxx/config/version.hpp -/// -/// These macros are provided by @ref bsoncxx-v_noabi-bsoncxx-config-version-hpp "version.hpp", -/// **NOT** by @ref bsoncxx/v_noabi/bsoncxx/fwd.hpp "fwd.hpp" (where this is documented in source)! -/// -/// @{ -/// - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-version-hpp -/// Defined as this bsoncxx library's API major version number. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define BSONCXX_VERSION_MAJOR - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-version-hpp -/// Defined as this bsoncxx library's API minor version number. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define BSONCXX_VERSION_MINOR - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-version-hpp -/// Defined as this bsoncxx library's API patch version number. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define BSONCXX_VERSION_PATCH - -/// -/// @ingroup bsoncxx-v_noabi-bsoncxx-config-version-hpp -/// Defined as this bsoncxx library's API version number suffix if any. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define BSONCXX_VERSION_EXTRA - -/// -/// @} -/// - -#endif // defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR) /// /// @dir bsoncxx/v_noabi/bsoncxx/document diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/optional.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/optional.hpp index b9bb297dfb..e402079781 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/optional.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/optional.hpp @@ -803,7 +803,7 @@ using ::bsoncxx::v_noabi::stdx::optional; /// /// @note The API and ABI compatibility of this polyfill is determined by polyfill build /// configuration variables and the `BSONCXX_POLY_USE_*` macros provided by @ref -/// bsoncxx-v_noabi-bsoncxx-config-config-hpp. +/// bsoncxx/v_noabi/bsoncxx/config/config.hpp. /// /// @see /// - [Choosing a C++17 Polyfill](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/polyfill-selection/) @@ -820,7 +820,7 @@ namespace stdx { /// /// @note The API and ABI compatibility of this polyfill is determined by polyfill build /// configuration variables and the `BSONCXX_POLY_USE_*` macros provided by @ref -/// bsoncxx-v_noabi-bsoncxx-config-config-hpp. +/// bsoncxx/v_noabi/bsoncxx/config/config.hpp. /// template class optional {}; diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/string_view.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/string_view.hpp index 80a97127c6..70c4661a95 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/string_view.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/string_view.hpp @@ -414,7 +414,7 @@ using ::bsoncxx::v_noabi::stdx::string_view; /// /// @note The API and ABI compatibility of this polyfill is determined by polyfill build /// configuration variables and the `BSONCXX_POLY_USE_*` macros provided by @ref -/// bsoncxx-v_noabi-bsoncxx-config-config-hpp. +/// bsoncxx/v_noabi/bsoncxx/config/config.hpp. /// /// @see /// - [Choosing a C++17 Polyfill](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/polyfill-selection/) @@ -431,7 +431,7 @@ namespace stdx { /// /// @note The API and ABI compatibility of this polyfill is determined by polyfill build /// configuration variables and the `BSONCXX_POLY_USE_*` macros provided by @ref -/// bsoncxx-v_noabi-bsoncxx-config-config-hpp. +/// bsoncxx/v_noabi/bsoncxx/config/config.hpp. /// class string_view {}; diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.hpp.in b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.hpp.in index c6893d5dc0..3358ecb03c 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.hpp.in +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.hpp.in @@ -14,3 +14,32 @@ #cmakedefine BSONCXX_POLY_USE_IMPLS #cmakedefine BSONCXX_POLY_USE_STD + +/// +/// @file +/// Provides macros describing the bsoncxx library configuration. +/// +/// @warning This header is not standalone includable! +/// + +#if defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR) + +#if !defined(BSONCXX_POLY_USE_IMPLS) +#define BSONCXX_POLY_USE_IMPLS +#endif // !defined(BSONCXX_POLY_USE_IMPLS) + +#if !defined(BSONCXX_POLY_USE_STD) +#define BSONCXX_POLY_USE_STD +#endif // !defined(BSONCXX_POLY_USE_IMPLS) + +#endif // BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR + +/// +/// @def BSONCXX_POLY_USE_IMPLS +/// Defined when configured to use bsoncxx's own C++17 polyfill implementations. +/// + +/// +/// @def BSONCXX_POLY_USE_STD +/// Defined when configured to use the C++ standard library for C++17 features. +/// diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.hpp.in b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.hpp.in index ff54ca6e56..606ee8b6cf 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.hpp.in +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.hpp.in @@ -12,7 +12,48 @@ // See the License for the specific language governing permissions and // limitations under the License. +// clang-format off #define BSONCXX_VERSION_MAJOR @BSONCXX_VERSION_MAJOR@ #define BSONCXX_VERSION_MINOR @BSONCXX_VERSION_MINOR@ #define BSONCXX_VERSION_PATCH @BSONCXX_VERSION_PATCH@ #define BSONCXX_VERSION_EXTRA @BSONCXX_VERSION_EXTRA@ +// clang-format on + +/// +/// @file +/// Provides macros describing the bsoncxx library version. +/// +/// @warning This header is not standalone includable! +/// + +/// +/// @def BSONCXX_VERSION_MAJOR +/// @hideinitializer +/// This library's API major version number as an integer literal (e.g. `1`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// + +/// +/// @def BSONCXX_VERSION_MINOR +/// @hideinitializer +/// This library's API minor version number as an integer literal (e.g. `2`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// + +/// +/// @def BSONCXX_VERSION_PATCH +/// @hideinitializer +/// This library's API patch version number as an integer literal (e.g. `3`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// + +/// +/// @def BSONCXX_VERSION_EXTRA +/// @hideinitializer +/// This library's API version number suffix if any as raw text (e.g. `-extra`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt index 8340c28931..0509ecb6cc 100644 --- a/src/mongocxx/CMakeLists.txt +++ b/src/mongocxx/CMakeLists.txt @@ -102,18 +102,66 @@ endif() if(1) function(mongocxx_install_export_header TARGET) set(mongocxx_export_header_custom_content "") - string(APPEND mongocxx_export_header_custom_content - "\n" - "#undef MONGOCXX_DEPRECATED_EXPORT\n" - "#undef MONGOCXX_DEPRECATED_NO_EXPORT\n" - "\n" - "#if defined(_MSC_VER)\n" - "#define MONGOCXX_ABI_CDECL __cdecl\n" - "#else\n" - "#define MONGOCXX_ABI_CDECL\n" - "#endif\n" - "\n" - "#define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL\n" + string(APPEND mongocxx_export_header_custom_content [[ + +#undef MONGOCXX_DEPRECATED_EXPORT +#undef MONGOCXX_DEPRECATED_NO_EXPORT + +#if defined(_MSC_VER) +#define MONGOCXX_ABI_CDECL __cdecl +#else +#define MONGOCXX_ABI_CDECL +#endif + +#define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL + +/// +/// @file +/// Provides macros to control the set of symbols exported in the ABI. +/// +/// @warning For internal use only! +/// + +/// +/// @def MONGOCXX_ABI_EXPORT +/// @hideinitializer +/// Exports the associated entity as part of the ABI. +/// +/// @warning For internal use only! +/// + +/// +/// @def MONGOCXX_ABI_NO_EXPORT +/// @hideinitializer +/// Excludes the associated entity from being part of the ABI. +/// +/// @warning For internal use only! +/// + +/// +/// @def MONGOCXX_ABI_CDECL +/// @hideinitializer +/// Expands to `__cdecl` when built with MSVC on Windows. +/// +/// @warning For internal use only! +/// + +/// +/// @def MONGOCXX_ABI_EXPORT_CDECL +/// @hideinitializer +/// Equivalent to @ref MONGOCXX_ABI_EXPORT with @ref MONGOCXX_ABI_CDECL. +/// +/// @warning For internal use only! +/// + +/// +/// @def MONGOCXX_DEPRECATED +/// @hideinitializer +/// Declares the associated entity as deprecated. +/// +/// @warning For internal use only! +/// + ]] ) generate_export_header(${TARGET} BASE_NAME MONGOCXX_ABI diff --git a/src/mongocxx/include/mongocxx/doc.hpp b/src/mongocxx/include/mongocxx/doc.hpp index 50afa4cf27..aa275a70ac 100644 --- a/src/mongocxx/include/mongocxx/doc.hpp +++ b/src/mongocxx/include/mongocxx/doc.hpp @@ -24,7 +24,7 @@ /// /// -/// @dir mongocxx/include/mongocxx +/// @dir include/mongocxx /// Provides headers declaring entities in @ref mongocxx /// diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp index 819a864640..3693112040 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp @@ -56,9 +56,9 @@ /// /// @par Includes /// - @ref mongocxx/v_noabi/mongocxx/config/compiler.hpp -/// - @ref mongocxx-v_noabi-mongocxx-config-config-hpp -/// - @ref mongocxx-v_noabi-mongocxx-config-export-hpp -/// - @ref mongocxx-v_noabi-mongocxx-config-version-hpp +/// - @ref mongocxx/v_noabi/mongocxx/config/config.hpp +/// - @ref mongocxx/v_noabi/mongocxx/config/export.hpp +/// - @ref mongocxx/v_noabi/mongocxx/config/version.hpp /// /// This header uses macro pragmas to guard macros defined by the mongocxx library for internal use /// by "pushing" their prior definition onto the stack before use by mongocxx headers. diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp index 885c290162..60eb706e4d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp @@ -117,7 +117,7 @@ /// Aggregate of all forward headers declaring entities in @ref mongocxx::v_noabi. /// /// @par Includes -/// - All header files under @ref src/mongocxx/include/mongocxx/v_noabi/mongocxx "mongocxx/v_noabi/mongocxx" whose filename ends with `-fwd.hpp`. +/// - All header files under `mongocxx/v_noabi/mongocxx` whose filename ends with `-fwd.hpp`. /// /// @@ -139,145 +139,6 @@ /// Provides headers related to mongocxx library configuration. /// -#if defined(MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR) - -/// -/// @defgroup mongocxx-v_noabi-mongocxx-config-config-hpp mongocxx/v_noabi/mongocxx/config/config.hpp -/// This page documents macros provided by the generated header -/// `mongocxx/v_noabi/mongocxx/config/config.hpp`. -/// -/// @name mongocxx/v_noabi/mongocxx/config/config.hpp -/// -/// These macros are provided by @ref mongocxx-v_noabi-mongocxx-config-config-hpp "config.hpp", -/// **NOT** by @ref mongocxx/v_noabi/mongocxx/fwd.hpp "fwd.hpp" (where this is documented)! -/// -/// @{ -/// - -/// -/// @} -/// - -/// -/// @defgroup mongocxx-v_noabi-mongocxx-config-export-hpp mongocxx/v_noabi/mongocxx/config/export.hpp -/// This page documents macros provided by the generated header -/// `mongocxx/v_noabi/mongocxx/config/export.hpp`. -/// -/// @name mongocxx/v_noabi/mongocxx/config/export.hpp -/// -/// These macros are provided by @ref mongocxx-v_noabi-mongocxx-config-export-hpp "export.hpp", -/// **NOT** by @ref mongocxx/v_noabi/mongocxx/fwd.hpp "fwd.hpp" (where this is documented)! -/// -/// @{ -/// - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp -/// Exports the associated entity as part of the ABI. -/// -/// @warning For internal use only! -/// -#define MONGOCXX_ABI_EXPORT - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp -/// Excludes the associated entity from being part of the ABI. -/// -/// @warning For internal use only! -/// -#define MONGOCXX_ABI_NO_EXPORT - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp -/// Expands to `__cdecl` when built with MSVC on Windows. -/// -/// @warning For internal use only! -/// -#define MONGOCXX_ABI_CDECL - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp -/// Equivalent to @ref MONGOCXX_ABI_EXPORT with @ref MONGOCXX_ABI_CDECL. -/// -/// @warning For internal use only! -/// -#define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp -/// Declares the associated entity as deprecated. -/// -/// @warning For internal use only! -/// -#define MONGOCXX_DEPRECATED - -/// -/// @} -/// - -/// -/// @defgroup mongocxx-v_noabi-mongocxx-config-version-hpp mongocxx/v_noabi/mongocxx/config/version.hpp -/// This page documents macros provided by the generated header -/// `mongocxx/v_noabi/mongocxx/config/version.hpp`. -/// -/// @name mongocxx/v_noabi/mongocxx/config/version.hpp -/// -/// These macros are provided by @ref mongocxx-v_noabi-mongocxx-config-version-hpp "version.hpp", -/// **NOT** by @ref mongocxx/v_noabi/mongocxx/fwd.hpp "fwd.hpp" (where this is documented)! -/// -/// @{ -/// - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-version-hpp -/// Defined as a string literal encoding this mongocxx library's API version number. -/// -/// This value includes the major version, minor version, patch version, and suffix if any. -/// -/// Example: `"1.2.3-extra"` -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define MONGOCXX_VERSION_STRING - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-version-hpp -/// Defined as this mongocxx library's API major version number. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define MONGOCXX_VERSION_MAJOR - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-version-hpp -/// Defined as this mongocxx library's API minor version number. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define MONGOCXX_VERSION_MINOR - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-version-hpp -/// Defined as this mongocxx library's API patch version number. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define MONGOCXX_VERSION_PATCH - -/// -/// @ingroup mongocxx-v_noabi-mongocxx-config-version-hpp -/// Defined as this mongocxx library's API version number suffix if any. -/// -/// This value is derived from the `BUILD_VERSION` variable during configuration. -/// -#define MONGOCXX_VERSION_EXTRA - -/// -/// @} -/// - -#endif // defined(MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR) - /// /// @dir mongocxx/v_noabi/mongocxx/events /// Provides headers declaring entities in @ref mongocxx::v_noabi::events. diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in index 98cfd9fb6e..4b5a81c39c 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in @@ -11,3 +11,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + +/// +/// @file +/// Provides macros describing the mongocxx library configuration. +/// +/// @warning This header is not standalone includable! +/// diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.hpp.in b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.hpp.in index 44c7642f91..ff95adebb0 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.hpp.in +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.hpp.in @@ -12,8 +12,57 @@ // See the License for the specific language governing permissions and // limitations under the License. +// clang-format off #define MONGOCXX_VERSION_STRING "@MONGOCXX_VERSION@" #define MONGOCXX_VERSION_MAJOR @MONGOCXX_VERSION_MAJOR@ #define MONGOCXX_VERSION_MINOR @MONGOCXX_VERSION_MINOR@ #define MONGOCXX_VERSION_PATCH @MONGOCXX_VERSION_PATCH@ #define MONGOCXX_VERSION_EXTRA @MONGOCXX_VERSION_EXTRA@ +// clang-format on + +/// +/// @file +/// Provides macros describing the mongocxx library version. +/// +/// @warning This header is not standalone includable! +/// + +/// +/// @def MONGOCXX_VERSION_STRING +/// @hideinitializer +/// This library's full version number as a string literal (e.g. `"1.2.3-extra"`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// + +/// +/// @def MONGOCXX_VERSION_MAJOR +/// @hideinitializer +/// This library's API major version number as an integer literal (e.g. `1`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// + +/// +/// @def MONGOCXX_VERSION_MINOR +/// @hideinitializer +/// This library's API minor version number as an integer literal (e.g. `2`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// + +/// +/// @def MONGOCXX_VERSION_PATCH +/// @hideinitializer +/// This library's API patch version number as an integer literal (e.g. `3`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// + +/// +/// @def MONGOCXX_VERSION_EXTRA +/// @hideinitializer +/// This library's API version number suffix if any as raw text (e.g. `-extra`). +/// +/// This value is derived from the `BUILD_VERSION` variable during configuration. +/// From 60a3c2ef4622211faed404fb206a4838a95d6012 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Dec 2024 14:14:01 -0600 Subject: [PATCH 02/20] Use FindDoxygen CMake module to support custom binaries --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76742d5112..200ca9c0d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,10 +305,13 @@ add_custom_target(docs_target_directory COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current ) +# Set `DOXYGEN_EXECUTABLE` to specify the full path to a custom Doxygen binary. +find_package(Doxygen 1.12.0 EXACT QUIET) + add_custom_target(doxygen-current - DEPENDS docs_source_directory docs_target_directory + DEPENDS Doxygen::doxygen docs_source_directory docs_target_directory WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile + COMMAND Doxygen::doxygen -q ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile VERBATIM ) From 44cc11eff784fec2f0fc54d5f1948e5cebcc1052 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Dec 2024 16:24:40 -0600 Subject: [PATCH 03/20] Replace 'generate-*' Perl scripts with generate-latest-apidocs.sh --- CMakeLists.txt | 2 +- Doxyfile | 2 +- etc/generate-apidocs-from-tag.pl | 175 ------------------------------- etc/generate-latest-apidocs.pl | 22 ---- etc/generate-latest-apidocs.sh | 64 +++++++++++ 5 files changed, 66 insertions(+), 199 deletions(-) delete mode 100755 etc/generate-apidocs-from-tag.pl delete mode 100755 etc/generate-latest-apidocs.pl create mode 100755 etc/generate-latest-apidocs.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 200ca9c0d5..3b75b8c6c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -317,7 +317,7 @@ add_custom_target(doxygen-current add_custom_target(doxygen-latest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND etc/generate-latest-apidocs.pl + COMMAND etc/generate-latest-apidocs.sh VERBATIM ) diff --git a/Doxyfile b/Doxyfile index b35e311325..54d32220f5 100644 --- a/Doxyfile +++ b/Doxyfile @@ -834,7 +834,7 @@ CITE_BIB_FILES = # messages are off. # The default value is: NO. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES diff --git a/etc/generate-apidocs-from-tag.pl b/etc/generate-apidocs-from-tag.pl deleted file mode 100755 index 9bb2c80101..0000000000 --- a/etc/generate-apidocs-from-tag.pl +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env perl -use v5.14; -use strict; -use warnings; -use utf8; -use open qw/:std :utf8/; - -use Cwd qw/getcwd realpath/; -use File::Temp qw/tempdir/; -use List::Util qw/first/; - -# The required Doxygen version. -# The generated results are sensitive to the release version. -our $doxygen_version_required = "1.12.0"; - -# Allow specifying a custom Doxygen binary via the `$DOXYGEN_BINARY` environment variable. -our $doxygen_binary = $ENV{DOXYGEN_BINARY} || "doxygen"; - -# system() wrapper to die with an error if a command fails. -sub _try_run { - my @command = @_; - say "> Running: @command"; - system(@command); - die "Error running '@command" if $?; -} - -# Quick replacement for File::pushd; see LocalGuard at end of this file. -sub _pushd { - my $dir = shift; - my $cwd = getcwd(); - my $guard = LocalGuard->new( sub { chdir( $cwd ) or die "$!" } ); - chdir( $dir ) or die $!; - return $guard; -} - -# Map git refs to standardized version names. -sub _ref_to_name { - my $ref = shift; - if ( substr($ref,0,1) eq 'r' ) { - $ref =~ s/^r/mongocxx-/; - } - if ( $ref =~ /26compat/ ) { - $ref =~ s/^.*26compat/26compat/; - } - return $ref; -} - -# Doxygen config was stored in different places at times. -sub _find_doxygen_config { - my $config = first { -f } qw( Doxyfile etc/doxygen/config doxygenConfig ); - die "Doxygen config not found!\n" unless $config; - return $config; -} - -# Utility for reading all file contents. -sub _slurp { - my $file = shift; - open my $fh, "<:encoding(UTF-8)", $file - or die "Error opening '$file' to read: $!\n"; - local $/; - return scalar <$fh>; -} - -# Utility for writing all file contents. -sub _spew { - my $file = shift; - open my $fh, ">:encoding(UTF-8)", $file - or die "Error opening '$file' to write: $!\n"; - print {$fh} @_; - return; -} - -# Parse doxygen config into a hash with key and full line -sub _parse_doxygen_config { - my $file = _find_doxygen_config(); - open my $fh, "<:encoding(UTF-8)", $file - or die "Error opening '$file': $!\n"; - my %config; - while ( my $line = <$fh> ) { - # Skip comment lines and lines that aren't assignments - next if substr($line,0,1) eq '#'; - next unless $line =~ /\S.*=/; - # Join lines ending in backslash. - while ( $line =~ s/\\\n\z// ) { - $line .= " " . <$fh>; - } - # Save full line under the assigned key - my ($key) = $line =~ m{\s*(\S+?)\s*=}; - $config{$key} = $line; - } - return \%config; -} - -# Enforce a compatible Doxygen version. -sub _check_doxygen_version { - die "Failed to parse Doxygen version from output of `$doxygen_binary -v`" - unless `$doxygen_binary -v` =~ /^(\d+\.\d+\.\d+).*$/; - - my $doxygen_version = $1; # Strip unneeded content. - - die "Detected Doxygen version $doxygen_version does not match required version $doxygen_version_required" - unless $doxygen_version =~ /^$doxygen_version_required/ -} - -sub main { - my $gitref = shift @ARGV; - - die "Usage: $0 \n" unless defined $gitref; - die "Must run from top of the repo\n" unless -d ".git"; - - my $orig_dir = getcwd(); - my $version = _ref_to_name($gitref) // 'current'; - my $out_dir = "$orig_dir/build/docs/api/$version"; - - # Create tempdir to store copy of repo. This shouldn't be - # /tmp because on OS X that has a realpath of "/private/tmp", - # which trips the EXCLUDE_PATTERN of *private*. - _try_run("mkdir", "-p", "build/tmp-repo"); - my $tmp = tempdir( DIR => "build/tmp-repo", CLEANUP => 1 ); - my $tmpdir = realpath("$tmp"); - - # Clone current repo to tempdir and checkout target tag. - _try_run(qw/git clone . /, $tmpdir); - my $guard = _pushd($tmpdir); - _try_run(qw/git checkout/, $gitref); - - # Parse doxygen config - my $config = _parse_doxygen_config(); - - # Remove default apidocmenu so it doesn't conflict with the - # new one we'll generate later. - $config->{INPUT} =~ s{etc/apidocmenu\.md}{}; - - # Create output directory - say "Making '$out_dir'"; - _try_run(qw/mkdir -p/, $out_dir); - - # Copy front matter - _spew( "$tmpdir/apidocmenu.md", _slurp("$orig_dir/etc/apidocmenu.md") ); - - # Construct new doxygen file from current Doxygen config - _spew( "$tmpdir/Doxyfile", - _slurp("$orig_dir/Doxyfile"), - $config->{INPUT}, - $config->{EXCLUDE}, - qq[INPUT += apidocmenu.md\n], - qq[FILE_PATTERNS += *.h\n], - qq[EXCLUDE += README.md CONTRIBUTING.md TODO.md\n], - qq[USE_MDFILE_AS_MAINPAGE = apidocmenu.md\n], - qq[PROJECT_NUMBER = "$version"\n], - qq[OUTPUT_DIRECTORY = "$out_dir"\n], - qq[HTML_EXTRA_STYLESHEET = "$orig_dir/etc/doxygen-extra.css"\n], - ); - - # Ensure up-to-date Doxygen version. - _check_doxygen_version(); - - # Run doxygen - _try_run("$doxygen_binary", "$tmpdir/Doxyfile"); -} - -main(); - -# Quick replacement for Scope::Guard. -package LocalGuard; - -sub new { - my ($class, $code) = @_; - return bless { demolish => $code}, $class; -} - -sub DESTROY { - my $self = shift; - $self->{demolish}->() if $self->{demolish}; -} diff --git a/etc/generate-latest-apidocs.pl b/etc/generate-latest-apidocs.pl deleted file mode 100755 index cae8ff0614..0000000000 --- a/etc/generate-latest-apidocs.pl +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env perl -use v5.14; -use strict; -use warnings; -use utf8; -use open qw/:std :utf8/; - -# system() wrapper to die with an error if a command fails. -sub _try_run { - my @command = @_; - say "> Running: @command"; - system(@command); - die "Error running '@command" if $?; -} - -my $LATEST_DOC_TAG = "r4.0.0"; - -sub main { - _try_run("etc/generate-apidocs-from-tag.pl", $LATEST_DOC_TAG); -} - -main(); diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh new file mode 100755 index 0000000000..05e3b21589 --- /dev/null +++ b/etc/generate-latest-apidocs.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# +# generate-latest-apidocs.sh +# +# Usage: +# ./etc/generate-latest-apidocs.sh +# +# This script is meant to be run from the project root directory. + +set -o errexit +set -o pipefail + +LATEST_VERSION="4.0.0" +DOXYGEN_VERSION_REQUIRED="1.12.0" + +# Permit using a custom Doxygen binary. +: "${DOXYGEN_BINARY:=doxygen}" + +command -v git >/dev/null +command -v mktemp >/dev/null +command -v sed >/dev/null + +if [[ ! -d build ]]; then + echo "missing build directory: this script must be run from the project root directory" 1>&2 + exit 1 +fi + +# Validate Doxygen version. +doxygen_version="$("${DOXYGEN_BINARY:?}" -v | perl -lne 'print $1 if m/^(\d+\.\d+\.\d+).*$/')" +if [[ "${doxygen_version:-}" != "${DOXYGEN_VERSION_REQUIRED:?}" ]]; then + echo "${DOXYGEN_BINARY} version ${doxygen_version:-"unknown"} does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 + exit 1 +fi + +working_dir="$(pwd)" +apidocpath="${working_dir:?}/build/docs/api/mongocxx-${LATEST_VERSION:?}" + +# Use a temporary directory for the following operations. +tmpdir="$(mktemp -d)" +trap "rm -rf \"${tmpdir}\"" EXIT + +mkdir -p "${apidocpath:?}" + +# Use a clean copy of the repository. +git clone -q -c advice.detachedHead=false -b "cxx-3199" . "${tmpdir}" + +cd "${tmpdir:?}" + +# Update the Doxyfile configuration file: +# - set OUTPUT_DIRECTORY to `build/docs/api/mongocxx-`. +# - set PROJECT_NUMBER to ``. +sed -i \ + -e "s|^OUTPUT_DIRECTORY\s*=\s*.*$|OUTPUT_DIRECTORY = ${apidocpath:?}|g" \ + -e "s|^PROJECT_NUMBER\s*=\s*.*$|PROJECT_NUMBER = ${LATEST_VERSION:?}|g" \ + Doxyfile + +# Generate API documentation. +( + set -o xtrace + + cmake -S . -B build -D "DOXYGEN_EXECUTABLE=${DOXYGEN_BINARY:?}" --log-level=WARNING + cmake --build build --target docs_source_directory + "${DOXYGEN_BINARY:?}" -q +) From 3df943ea63a53bf1247e2b8f68be112c27068d1e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Dec 2024 15:45:30 -0600 Subject: [PATCH 04/20] Remove redundant `-q` flag in favor of `QUIET = YES` --- CMakeLists.txt | 2 +- etc/generate-latest-apidocs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b75b8c6c4..a6ed4347ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,7 +311,7 @@ find_package(Doxygen 1.12.0 EXACT QUIET) add_custom_target(doxygen-current DEPENDS Doxygen::doxygen docs_source_directory docs_target_directory WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND Doxygen::doxygen -q ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile + COMMAND Doxygen::doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile VERBATIM ) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index 05e3b21589..15942c5674 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -60,5 +60,5 @@ sed -i \ cmake -S . -B build -D "DOXYGEN_EXECUTABLE=${DOXYGEN_BINARY:?}" --log-level=WARNING cmake --build build --target docs_source_directory - "${DOXYGEN_BINARY:?}" -q + "${DOXYGEN_BINARY:?}" ) From 94339180f02b3a8abe989e82c29d86b9fe89307c Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Dec 2024 15:46:20 -0600 Subject: [PATCH 05/20] Remove redundant reference to Doxyfile --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6ed4347ae..f4214e3aa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,7 +311,7 @@ find_package(Doxygen 1.12.0 EXACT QUIET) add_custom_target(doxygen-current DEPENDS Doxygen::doxygen docs_source_directory docs_target_directory WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND Doxygen::doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile + COMMAND Doxygen::doxygen VERBATIM ) From 5e8a81418166fee8d415d5370a59f1342ce6b9fc Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Mon, 16 Dec 2024 15:38:11 -0600 Subject: [PATCH 06/20] Fix branch name during clone of temp repository --- etc/generate-latest-apidocs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index 15942c5674..428400a92d 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -42,7 +42,7 @@ trap "rm -rf \"${tmpdir}\"" EXIT mkdir -p "${apidocpath:?}" # Use a clean copy of the repository. -git clone -q -c advice.detachedHead=false -b "cxx-3199" . "${tmpdir}" +git clone -q -c advice.detachedHead=false -b "v${LATEST_VERSION}" . "${tmpdir}" cd "${tmpdir:?}" From ef2d0ef579c47ec4fb440e9efd4064b416dcaea2 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Mon, 16 Dec 2024 15:47:29 -0600 Subject: [PATCH 07/20] Update release instructions --- etc/releasing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/releasing.md b/etc/releasing.md index 1d4e1f2a8f..bcd0416fd3 100644 --- a/etc/releasing.md +++ b/etc/releasing.md @@ -661,7 +661,7 @@ Example (using Jira syntax formatting): > [!NOTE] > Some of these commands may take a while to complete. -Set `$LATEST_DOC_TAG` in `etc/generate-latest-apidocs.pl` to the latest release tag. +Set `$LATEST_VERSION` in `etc/generate-latest-apidocs.sh` to the latest release version. Change the version number for `SITEMAP_URL` in `Doxyfile` to the latest release version. @@ -678,7 +678,7 @@ command -V doxygen hugo ``` > [!IMPORTANT] -> The required Doxygen version is defined in `etc/generate-apidocs-from-tag.pl` as `$doxygen_version_required`. If not already present, download the required version from [Doxygen Releases](https://www.doxygen.nl/download.html). Use the `DOXYGEN_BINARY` environment variable to override the default `doxygen` command with a path to a specific Doxygen binary. +> The required Doxygen version is defined in `etc/generate-latest-apidocs.sh` as `$DOXYGEN_VERSION_REQUIRED`. If not already present, download the required version from [Doxygen Releases](https://www.doxygen.nl/download.html). Use the `DOXYGEN_BINARY` environment variable to override the default `doxygen` command with a path to a specific Doxygen binary. Run `git clean -dfx` to restore the repository to a clean state. From 2eced3b1dbf0a2c1747be182047ad589ea7ffc2a Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:09:58 -0600 Subject: [PATCH 08/20] Address sheckcheck warning SDC2064 --- etc/generate-latest-apidocs.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index 428400a92d..66c91684ab 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -28,8 +28,8 @@ fi # Validate Doxygen version. doxygen_version="$("${DOXYGEN_BINARY:?}" -v | perl -lne 'print $1 if m/^(\d+\.\d+\.\d+).*$/')" if [[ "${doxygen_version:-}" != "${DOXYGEN_VERSION_REQUIRED:?}" ]]; then - echo "${DOXYGEN_BINARY} version ${doxygen_version:-"unknown"} does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 - exit 1 + echo "${DOXYGEN_BINARY} version ${doxygen_version:-"unknown"} does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 + exit 1 fi working_dir="$(pwd)" @@ -37,7 +37,7 @@ apidocpath="${working_dir:?}/build/docs/api/mongocxx-${LATEST_VERSION:?}" # Use a temporary directory for the following operations. tmpdir="$(mktemp -d)" -trap "rm -rf \"${tmpdir}\"" EXIT +trap 'rm -rf "${tmpdir:?}"' EXIT mkdir -p "${apidocpath:?}" @@ -56,9 +56,9 @@ sed -i \ # Generate API documentation. ( - set -o xtrace + set -o xtrace - cmake -S . -B build -D "DOXYGEN_EXECUTABLE=${DOXYGEN_BINARY:?}" --log-level=WARNING - cmake --build build --target docs_source_directory - "${DOXYGEN_BINARY:?}" + cmake -S . -B build -D "DOXYGEN_EXECUTABLE=${DOXYGEN_BINARY:?}" --log-level=WARNING + cmake --build build --target docs_source_directory + "${DOXYGEN_BINARY:?}" ) From 4cc080a075174d855c9e2bf87508414a135305ff Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:10:01 -0600 Subject: [PATCH 09/20] Fix reference to release tags --- etc/generate-latest-apidocs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index 66c91684ab..ffb2f83c56 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -42,7 +42,7 @@ trap 'rm -rf "${tmpdir:?}"' EXIT mkdir -p "${apidocpath:?}" # Use a clean copy of the repository. -git clone -q -c advice.detachedHead=false -b "v${LATEST_VERSION}" . "${tmpdir}" +git clone -q -c advice.detachedHead=false -b "r${LATEST_VERSION}" . "${tmpdir}" cd "${tmpdir:?}" From ab9bb476fe9acd7dfc62100a7befdab9723c60d4 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:10:01 -0600 Subject: [PATCH 10/20] Reuse generate-latest-apidocs.sh for current API docs --- CMakeLists.txt | 6 +--- etc/generate-latest-apidocs.sh | 56 +++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4214e3aa8..16ad888865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,13 +305,9 @@ add_custom_target(docs_target_directory COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current ) -# Set `DOXYGEN_EXECUTABLE` to specify the full path to a custom Doxygen binary. -find_package(Doxygen 1.12.0 EXACT QUIET) - add_custom_target(doxygen-current - DEPENDS Doxygen::doxygen docs_source_directory docs_target_directory WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND Doxygen::doxygen + COMMAND etc/generate-current-apidocs.sh --current VERBATIM ) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index ffb2f83c56..fe245ac6cf 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -10,6 +10,22 @@ set -o errexit set -o pipefail +use_current="no" + +while [[ "$#" > 0 ]]; do + case "${1:?}" in + --current) + use_current="yes" + ;; + *) + echo "unrecognized argument: ${1:?}" 1>&2 + exit 1 + ;; + esac + + shift +done + LATEST_VERSION="4.0.0" DOXYGEN_VERSION_REQUIRED="1.12.0" @@ -33,32 +49,38 @@ if [[ "${doxygen_version:-}" != "${DOXYGEN_VERSION_REQUIRED:?}" ]]; then fi working_dir="$(pwd)" -apidocpath="${working_dir:?}/build/docs/api/mongocxx-${LATEST_VERSION:?}" +apidocspath="${working_dir:?}/build/docs/api" -# Use a temporary directory for the following operations. -tmpdir="$(mktemp -d)" -trap 'rm -rf "${tmpdir:?}"' EXIT +if [[ "${use_current:?}" == "yes" ]]; then + # Use the current repository's build directory. + output_directory="${apidocspath:?}/current" + scratch_dir="$(pwd)" +else + # Use a clean copy of the repository. + output_directory="${apidocspath:?}/mongocxx-${LATEST_VERSION:?}" + scratch_dir="$(mktemp -d)" + trap 'rm -rf "${scratch_dir:?}"' EXIT -mkdir -p "${apidocpath:?}" + git clone -q -c advice.detachedHead=false -b "r${LATEST_VERSION}" . "${scratch_dir:?}" -# Use a clean copy of the repository. -git clone -q -c advice.detachedHead=false -b "r${LATEST_VERSION}" . "${tmpdir}" - -cd "${tmpdir:?}" + # Update the Doxyfile configuration file: + # - set OUTPUT_DIRECTORY to `build/docs/api/mongocxx-`. + # - set PROJECT_NUMBER to ``. + sed -i \ + -e "s|^OUTPUT_DIRECTORY\s*=\s*.*$|OUTPUT_DIRECTORY = ${output_directory:?}|g" \ + -e "s|^PROJECT_NUMBER\s*=\s*.*$|PROJECT_NUMBER = ${LATEST_VERSION:?}|g" \ + "${scratch_dir:?}/Doxyfile" +fi -# Update the Doxyfile configuration file: -# - set OUTPUT_DIRECTORY to `build/docs/api/mongocxx-`. -# - set PROJECT_NUMBER to ``. -sed -i \ - -e "s|^OUTPUT_DIRECTORY\s*=\s*.*$|OUTPUT_DIRECTORY = ${apidocpath:?}|g" \ - -e "s|^PROJECT_NUMBER\s*=\s*.*$|PROJECT_NUMBER = ${LATEST_VERSION:?}|g" \ - Doxyfile +mkdir -p "${output_directory:?}" # Generate API documentation. ( + cd "${scratch_dir:?}" + set -o xtrace - cmake -S . -B build -D "DOXYGEN_EXECUTABLE=${DOXYGEN_BINARY:?}" --log-level=WARNING + cmake -S . -B build --log-level=WARNING cmake --build build --target docs_source_directory "${DOXYGEN_BINARY:?}" ) From 35c0e2993800b4bdbcbc845d8930b33a7edf6601 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:13:44 -0600 Subject: [PATCH 11/20] Address discrepancy between GNU and BSD sed --- etc/generate-latest-apidocs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index fe245ac6cf..d29ee8df93 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -66,7 +66,7 @@ else # Update the Doxyfile configuration file: # - set OUTPUT_DIRECTORY to `build/docs/api/mongocxx-`. # - set PROJECT_NUMBER to ``. - sed -i \ + sed -i '' \ -e "s|^OUTPUT_DIRECTORY\s*=\s*.*$|OUTPUT_DIRECTORY = ${output_directory:?}|g" \ -e "s|^PROJECT_NUMBER\s*=\s*.*$|PROJECT_NUMBER = ${LATEST_VERSION:?}|g" \ "${scratch_dir:?}/Doxyfile" From 10d4a7963c21fa8954791ce49fe42788f2e38fdb Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:35:28 -0600 Subject: [PATCH 12/20] Remove unnecessary docs_target_directory target --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16ad888865..54393ea5db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -301,10 +301,6 @@ add_custom_target(docs_source_directory ${MONGO_CXX_DRIVER_SOURCE_DIR}/build/doxygen/install/include ) -add_custom_target(docs_target_directory - COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current -) - add_custom_target(doxygen-current WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND etc/generate-current-apidocs.sh --current From 969ea5dea8bae5e1c76d0172ed8d57f0a8b19cc1 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:35:29 -0600 Subject: [PATCH 13/20] Rename docs_source_directory to doxygen-install-headers --- CMakeLists.txt | 2 +- etc/generate-latest-apidocs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54393ea5db..89e946c209 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,7 +283,7 @@ add_custom_target(hugo-deploy VERBATIM ) -add_custom_target(docs_source_directory +add_custom_target(doxygen-install-headers VERBATIM # Clear any existing files in the target directory. diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index d29ee8df93..5b0f83e418 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -81,6 +81,6 @@ mkdir -p "${output_directory:?}" set -o xtrace cmake -S . -B build --log-level=WARNING - cmake --build build --target docs_source_directory + cmake --build build --target doxygen-install-headers "${DOXYGEN_BINARY:?}" ) From 97be600b684b2a6b84a71ec5120692cabcd52c21 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:35:29 -0600 Subject: [PATCH 14/20] Remove space after `-i` sed flag for GNU sed conformance --- etc/generate-latest-apidocs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index 5b0f83e418..51be9d3718 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -66,7 +66,7 @@ else # Update the Doxyfile configuration file: # - set OUTPUT_DIRECTORY to `build/docs/api/mongocxx-`. # - set PROJECT_NUMBER to ``. - sed -i '' \ + sed -i'' \ -e "s|^OUTPUT_DIRECTORY\s*=\s*.*$|OUTPUT_DIRECTORY = ${output_directory:?}|g" \ -e "s|^PROJECT_NUMBER\s*=\s*.*$|PROJECT_NUMBER = ${LATEST_VERSION:?}|g" \ "${scratch_dir:?}/Doxyfile" From c02abf13504767100ec0fe2c346f6941b489e303 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:37:54 -0600 Subject: [PATCH 15/20] Fix name of script for doxygen-current --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89e946c209..f0407d0a5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,7 +303,7 @@ add_custom_target(doxygen-install-headers add_custom_target(doxygen-current WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND etc/generate-current-apidocs.sh --current + COMMAND etc/generate-latest-apidocs.sh --current VERBATIM ) From c88796b5cffafb5055ca93a77a78ac2fdc6ae287 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 09:41:53 -0600 Subject: [PATCH 16/20] Update release instructions to account for new Doxygen binary checks --- etc/releasing.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/releasing.md b/etc/releasing.md index bcd0416fd3..65d5365313 100644 --- a/etc/releasing.md +++ b/etc/releasing.md @@ -691,16 +691,19 @@ Configure CMake using `build` as the binary directory. Leave all other configura cmake -S . -B build ``` -Test generating Hugo and Doxygen docs locally by building the `docs` target (this command DOES NOT check for the required Doxygen version): +Test generating both Hugo and Doxygen docs locally by building the `docs` target: ```bash +export DOXYGEN_BINARY= # Optional. For binary version compatibility. + cmake --build build --target docs ``` -Test generating the latest versioned Doxygen docs by building the `doxygen-latest` target (this command DOES checks for the required Doxygen version): +Test generating the latest versioned Doxygen docs by building the `doxygen-latest` target: ```bash export DOXYGEN_BINARY= # Optional. For binary version compatibility. + cmake --build build --target doxygen-latest ``` From 07481f0f254ea48996eb48bf48402583c35ae973 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 12:18:44 -0600 Subject: [PATCH 17/20] Permit incompatible Doxygen binary version with --any-version --- etc/generate-latest-apidocs.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index 51be9d3718..f11cf2ffba 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -11,12 +11,16 @@ set -o errexit set -o pipefail use_current="no" +use_any_version="no" while [[ "$#" > 0 ]]; do case "${1:?}" in --current) use_current="yes" ;; + --any-version) + use_any_version="yes" + ;; *) echo "unrecognized argument: ${1:?}" 1>&2 exit 1 @@ -44,8 +48,12 @@ fi # Validate Doxygen version. doxygen_version="$("${DOXYGEN_BINARY:?}" -v | perl -lne 'print $1 if m/^(\d+\.\d+\.\d+).*$/')" if [[ "${doxygen_version:-}" != "${DOXYGEN_VERSION_REQUIRED:?}" ]]; then - echo "${DOXYGEN_BINARY} version ${doxygen_version:-"unknown"} does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 - exit 1 + if [[ "${use_any_version:?}" == "yes" ]]; then + echo "using ${DOXYGEN_BINARY:?} version ${doxygen_version:-"unknown"} which does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 + else + echo "${DOXYGEN_BINARY} version ${doxygen_version:-"unknown"} does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 + exit 1 + fi fi working_dir="$(pwd)" From a03e13a341754dfdedf47dc8db90be73efc18c14 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 12:23:57 -0600 Subject: [PATCH 18/20] Convert command line flags into environment variables --- CMakeLists.txt | 2 +- etc/generate-latest-apidocs.sh | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0407d0a5f..efa399b223 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,7 +303,7 @@ add_custom_target(doxygen-install-headers add_custom_target(doxygen-current WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND etc/generate-latest-apidocs.sh --current + COMMAND ${CMAKE_COMMAND} -E env DOXYGEN_USE_CURRENT=1 etc/generate-latest-apidocs.sh VERBATIM ) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index f11cf2ffba..d84dd2664e 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -13,22 +13,13 @@ set -o pipefail use_current="no" use_any_version="no" -while [[ "$#" > 0 ]]; do - case "${1:?}" in - --current) - use_current="yes" - ;; - --any-version) - use_any_version="yes" - ;; - *) - echo "unrecognized argument: ${1:?}" 1>&2 - exit 1 - ;; - esac +if [[ "${DOXYGEN_USE_CURRENT:-0}" == 1 ]]; then + use_current="yes" +fi - shift -done +if [[ "${DOXYGEN_ANY_VERSION:-0}" == 1 ]]; then + use_any_version="yes" +fi LATEST_VERSION="4.0.0" DOXYGEN_VERSION_REQUIRED="1.12.0" From 4c8155b21ad5e86baa5451a006deebc4e2711159 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 12:28:21 -0600 Subject: [PATCH 19/20] Simplify use of environment variables --- etc/generate-latest-apidocs.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index d84dd2664e..688dce6767 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -10,23 +10,18 @@ set -o errexit set -o pipefail -use_current="no" -use_any_version="no" - -if [[ "${DOXYGEN_USE_CURRENT:-0}" == 1 ]]; then - use_current="yes" -fi - -if [[ "${DOXYGEN_ANY_VERSION:-0}" == 1 ]]; then - use_any_version="yes" -fi - LATEST_VERSION="4.0.0" DOXYGEN_VERSION_REQUIRED="1.12.0" # Permit using a custom Doxygen binary. : "${DOXYGEN_BINARY:=doxygen}" +# Use the current repository instead of a clean temporary repository. +: "${DOXYGEN_USE_CURRENT:=0}" + +# Permit using any Doxygen version. +: "${DOXYGEN_ANY_VERSION:=0}" + command -v git >/dev/null command -v mktemp >/dev/null command -v sed >/dev/null @@ -39,7 +34,7 @@ fi # Validate Doxygen version. doxygen_version="$("${DOXYGEN_BINARY:?}" -v | perl -lne 'print $1 if m/^(\d+\.\d+\.\d+).*$/')" if [[ "${doxygen_version:-}" != "${DOXYGEN_VERSION_REQUIRED:?}" ]]; then - if [[ "${use_any_version:?}" == "yes" ]]; then + if [[ "${DOXYGEN_ANY_VERSION:?}" == 1 ]]; then echo "using ${DOXYGEN_BINARY:?} version ${doxygen_version:-"unknown"} which does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 else echo "${DOXYGEN_BINARY} version ${doxygen_version:-"unknown"} does not equal ${DOXYGEN_VERSION_REQUIRED:?}" 1>&2 @@ -50,7 +45,7 @@ fi working_dir="$(pwd)" apidocspath="${working_dir:?}/build/docs/api" -if [[ "${use_current:?}" == "yes" ]]; then +if [[ "${DOXYGEN_USE_CURRENT:?}" == "yes" ]]; then # Use the current repository's build directory. output_directory="${apidocspath:?}/current" scratch_dir="$(pwd)" From fe04a8ec99aab1ff4410f1ec6f5c3c61bf5f96f9 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 18 Dec 2024 12:33:41 -0600 Subject: [PATCH 20/20] Fix conditional expression --- etc/generate-latest-apidocs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/generate-latest-apidocs.sh b/etc/generate-latest-apidocs.sh index 688dce6767..05bf6abac7 100755 --- a/etc/generate-latest-apidocs.sh +++ b/etc/generate-latest-apidocs.sh @@ -45,7 +45,7 @@ fi working_dir="$(pwd)" apidocspath="${working_dir:?}/build/docs/api" -if [[ "${DOXYGEN_USE_CURRENT:?}" == "yes" ]]; then +if [[ "${DOXYGEN_USE_CURRENT:?}" == 1 ]]; then # Use the current repository's build directory. output_directory="${apidocspath:?}/current" scratch_dir="$(pwd)"