blob: f74db8f77ff2f8f1310a6acc9cb8aed817cd1c91 [file] [log] [blame]
Ben Wagner29380bd2017-10-09 14:43:00 -04001#External
2SkXXX
Cary Clark7cfcbca2018-01-04 16:11:51 -05003SkIRect_Reference
4SkSurface_Reference
5SkSurface.h
Ben Wagner29380bd2017-10-09 14:43:00 -04006CL
7Go
8Visual_Studio
Cary Clarkc7924c92017-12-14 08:28:46 -05009Completed InProgress
Ben Wagner29380bd2017-10-09 14:43:00 -040010##
11
12#Topic Bookmaker
13
Cary Clarkac47b882018-01-11 10:35:44 -050014How to use the Bookmaker utility.
15
Cary Clark7cfcbca2018-01-04 16:11:51 -050016#Subtopic Broken_Build
17
Cary Clark682c58d2018-05-16 07:07:07 -040018If the
Cary Clark7cfcbca2018-01-04 16:11:51 -050019#A Housekeeper-PerCommit-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-PerCommit-Bookmaker ##
20 bot is red, the bot has detected that the files in docs and include/core differ.
21
22The bot output describes what changed.
23
24To fix this, edit the docs file corresponding to the changed include file.
25
26For instance, if the change was made to SkIRect, edit docs/SkIRect_Reference.bmh.
27Checking in the edited docs/SkIRect_Reference.bmh will fix the bot.
28
Cary Clarkac47b882018-01-11 10:35:44 -050029If the interface is deprecated, but still present in the interface, mark-up the
30documentation to be deprecated as well.
31
32#Code
33###$
34#Method void someMethodThatIsNowDeprecated()
Cary Clarkac47b882018-01-11 10:35:44 -050035#Deprecated
36##
Cary Clark4855f782018-02-06 09:41:53 -050037$$
Cary Clarkac47b882018-01-11 10:35:44 -050038
Cary Clark4855f782018-02-06 09:41:53 -050039Use
40
41$Code
42##Deprecated soon
43$$
44
45if the change is soon to be deprecated.
46
Cary Clarkac47b882018-01-11 10:35:44 -050047$$$#
Cary Clarkac47b882018-01-11 10:35:44 -050048
Cary Clark7cfcbca2018-01-04 16:11:51 -050049To regenerate the documentation, follow the Installing and Regenerate steps below.
50
51If the
Cary Clarkf5404bb2018-01-05 12:10:09 -050052#A Housekeeper-Nightly-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-Nightly-Bookmaker ##
53 bot is red, one of several things may have gone wrong:
54
55#List
56# A change to include broke documentation examples. ##
57# Something changed the examples that output text. ##
58# Some interface was added, deleted, edited. ##
59# Documentation is malformed. ##
60##
61
62The bot output describes what changed, and includes the file and line
63where the error occurred.
Cary Clark7cfcbca2018-01-04 16:11:51 -050064
65To regenerate the documentation, follow the Installing and Regenerate steps below.
66
67#Subtopic Broken_Build ##
68
69#Subtopic Editing_Comments
70
71Edit docs instead of include/core files to update comments if possible.
72
73The Bookmaker bots do not complain if the docs file does not match the
74corresponding include comments. Running Bookmaker include generation will
75report when docs and includes comments do not match.
76
77For instance, if include/core/SkSurface.h comments do not match
78docs/SkSurface_Reference.bmh, running:
79
80#Code
81$ ./out/dir/bookmaker -b docs -i include/core/SkSurface.h -p
82##
83
84generates
85
86#Code
87wrote updated SkSurface.h
88##
89
90The updated SkSurface.h is written to the root to avoid subsequent runs of
91Bookmaker from recompiling. if SkSurface.h was not changed, it is not written,
92and Bookmaker will not generate any output.
93
94#Subtopic Editing_Comments ##
95
Cary Clarkac47b882018-01-11 10:35:44 -050096#Subtopic Broken_Example
97
98An example may cause Bookmaker or a bot running Bookmaker to fail if it can't
99be compiled by fiddle. If the example cannot be fixed, it can be commented out
100by changing
101###$
102$Code
103$Literal
104#Example
105$Code $$
106to
107$Code
108#NoExample
109$Code $$
110$$$#
111. The disabled example can contain additional markup,
112which will be ignored.
113
114#Subtopic Broken_Example ##
Ben Wagner29380bd2017-10-09 14:43:00 -0400115
Cary Clark7cfcbca2018-01-04 16:11:51 -0500116#Subtopic Installing
117
Ben Wagner29380bd2017-10-09 14:43:00 -0400118Install
119#A Go # https://golang.org/doc/install ##
Cary Clark7cfcbca2018-01-04 16:11:51 -0500120 if needed.
Cary Clark80247e52018-07-11 16:18:41 -0400121Check the version. The resuls should be 1.10 or greater.
122
123#Code
124$ go version
125##
126
Ben Wagner29380bd2017-10-09 14:43:00 -0400127Get the fiddle command line interface tool.
128By default this will appear in your home directory.
129
130#Code
Ruiqi Mao94d57c42018-07-02 15:20:10 -0400131$ go get go.skia.org/infra/fiddlek/go/fiddlecli
Ben Wagner29380bd2017-10-09 14:43:00 -0400132##
133
134Build Bookmaker.
135
136#Code
137$ ninja -C out/dir bookmaker
138##
139
Cary Clark7cfcbca2018-01-04 16:11:51 -0500140#Subtopic Installing ##
141
142#Subtopic Regenerate
143
144Complete rebuilding of all bookmaker output looks like:
145
146#Code
Cary Clarkab2621d2018-01-30 10:08:57 -0500147$ ./out/skia/bookmaker -a docs/status.json -e fiddle.json
148$ ~/go/bin/fiddlecli --input fiddle.json --output fiddleout.json
149$ ./out/skia/bookmaker -a docs/status.json -f fiddleout.json -r site/user/api -c
150$ ./out/skia/bookmaker -a docs/status.json -x
151$ ./out/skia/bookmaker -a docs/status.json -p
Cary Clark7cfcbca2018-01-04 16:11:51 -0500152##
153
154#Subtopic Regenerate ##
155
156#Subtopic New_Documentation
157
Ben Wagner29380bd2017-10-09 14:43:00 -0400158Generate an starter Bookmaker file from an existing include.
159
160#Code
161$ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs
162##
163
164If a method or function has an unnamed parameter, bookmaker generates an error:
165
166#Code
167###$
168C:/puregit/include/core/SkPixmap.h(208): error: #Method missing param name
169bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const
170 ^
171$$$#
172##
173
174All parameters require names to allow markdown and doxygen documents to refer to
175them. After naming all parameters, check in the include before continuing.
176
177A successful run generates
178#Code
179docs/SkXXX_Reference.bmh
180##
181.
182
183Next, use your favorite editor to fill out
184#Code
185docs/SkXXX_Reference.bmh
186##
187.
188
Cary Clark7cfcbca2018-01-04 16:11:51 -0500189##
190
Ben Wagner29380bd2017-10-09 14:43:00 -0400191#Subtopic Style
192
193Documentation consists of cross references, descriptions, and examples.
194All structs, classes, enums, their members and methods, functions, and so on,
195require descriptions. Most also require examples.
196
197All methods and functions should include examples if practical.
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500198It's difficult to think of a meaningful example for class destructors.
199In cases like these, change the placeholder:
200
201###$
202$Code
203#Example
204$$
205
206to:
207
208$Code
209#NoExample
210$$
211$$$#
Ben Wagner29380bd2017-10-09 14:43:00 -0400212
213Descriptions start with an active verb. Descriptions are complete, punctuated
214sentences unless they describe parameters or return values. Parameters and
215returned values are described by phrases that start lower case and do not
216include trailing punctuation.
217
218Descriptions are not self-referential; they do not include the thing they
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500219describe. Descriptions may contain upper case or camel case references to
220definitions but otherwise should be free of jargon.
Ben Wagner29380bd2017-10-09 14:43:00 -0400221
222Descriptions may contain code and formulas, each bracketed by markup.
223
224Similar items may be grouped into topics. Topics may include subtopics.
225
226Each document begins with one or more indices that include the contents of
Cary Clark7cfcbca2018-01-04 16:11:51 -0500227that file. A class reference includes an index listing contained topics,
Ben Wagner29380bd2017-10-09 14:43:00 -0400228a separate listing for constructors, one for methods, and so on.
229
230Class methods contain a description, any parameters, any return value,
231an example, and any cross references.
232
233Each method must contain either one or more examples or markup indicating
234that there is no example.
235
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500236After editing is complete, searching for "incomplete" should fail,
237assuming "incomplete" is not the perfect word to use in a description or
238example!
239
Cary Clark7cfcbca2018-01-04 16:11:51 -0500240#Subtopic Style ##
241
242#Subtopic Adding_Documentation
Ben Wagner29380bd2017-10-09 14:43:00 -0400243
244Generate fiddle.json from all examples, including the ones you just wrote.
245Error checking is syntatic: starting keywords are closed, keywords have the
246correct parents.
247If you run Bookmaker inside Visual_Studio, you can click on errors and it
248will take you to the source line in question.
249
250#Code
251$ ./out/dir/bookmaker -e fiddle.json -b docs
252##
253
254Once complete, run fiddlecli to generate the example hashes.
255Errors are contained by the output but aren't reported yet.
256
257#Code
258$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json
259##
260
Cary Clark7cfcbca2018-01-04 16:11:51 -0500261Generate SkXXX.md from SkXXX.bmh and fiddleout.json.
Ben Wagner29380bd2017-10-09 14:43:00 -0400262Error checking includes: undefined references, fiddle compiler errors,
263missing or mismatched printf output.
264Again, you can click on any errors inside Visual_Studio.
265
266#Code
267$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json
268##
269
270The original include may have changed since you started creating the markdown.
271Check to see if it is up to date.
272This reports if a method no longer exists or its parameters have changed.
273
274#Code
275$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h
276##
277
278Generate an updated include header. Run:
279
280#Code
281$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
282##
283
284to write the updated SkXXX.h to the current directory.
285
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500286Once adding the file is complete, add the file to status.json in the
287Completed section. You may add it to the InProgress section during
288development, or leave status.json unchanged.
289
290If the new file has been added to status.json, you can run
291any of the above commands with -a docs/status.json in place of
292-b docs or -i includes.
293
Cary Clark7cfcbca2018-01-04 16:11:51 -0500294#Subtopic Adding_Documentation ##
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500295
Ben Wagner29380bd2017-10-09 14:43:00 -0400296#Subtopic Bugs
297
298Bookmaker bugs are tracked
Cary Clark682c58d2018-05-16 07:07:07 -0400299#A here # https://bug.skia.org/6898 ##
Ben Wagner29380bd2017-10-09 14:43:00 -0400300.
301
302##
303
304#Topic Bookmaker ##