blob: 4e952e2b500106c63f099f9d3e41d1003a3ec5e7 [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
Ruiqi Maoc97a3392018-08-15 10:44:19 -0400150$ ./out/skia/bookmaker -a docs/status.json -f fiddleout.json -r site/user/api
Cary Clarkab2621d2018-01-30 10:08:57 -0500151$ ./out/skia/bookmaker -a docs/status.json -x
152$ ./out/skia/bookmaker -a docs/status.json -p
Cary Clark7cfcbca2018-01-04 16:11:51 -0500153##
154
155#Subtopic Regenerate ##
156
157#Subtopic New_Documentation
158
Ben Wagner29380bd2017-10-09 14:43:00 -0400159Generate an starter Bookmaker file from an existing include.
160
161#Code
162$ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs
163##
164
165If a method or function has an unnamed parameter, bookmaker generates an error:
166
167#Code
168###$
169C:/puregit/include/core/SkPixmap.h(208): error: #Method missing param name
170bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const
171 ^
172$$$#
173##
174
175All parameters require names to allow markdown and doxygen documents to refer to
176them. After naming all parameters, check in the include before continuing.
177
178A successful run generates
179#Code
180docs/SkXXX_Reference.bmh
181##
182.
183
184Next, use your favorite editor to fill out
185#Code
186docs/SkXXX_Reference.bmh
187##
188.
189
Cary Clark7cfcbca2018-01-04 16:11:51 -0500190##
191
Ben Wagner29380bd2017-10-09 14:43:00 -0400192#Subtopic Style
193
194Documentation consists of cross references, descriptions, and examples.
195All structs, classes, enums, their members and methods, functions, and so on,
196require descriptions. Most also require examples.
197
198All methods and functions should include examples if practical.
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500199It's difficult to think of a meaningful example for class destructors.
200In cases like these, change the placeholder:
201
202###$
203$Code
204#Example
205$$
206
207to:
208
209$Code
210#NoExample
211$$
212$$$#
Ben Wagner29380bd2017-10-09 14:43:00 -0400213
214Descriptions start with an active verb. Descriptions are complete, punctuated
215sentences unless they describe parameters or return values. Parameters and
216returned values are described by phrases that start lower case and do not
217include trailing punctuation.
218
219Descriptions are not self-referential; they do not include the thing they
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500220describe. Descriptions may contain upper case or camel case references to
221definitions but otherwise should be free of jargon.
Ben Wagner29380bd2017-10-09 14:43:00 -0400222
223Descriptions may contain code and formulas, each bracketed by markup.
224
225Similar items may be grouped into topics. Topics may include subtopics.
226
227Each document begins with one or more indices that include the contents of
Cary Clark7cfcbca2018-01-04 16:11:51 -0500228that file. A class reference includes an index listing contained topics,
Ben Wagner29380bd2017-10-09 14:43:00 -0400229a separate listing for constructors, one for methods, and so on.
230
231Class methods contain a description, any parameters, any return value,
232an example, and any cross references.
233
234Each method must contain either one or more examples or markup indicating
235that there is no example.
236
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500237After editing is complete, searching for "incomplete" should fail,
238assuming "incomplete" is not the perfect word to use in a description or
239example!
240
Cary Clark7cfcbca2018-01-04 16:11:51 -0500241#Subtopic Style ##
242
243#Subtopic Adding_Documentation
Ben Wagner29380bd2017-10-09 14:43:00 -0400244
245Generate fiddle.json from all examples, including the ones you just wrote.
246Error checking is syntatic: starting keywords are closed, keywords have the
247correct parents.
248If you run Bookmaker inside Visual_Studio, you can click on errors and it
249will take you to the source line in question.
250
251#Code
252$ ./out/dir/bookmaker -e fiddle.json -b docs
253##
254
255Once complete, run fiddlecli to generate the example hashes.
256Errors are contained by the output but aren't reported yet.
257
258#Code
259$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json
260##
261
Cary Clark7cfcbca2018-01-04 16:11:51 -0500262Generate SkXXX.md from SkXXX.bmh and fiddleout.json.
Ben Wagner29380bd2017-10-09 14:43:00 -0400263Error checking includes: undefined references, fiddle compiler errors,
264missing or mismatched printf output.
265Again, you can click on any errors inside Visual_Studio.
266
267#Code
268$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json
269##
270
271The original include may have changed since you started creating the markdown.
272Check to see if it is up to date.
273This reports if a method no longer exists or its parameters have changed.
274
275#Code
276$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h
277##
278
279Generate an updated include header. Run:
280
281#Code
282$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
283##
284
285to write the updated SkXXX.h to the current directory.
286
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500287Once adding the file is complete, add the file to status.json in the
288Completed section. You may add it to the InProgress section during
289development, or leave status.json unchanged.
290
291If the new file has been added to status.json, you can run
292any of the above commands with -a docs/status.json in place of
293-b docs or -i includes.
294
Cary Clark7cfcbca2018-01-04 16:11:51 -0500295#Subtopic Adding_Documentation ##
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500296
Ben Wagner29380bd2017-10-09 14:43:00 -0400297#Subtopic Bugs
298
299Bookmaker bugs are tracked
Cary Clark682c58d2018-05-16 07:07:07 -0400300#A here # https://bug.skia.org/6898 ##
Ben Wagner29380bd2017-10-09 14:43:00 -0400301.
302
303##
304
305#Topic Bookmaker ##