* mdoc-update.1: Add new --exceptions=added functionality.
[mono.git] / man / mdoc-update.1
1 .\" 
2 .\" mdoc-update manual page.
3 .\" (C) 2008 Jonathan Pryor
4 .\" Author:
5 .\"   Jonathan Pryor (jpryor@novell.com)
6 .\"
7 .de Sp \" Vertical space (when we can't use .PP)
8 .if t .sp .5v
9 .if n .sp
10 ..
11 .TH "mdoc-update" 1
12 .SH NAME
13 mdoc update \- \fBmdoc\fR(5) documentation format support
14 .SH SYNOPSIS
15 \fBmdoc update\fR [OPTIONS]* ASSEMBLIES
16 .SH DESCRIPTION
17 \fBmdoc update\fR is responsible for the following:
18 .TP
19 .B *
20 Creating documentation stubs based on \fIASSEMBLIES\fR.  The stub-creation
21 process will create new \fBmdoc\fR(5) XML files for each type within
22 \fIASSEMBLIES\fR, and provide documentation stubs for each member of those
23 types.
24 .TP
25 .B *
26 Update documentation stubs based on \fIASSEMBLIES\fR.  Existing \fBmdoc\fR(5)
27 documentation can be updated to reflect changes within \fIASSEMBLIES\fR, such
28 as added types and members, while preserving existing documentation.
29 .Sp
30 In some limited circumstances, renames will be tracked, minimizing the
31 documentation burden when e.g. a parameter is renamed.
32 circumstances, 
33 creates stubs and updates documentation in the \fBmdoc\fR(5)
34 documentation format from \fIASSEMBLIES\fR.
35 .PP
36 \fBmdoc update\fR does not rely on documentation found within source code.
37 .PP
38 See \fBmdoc\fR(1) and \fBmdoc\fR(5) for more information.
39 .SH OPTIONS
40 .TP
41 .B \-\-delete
42 Allow \fBmdoc update\fR to delete members from documentation files.  
43 The only members deleted are members which are no longer present within
44 \fIASSEMBLIES\fR and are not present in any other assembly versions.
45 .Sp
46 If a type is no longer present, the documentation file is \fInot\fR
47 deleted, but is instead \fIrenamed\fR to have a \fB.remove \fR extension.
48 .Sp
49 Version detection is done with the \fI//AssemblyVersion\fR elements; if there
50 are no \fI//AssemblyVersion\fR elements for a given \fI<Type>\fR or 
51 \fI<Member/>\fR, then the \fI<Type>\fR will be renamed and/or the 
52 \fI<Member/>\fR will be removed.
53 .TP
54 \fB\-\-exceptions\fR[=\fISOURCES\fR]
55 EXPERIMENTAL.  This is not 100% reliable, but is intended to serve as an aid
56 for documentation writers.
57 .Sp
58 Inspect member bodies to determine what exceptions can be generated from the
59 member.
60 .Sp
61 \fISOURCES\fR is an optional comma-separated list of the following sources
62 that should be searched for exceptions:
63 .Sp
64 .nf
65         added   Only generate <exception/> elements for members 
66                   added during the current program execution.
67                   This keeps mdoc-update from re-generating
68                   <exception/> elements for all members (and thus
69                   prevents re-insertion for members that had the
70                   <exception/> elements removed).
71         all     Find exceptions created in the member itself, 
72                   references to members in the same assembly, 
73                   and references to members in dependent 
74                   assemblies.
75         asm     Find exceptions created in the member itself and
76                   references to members within the same assembly
77                   as the member.
78         depasm  Find exceptions created in the member itself and
79                   references to members within dependent 
80                   assemblies.
81 .fi
82 .Sp
83 If \fISOURCES\fR isn't provided (the default), then only exceptions created 
84 within the member itself will be documented.
85 .Sp
86 LIMITATIONS: Exception searching is currently implemented by looking for the
87 exception types that are explicitly created based on the known compile-time
88 types.  This has the following limitations:
89 .RS
90 .ne 8
91 .TP
92 .B *
93 This will not find exceptions which are implicit to the IL, such as
94 NullReferenceException and IndexOutOfRangeException.
95 .TP
96 .B *
97 This will find exceptions which are \fInot\fR thrown, e.g.
98 .nf
99
100     public void CreateAnException ()
101     {
102         Exception e = new Exception ();
103     }
104
105 .fi
106 .TP
107 .B *
108 This will not "follow" delegate and interface calls:
109 .nf
110
111     public void UsesDelegates ()
112     {
113         Func<int, int> a = x => {throw new Exception ();};
114         a (4);
115     }
116
117 .fi
118 The function \fIUsesDelegates()\fR won't have any exceptions documented.
119 .TP
120 .B *
121 This will find exceptions which "cannot happen", such as
122 ArgumentNullExceptions for arguments which are "known" to be non-null:
123 .nf
124
125     public void A ()
126     {
127         B ("this parameter isn't null");
128     }
129
130     public void B (string s)
131     {
132         if (s == null)
133             throw new ArgumentNullException ("s");
134     }
135
136 .fi
137 For the above, if \fB--exceptions=asm\fR is provided then \fIA()\fR will be
138 documented as throwing an ArgumentNullException, which cannot happen.
139 .ne
140 .RE
141 .TP
142 \fB\-f\fR=\fIFLAG\fR
143 Specify a flag to alter behavior.  Valid flags include:
144 .RS
145 .ne 8
146 .TP
147 .B no-assembly-versions
148 See the \fB-fno-assembly-versions\fR documentation, below.
149 .ne
150 .RE
151 .TP
152 \fB\-fno-assembly-versions\fR
153 Do not generate \fI/Type/AssemblyInfo/AssemblyVersion\fR and
154 \fI/Type/Members/Member/AssemblyInfo\fR elements.
155 .Sp
156 This is useful to prevent "churn" during updates.  Normally, if a type or
157 member hasn't changed but the assembly version has changed, then all types and
158 members will be updated to include a new \fI//AssemblyVersion\fR element, thus
159 increasing the amount of changes that need review before committing (assuming
160 all changes are actually reviewed before commit).
161 .Sp
162 WARNING: This \fIwill\fR interact badly with the \fB--delete\fR option, as
163 \fB--delete\fR uses the \fI//AssemblyVersion\fR elements to track version
164 changes.  Thus, if you have a member which is present in an early assembly
165 version and is removed in a subsequent assembly version, such as
166 \fISystem.Text.UTF8Encoding.GetBytes(string)\fR (which is present in .NET 1.0
167 but not in .NET 2.0), then the member will be removed when the
168 \fB--delete -fno-assembly-versions\fR options are specified, the member was
169 present in an earlier version of the assembly, and the current version of the
170 assembly does not contain the member.
171 .Sp
172 Consequently, this option should \fIonly\fR be specified if types and members
173 will \fInever\fR be removed from an assembly.
174 .TP
175 \fB\-i\fR, \fB\-\-import\fR=\fIFILE\fR
176 Import documentation found within \fIFILE\fR.
177 .Sp
178 \fIFILE\fR may contain either \fIcsc /doc\fR XML or \fIECMA-335\fR XML.
179 .TP
180 \fB\-o\fR, \fB\-\-out\fB=\fIDIRECTORY\fR
181 Place the generated stubs into \fIDIRECTORY\fR.
182 .Sp
183 When updating documentation, \fIDIRECTORY\fR is also the source directory.
184 .TP
185 \fB\-\-since\fR=\fIVERSION\fR
186 When \fIupdating\fR documentation for an assembly, if a type or member is
187 encountered which didn't exist in the previous version of the assembly a
188 \fB<since version="\fR\fIVERSION\fR\fB"/>\fR element will be inserted.
189 .TP
190 \fB\-\-type\fR=\fITYPE\fR
191 Only update documentation for the type \fITYPE\fR.
192 .TP
193 .B \-h, \-?, \-\-help
194 Display a help message and exit.
195 .SH SEE ALSO
196 mdoc(1), 
197 mdoc(5), 
198 mdoc-assemble(1),
199 mdoc-export-html(1),
200 mdoc-validate(1),
201 .SH MAILING LISTS
202 .TP
203 Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details.
204 .SH WEB SITE
205 Visit http://www.mono-project.com for details