Removed non-ff atomtypes from oplsaa and charmm27
[alexxy/gromacs.git] / docs / dev-manual / tools.md
1 Development-time tools {#page_devtools}
2 ======================
3
4 TODO: Add details for most of the tools, either in the form of links to wiki,
5 or to a separate page that explains more details.
6
7 Change management
8 =================
9
10 <dl>
11
12 <dt>git</dt>
13 <dd>\Gromacs uses git as the version control system.
14 Instructions for setting up git for \Gromacs, as well as tips and tricks for
15 its use, can be found on the wiki:
16 [Git Tips & Tricks](http://www.gromacs.org/index.php?title=Developer_Zone/Git/Git_Tips_%26_Tricks) <br/>
17 Other basic tutorial material for `git` can be found on the web.</dd>
18
19 <dt>Gerrit</dt>
20 <dd>All code changes go through a code review system at
21 <http://gerrit.gromacs.org>.</dd>
22
23 <dt>Jenkins</dt>
24 <dd>All changes pushed to Gerrit are automatically compiled and otherwise
25 checked on various platforms using a continuous integration system at
26 <http://jenkins.gromacs.org>.</dd>
27
28 <dt>Redmine</dt>
29 <dd>Bugs and issues, as well as some random features and discussions,
30 are tracked at <http://redmine.gromacs.org>.</dd>
31
32 </dl>
33
34 Build system
35 ============
36
37 TODO: details, ASAN, others?
38
39 <dl>
40
41 <dt>CMake</dt>
42 <dd></dd>
43
44 <dt>packaging for distribution (CPack)</dt>
45 <dd></dd>
46
47 <dt>unit testing (CTest)</dt>
48 <dd>\Gromacs uses a unit testing framework based on Google C++ Testing
49 Framework (gtest) and CTest.  All unit tests are automatically run on Jenkins
50 for each commit.
51 Details can be found on a separate page: \subpage page_unittesting.</dd>
52
53 <dt>regression tests</dt>
54 <dd></dd>
55
56 <dt>cppcheck</dt>
57 <dd>cppcheck (<http://cppcheck.sourceforge.net>) is used for static code
58 analysis, and is run automatically on Jenkins for each commit.  Different rules
59 are used for C and C++ code (with stricter checking for C++ code, as that is
60 newer).  The build system provides a `cppcheck` target (produced from
61 `tests/CppCheck.cmake`) to run the tool.  This target is used also by Jenkins.
62 </dd>
63
64 <dt>clang static analyzer</dt>
65 <dd></dd>
66
67 </dl>
68
69 Code formatting and style {#section_dev_formattingtools}
70 =========================
71
72 The tools and scripts listed below are used to automatically check/apply
73 formatting that follows \Gromacs style guidelines described on a separate page:
74 \ref page_devstyle.
75
76 <dl>
77
78 <dt>uncrustify</dt>
79 <dd>Uncrustify (<http://uncrustify.sourceforge.net>) is used for automatic
80 indentation and other formatting of the source code to follow
81 \ref page_devstyle_formatting.  All code must remain invariant under uncrustify
82 with the config at `admin/uncrustify.cfg`.  A patched version of uncrustify is
83 used.  See \ref page_dev_uncrustify for details.</dd>
84
85 <dt>`admin/copyright.py`</dt>
86 <dd>This Python script adds and formats copyright headers in source files.
87 `uncrustify.sh` (see below) uses the script to check/update copyright years on
88 changed files automatically.</dd>
89
90 <dt>`admin/uncrustify.sh`</dt>
91 <dd>This `bash` script runs uncrustify and `copyright.py` for all
92 files that have local changes and checks that they conform to the prescribed
93 style.  Optionally, the script can also apply changes to make the files
94 conform.
95 This script is automatically run by Jenkins to ensure that all commits adhere
96 to \ref page_devstyle_formatting.  If the uncrustify job does not succeed, it
97 means that this script has something to complain.
98 See \ref page_dev_uncrustify for details.</dd>
99
100 <dt>`admin/git-pre-commit`</dt>
101 <dd>This sample git pre-commit hook can be used if one wants to apply
102 `uncrustify.sh` automatically before every commit to check for formatting
103 issues.  See \ref page_dev_uncrustify for details.</dd>
104
105 <dt>`docs/doxygen/includesorter.py`</dt>
106 <dd>This Python script sorts and reformats \#include directives according to
107 the guidelines at \ref page_devstyle_includes.  Details are documented on a
108 separate page (with the whole suite of Python scripts used for source code
109 checks): \ref section_dev_includesorter.</dd>
110
111 <dt>include directive checker</dt>
112 <dd>In its present form, the above include sorter script cannot be conveniently
113 applied in `uncrustify.sh`.  To check for issues, it is instead integrated into
114 a `check-source` build target.  When this target is built, it also checks for
115 include formatting issues.  Internally, it uses the sorter script.  This check
116 is run in Jenkins as part of the Documentation job.
117 Details for the checking mechanism are on a separate page (common for several
118 checkers): \subpage page_dev_gmxtree.</dd>
119
120 <dt>`admin/reformat_all.sh`</dt>
121 <dd>This `bash` script runs uncrustify/`copyright.py`/include sorter
122 on all relevant files in the source tree (or in a particular directory).
123 The script can also produce the list of files where these scripts are applied,
124 for use with other scripts.  See \ref page_dev_uncrustify for details.</dd>
125
126 <dt>git attributes</dt>
127 <dd>git attributes (specified in `.gitattributes` files) are used to annotate
128 which files are subject to automatic formatting checks (and for automatic
129 reformatting by the above scripts).  See `man gitattributes` for an overview of
130 the mechanism.  We use the `filter` attribute to specify the type of automatic
131 checking/formatting to apply.  Custom attributes are used for specifying some
132 build system dependencies for easier processing in CMake.</dd>
133
134 <dt>include-what-you-use</dt>
135 <dd></dd>
136
137 </dl>
138
139 Documentation generation
140 ========================
141
142 Building the \Gromacs documentation
143 -----------------------------------
144
145 TODO: Move this onto a separate page
146
147 For now, there are multiple components, formats and tools for the
148 \Gromacs documentation, which is aimed primarily at version-specific
149 deployment of the complete documentation on the website.
150
151 This is quite complex, because the dependencies for building the
152 documentation must not get in the way of building the code
153 (particularly when cross-compiling), and yet the code must build and
154 run in order for some documentation to be generated. Also, man page
155 documentation (and command-line completions) must be built from the
156 wrapper binary, in order to be bundled into the tarball.
157
158 The outputs of interest to most developers are generally produced in the
159 <tt>docs/html/</tt> subdirectory of the build tree.
160
161 You need to enable at least some of the following CMake options:
162 <dl>
163 <dt><tt>GMX_BUILD_MANUAL</tt></dt>
164 <dd>Option needed for trying to build the PDF reference manual
165 (requires LaTeX and ImageMagick)</dd>
166 <dt><tt>GMX_BUILD_HELP</tt></dt>
167 <dd>Option that controls 1) whether shell completions are built automatically,
168 and 2) whether built man pages are installed if available (the user still needs
169 to build the `man` target manually before installing)</dd>
170 <dt><tt>GMX_BUILD_WEBPAGE</tt></dt>
171 <dd>Option needed for compiling all the documentation into the webpage</dd>
172 </dl>
173 Some documentation cannot be built if the CMake option
174 <tt>GMX_BUILD_MDRUN_ONLY</tt> is enabled, or when cross-compiling, as it
175 requires executing the `gmx` binary.
176
177 The following make targets are the most useful:
178 <dl>
179 <dt><tt>manual</tt></dt>
180 <dd>Builds the PDF reference manual</dd>
181 <dt><tt>man</tt></dt>
182 <dd>Makes man pages from the wrapper binary with Sphinx</dd>
183 <dt><tt>doxygen-all</tt></dt>
184 <dd>Makes the code documentation with Doxygen</dd>
185 <dt><tt>install-guide</tt></dt>
186 <dd>Makes the INSTALL file for the tarball with Sphinx</dd>
187 <dt><tt>webpage-sphinx</tt></dt>
188 <dd>Makes all the components of the GROMACS webpage that require Sphinx,
189 including install guide and user guide.</dd>
190 <dt><tt>webpage</tt></dt>
191 <dd>Makes the complete GROMACS webpage, requires everything. When complete,
192 you can browse <tt>docs/html/index.html</tt> to find everything.
193
194 If built from a release tarball, the <tt>SOURCE_MD5SUM</tt>,
195 <tt>SOURCE_TARBALL</tt>, <tt>REGRESSIONTESTS_MD5SUM</tt>, and
196 <tt>REGRESSIONTESTS_TARBALL</tt> CMake variables can be set to pass in
197 the md5sum values and names of those tarballs, for embedding into the
198 final deployment to the \Gromacs website.</dd>
199 </dl>
200
201 The following tools are used in building parts of the documentation.
202
203 <dl>
204 <dt>Doxygen</dt>
205 <dd>Doxygen (<http://www.doxygen.org>) is used to extract documentation from
206 source code comments.  Also this developer manual and some other overview
207 content is laid out by Doxygen from Markdown source files.  Currently, version
208 1.8.5 is required for a warning-free build.  Thorough explanation of the
209 Doxygen setup and instructions for documenting the source code can be found on
210 a separate page: \subpage page_doxygen.</dd>
211
212 <dt>graphviz (dot)</dt>
213 <dd>The Doxygen documentation uses `dot` from graphviz
214 (<http://www.graphviz.org>) for building some graphs.  The tool is not
215 mandatory, but the Doxygen build will produce warnings if it is not
216 available, and the graphs are omitted from the documentation.</dd>
217
218 <dt>mscgen</dt>
219 <dd>The Doxygen documentation uses `mscgen`
220 (<http://www.mcternan.me.uk/mscgen/>) for building some graphs.  As with `dot`,
221 the tool is not mandatory, but not having it available will result in warnings
222 and missing graphs.</dd>
223
224 <dt>Doxygen issue checker</dt>
225 <dd>Doxygen produces warnings about some incorrect uses and wrong
226 documentation, but there are many common mistakes that it does not detect.
227 \Gromacs uses an additional, custom Python script to check for such issues.
228 This is most easily invoked through a `check-source` target in the build system.
229 The script also checks that documentation for a header matches its use in the
230 source code (e.g., that a header documented as internal to a module is not
231 actually used from outside the module).  These checks are run in Jenkins as
232 part of the Documentation job.  Details for the custom checker are on a
233 separate page (common for several checkers): \subpage page_dev_gmxtree.</dd>
234
235 <dt>module dependency graphs</dt>
236 <dd>\Gromacs uses a custom Python script to generate an annotated dependency
237 graph for the code, showing \#include dependencies between modules.
238 The generated graph is embedded into the Doxygen documentation:
239 \ref page_modulegraph.
240 This script shares most of its implementation with the custom checkers, and is
241 documented on the same page: \subpage page_dev_gmxtree.</dd>
242
243 <dt>Sphinx</dt>
244 <dd>Sphinx (<http://sphinx-doc.org/>; at least version 1.2.3) is used
245 for building some parts of the documentation from reStructuredText
246 source files.</dd>
247
248 <dt>latex</dt>
249 <dd>Also requires ImageMagick for converting graphics file formats</dd>
250
251 <dt>linkchecker</dt>
252 <dd></dd>
253
254 <dt>documentation exported from source files</dt>
255 <dd>For man pages, HTML documentation of command-line options for executables,
256 and for shell completions, the `gmx` binary has explicit C++ code to export
257 the information required.  The build system provides targets that then invoke
258 the built `gmx` binary to produce these documentation items.  The generated
259 items are packaged into source tarballs so that this is not necessary when
260 building from a source distribution (since in general, it will not work in
261 cross-compilation scenarios).  To build and install these from a git
262 distribution, explicit action is required.
263 See \ref page_wrapperbinary for some additional details.</dd>
264
265 </dl>