maint.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. CMake Maintainer Guide
  2. **********************
  3. The following is a guide to CMake maintenance processes.
  4. See documentation on `CMake Development`_ for more information.
  5. .. _`CMake Development`: README.rst
  6. .. contents:: Maintainer Processes:
  7. Governance
  8. ==========
  9. CMake has no formal governance body. Maintainers expect one another to
  10. cooperate constructively and make decisions in good faith. In cases of
  11. disagreement, the chief maintainer retains final authority.
  12. Review a Merge Request
  13. ======================
  14. The `CMake Review Process`_ requires a maintainer to issue the ``Do: merge``
  15. command to integrate a merge request. Please check at least the following:
  16. * If the MR source branch (or part of it) should be backported
  17. to the ``release`` branch (and is already based on a commit
  18. contained in the ``release`` branch), add a ``Backport: release`` or
  19. ``Backport: release:<commit-ish>`` trailing line to the MR description.
  20. * If the MR source branch is not named well for the change it makes
  21. (e.g. it is just ``master`` or the patch changed during review),
  22. add a ``Topic-rename: <topic>`` trailing line to the MR description
  23. to provide a better topic name.
  24. * If the MR introduces a new feature or a user-facing behavior change,
  25. such as a policy, ensure that a ``Help/release/dev/$topic.rst`` file
  26. is added with a release note.
  27. * If a commit changes a specific area, such as a module, its commit
  28. message should have an ``area:`` prefix on its first line.
  29. * If a commit fixes a tracked issue, its commit message should have
  30. a trailing line such as ``Fixes: #00000``.
  31. * Ensure that the MR adds sufficient documentation and test cases.
  32. * Ensure that the MR has been tested sufficiently. Typically it should
  33. be staged for nightly testing with ``Do: stage``. Then manually
  34. review the `CMake CDash Page`_ to verify that no regressions were
  35. introduced. (Learn to tolerate spurious failures due to idiosyncrasies
  36. of various nightly builders.)
  37. * Ensure that the MR targets the ``master`` branch. A MR intended for
  38. the ``release`` branch should be based on ``release`` but still target
  39. ``master``. Use the above-mentioned ``Backport: release`` line to tell
  40. ``Do: merge`` to merge to both. If a MR is merged without the backport
  41. line, a maintainer may still merge the MR topic to ``release`` manually.
  42. Maintain Current Release
  43. ========================
  44. The ``release`` branch is used to maintain the current release or release
  45. candidate. The branch is published with no version number but maintained
  46. using a local branch named ``release-$ver``, where ``$ver`` is the version
  47. number of the current release in the form ``$major.$minor``. It is always
  48. merged into ``master`` before publishing.
  49. To merge an open MR to the ``release`` branch, edit its description to
  50. use the ``Backport: release`` line mentioned above and then ``Do: merge``
  51. normally. To update the ``release`` branch manually (e.g. to merge a
  52. ``$topic`` branch that was merged without the backport line), use the
  53. following procedure.
  54. Before merging a ``$topic`` branch into ``release``, verify that the
  55. ``$topic`` branch has already been merged to ``master`` via the usual
  56. ``Do: merge`` process. Then, to merge the ``$topic`` branch into
  57. ``release``, start by creating the local branch:
  58. .. code-block:: shell
  59. git fetch origin
  60. git switch -c release-$ver origin/release
  61. Merge the ``$topic`` branch into the local ``release-$ver`` branch, making
  62. sure to include a ``Merge-request: !xxxx`` footer in the commit message:
  63. .. code-block:: shell
  64. git merge --no-ff $topic
  65. Merge the ``release-$ver`` branch to ``master``:
  66. .. code-block:: shell
  67. git switch master
  68. git pull
  69. git merge --no-ff release-$ver
  70. Review new ancestry to ensure nothing unexpected was merged to either branch:
  71. .. code-block:: shell
  72. git log --graph --boundary origin/master..master
  73. git log --graph --boundary origin/release..release-$ver
  74. Publish both ``master`` and ``release`` simultaneously:
  75. .. code-block:: shell
  76. git push --atomic origin master release-$ver:release
  77. .. _`CMake Review Process`: review.rst
  78. .. _`CMake CDash Page`: https://open.cdash.org/index.php?project=CMake
  79. Create Release Version
  80. ======================
  81. When the ``release`` branch is ready to create a new release, follow the
  82. steps in the above `Maintain Current Release`_ section to checkout a local
  83. ``release-$ver`` branch, where ``$ver`` is the version number of the
  84. current release in the form ``$major.$minor``.
  85. Edit ``Source/CMakeVersion.cmake`` to set the full version:
  86. .. code-block:: cmake
  87. # CMake version number components.
  88. set(CMake_VERSION_MAJOR $major)
  89. set(CMake_VERSION_MINOR $minor)
  90. set(CMake_VERSION_PATCH $patch)
  91. #set(CMake_VERSION_RC $rc) # uncomment for release candidates
  92. In the following we use the placeholder ``$fullver`` for the full version
  93. number of the new release with the form ``$major.$minor.$patch[-rc$rc]``.
  94. If the version is not a release candidate, comment out the RC version
  95. component above and leave off the ``-rc$rc`` suffix from ``$fullver``.
  96. Commit the release version with the **exact** message ``CMake $fullver``:
  97. .. code-block:: shell
  98. git commit -m "CMake $fullver"
  99. Tag the release using an annotated tag with the same message as the
  100. commit and named with the **exact** form ``v$fullver``:
  101. .. code-block:: shell
  102. git tag -s -m "CMake $fullver" "v$fullver"
  103. Follow the steps in the above `Maintain Current Release`_ section to
  104. merge the ``release-$ver`` branch into ``master`` and publish both.
  105. Branch a New Release
  106. ====================
  107. This section covers how to start a new ``release`` branch for a major or
  108. minor version bump (patch releases remain on their existing branch).
  109. In the following we use the placeholder ``$ver`` to represent the
  110. version number of the new release with the form ``$major.$minor``,
  111. and ``$prev`` to represent the version number of the prior release.
  112. Review Prior Release
  113. --------------------
  114. Review the history around the prior release branch:
  115. .. code-block:: shell
  116. git log --graph --boundary \
  117. ^$(git rev-list --grep="Merge topic 'doc-.*-relnotes'" -n 1 master)~1 \
  118. $(git rev-list --grep="Begin post-.* development" -n 1 master) \
  119. $(git tag --list *-rc1| tail -1)
  120. Consolidate Release Notes
  121. -------------------------
  122. Starting from a clean work tree on ``master``, create a topic branch to
  123. use for consolidating the release notes:
  124. .. code-block:: shell
  125. git switch -c doc-$ver-relnotes
  126. Run the `consolidate-relnotes.bash`_ script:
  127. .. code-block:: shell
  128. Utilities/Release/consolidate-relnotes.bash $ver $prev
  129. .. _`consolidate-relnotes.bash`: ../../Utilities/Release/consolidate-relnotes.bash
  130. This moves notes from the ``Help/release/dev/*.rst`` files into a versioned
  131. ``Help/release/$ver.rst`` file and updates ``Help/release/index.rst`` to
  132. link to the new document. Commit the changes with a message such as::
  133. Help: Consolidate $ver release notes
  134. Run the `Utilities/Release/consolidate-relnotes.bash` script to move
  135. notes from `Help/release/dev/*` into `Help/release/$ver.rst`.
  136. Manually edit ``Help/release/$ver.rst`` to add section headers, organize
  137. the notes, and revise wording. Then commit with a message such as::
  138. Help: Organize and revise $ver release notes
  139. Add section headers similar to the $prev release notes and move each
  140. individual bullet into an appropriate section. Revise a few bullets.
  141. Update Sphinx ``versionadded`` directives in documents added since
  142. the previous release by running the `update_versions.py`_ script:
  143. .. code-block:: shell
  144. Utilities/Sphinx/update_versions.py --since v$prev.0 --overwrite
  145. .. _`update_versions.py`: ../../Utilities/Sphinx/update_versions.py
  146. Commit the changes with a message such as::
  147. Help: Update Sphinx versionadded directives for $ver release
  148. Run the script:
  149. Utilities/Sphinx/update_versions.py --since v$prev.0 --overwrite
  150. Open a merge request with the ``doc-$ver-relnotes`` branch for review
  151. and integration. Further steps may proceed after this has been merged
  152. to ``master``.
  153. Update 'release' Branch
  154. -----------------------
  155. Starting from a clean work tree on ``master``, create a new ``release-$ver``
  156. branch locally:
  157. .. code-block:: shell
  158. git switch -c release-$ver origin/master
  159. Remove the development branch release note infrastructure:
  160. .. code-block:: shell
  161. git rm Help/release/dev/0-sample-topic.rst
  162. sed -i '/^\.\. include:: dev.txt/ {N;d}' Help/release/index.rst
  163. Commit with a message such as::
  164. Help: Drop development topic notes to prepare release
  165. Release versions do not have the development topic section of
  166. the CMake Release Notes index page.
  167. Update ``Source/CMakeVersion.cmake`` to set the version to
  168. ``$major.$minor.0-rc0``:
  169. .. code-block:: cmake
  170. # CMake version number components.
  171. set(CMake_VERSION_MAJOR $major)
  172. set(CMake_VERSION_MINOR $minor)
  173. set(CMake_VERSION_PATCH 0)
  174. set(CMake_VERSION_RC 0)
  175. Replace uses of ``CMake_VERSION_DEVEL`` in the source tree with
  176. the literal release version number string ``"$major.$minor.0"``:
  177. .. code-block:: shell
  178. $EDITOR $(git grep -l CMake_VERSION_DEVEL)
  179. Commit with a message such as::
  180. Begin $ver release versioning
  181. Merge the ``release-$ver`` branch to ``master``:
  182. .. code-block:: shell
  183. git switch master
  184. git pull
  185. git merge --no-ff release-$ver
  186. Begin post-release development by restoring the development branch release
  187. note infrastructure, and the version date from ``origin/master``:
  188. .. code-block:: shell
  189. git restore -s origin/master -- \
  190. Source/CMakeVersion.cmake Help/release/dev/0-sample-topic.rst
  191. sed -i $'/^Releases/ i\\\n.. include:: dev.txt\\\n' Help/release/index.rst
  192. Update ``Source/CMakeVersion.cmake`` to set the version to
  193. ``$major.$minor.$date``:
  194. .. code-block:: cmake
  195. # CMake version number components.
  196. set(CMake_VERSION_MAJOR $major)
  197. set(CMake_VERSION_MINOR $minor)
  198. set(CMake_VERSION_PATCH $date)
  199. #set(CMake_VERSION_RC 0)
  200. Update ``Help/manual/cmake-policies.7.rst`` to set the ``...<max>``
  201. example to ``...$major.$minor``:
  202. .. code-block:: cmake
  203. cmake_minimum_required(VERSION 3.10...$major.$minor)
  204. Commit with a message such as::
  205. Begin post-$ver development
  206. Create a topic branch for the update to ``master``:
  207. .. code-block:: shell
  208. git branch branch-$ver master
  209. Open a merge request with the ``branch-$ver`` branch for review and CI.
  210. Add the following trailing lines in the merge request description::
  211. Fast-forward: true
  212. Backport-ff: release:HEAD~1^2
  213. This configures the ``Do: merge`` action to fast-forward the ``master``
  214. and ``release`` branches to the respective commits created above.
  215. Further steps may proceed after this has been merged.
  216. Announce 'release' Branch
  217. -------------------------
  218. Post a topic to the `CMake Discourse Forum Development Category`_
  219. announcing that post-release development is open::
  220. I've branched `release` for $ver. The repository is now open for
  221. post-$ver development. Please rebase open merge requests on `master`
  222. before staging or merging.
  223. .. _`CMake Discourse Forum Development Category`: https://discourse.cmake.org/c/development
  224. Initial Post-Release Development
  225. --------------------------------
  226. Deprecate policies more than 8 release series old by updating the
  227. policy range check in ``cmMakefile::SetPolicy``.
  228. Commit with a message such as::
  229. Add deprecation warnings for policies CMP#### and below
  230. The OLD behaviors of all policies are deprecated, but only by
  231. documentation. Add an explicit deprecation diagnostic for policies
  232. introduced in CMake $OLDVER and below to encourage projects to port
  233. away from setting policies to OLD.
  234. Update the ``cmake_policy`` version range generated by ``install(EXPORT)``
  235. in ``cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode`` and
  236. ``install_jar_exports`` in ``javaTargets.cmake.in`` to end at the
  237. previous release. We use one release back since we now know all the
  238. policies added for that version. Commit with a message such as::
  239. export: Increase maximum policy version in exported files to $prev
  240. The files generated by `install(EXPORT)`, `export()`, and
  241. `install_jar_exports()` commands are known to work with policies
  242. as of CMake $prev, so enable them in sufficiently new CMake versions.
  243. Update the ``cmake_minimum_required`` version range in CMake itself:
  244. * ``CMakeLists.txt``
  245. * ``Source/Checks/Curses/CMakeLists.txt``
  246. * ``Utilities/Doxygen/CMakeLists.txt``
  247. * ``Utilities/Sphinx/CMakeLists.txt``
  248. to end in the previous release. Commit with a message such as::
  249. Configure CMake itself with policies through CMake $prev