blob: 170a5a711d1b23dd9f457db9ee3be925482c7136 [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 Clark7cfcbca2018-01-04 16:11:51 -050014#Subtopic Broken_Build
15
16If the
17#A Housekeeper-PerCommit-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-PerCommit-Bookmaker ##
18 bot is red, the bot has detected that the files in docs and include/core differ.
19
20The bot output describes what changed.
21
22To fix this, edit the docs file corresponding to the changed include file.
23
24For instance, if the change was made to SkIRect, edit docs/SkIRect_Reference.bmh.
25Checking in the edited docs/SkIRect_Reference.bmh will fix the bot.
26
27To regenerate the documentation, follow the Installing and Regenerate steps below.
28
29If the
Cary Clarkf5404bb2018-01-05 12:10:09 -050030#A Housekeeper-Nightly-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-Nightly-Bookmaker ##
31 bot is red, one of several things may have gone wrong:
32
33#List
34# A change to include broke documentation examples. ##
35# Something changed the examples that output text. ##
36# Some interface was added, deleted, edited. ##
37# Documentation is malformed. ##
38##
39
40The bot output describes what changed, and includes the file and line
41where the error occurred.
Cary Clark7cfcbca2018-01-04 16:11:51 -050042
43To regenerate the documentation, follow the Installing and Regenerate steps below.
44
45#Subtopic Broken_Build ##
46
47#Subtopic Editing_Comments
48
49Edit docs instead of include/core files to update comments if possible.
50
51The Bookmaker bots do not complain if the docs file does not match the
52corresponding include comments. Running Bookmaker include generation will
53report when docs and includes comments do not match.
54
55For instance, if include/core/SkSurface.h comments do not match
56docs/SkSurface_Reference.bmh, running:
57
58#Code
59$ ./out/dir/bookmaker -b docs -i include/core/SkSurface.h -p
60##
61
62generates
63
64#Code
65wrote updated SkSurface.h
66##
67
68The updated SkSurface.h is written to the root to avoid subsequent runs of
69Bookmaker from recompiling. if SkSurface.h was not changed, it is not written,
70and Bookmaker will not generate any output.
71
72#Subtopic Editing_Comments ##
73
Ben Wagner29380bd2017-10-09 14:43:00 -040074How to use the Bookmaker utility.
75
Cary Clark7cfcbca2018-01-04 16:11:51 -050076#Subtopic Installing
77
Ben Wagner29380bd2017-10-09 14:43:00 -040078Install
79#A Go # https://golang.org/doc/install ##
Cary Clark7cfcbca2018-01-04 16:11:51 -050080 if needed.
Ben Wagner29380bd2017-10-09 14:43:00 -040081Get the fiddle command line interface tool.
82By default this will appear in your home directory.
83
84#Code
85$ go get go.skia.org/infra/fiddle/go/fiddlecli
86##
87
88Build Bookmaker.
89
90#Code
91$ ninja -C out/dir bookmaker
92##
93
Cary Clark7cfcbca2018-01-04 16:11:51 -050094#Subtopic Installing ##
95
96#Subtopic Regenerate
97
98Complete rebuilding of all bookmaker output looks like:
99
100#Code
101$ ./out/skia/bookmaker.exe -a docs/status.json -e fiddle.json
102$ ~/go/bin/fiddlecli.exe --input fiddle.json --output fiddleout.json
103$ ./out/skia/bookmaker.exe -a docs/status.json -f fiddleout.json -r site/user/api -c
104$ ./out/skia/bookmaker.exe -a docs/status.json -x
105$ ./out/skia/bookmaker.exe -a docs/status.json -p
106##
107
108#Subtopic Regenerate ##
109
110#Subtopic New_Documentation
111
Ben Wagner29380bd2017-10-09 14:43:00 -0400112Generate an starter Bookmaker file from an existing include.
113
114#Code
115$ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs
116##
117
118If a method or function has an unnamed parameter, bookmaker generates an error:
119
120#Code
121###$
122C:/puregit/include/core/SkPixmap.h(208): error: #Method missing param name
123bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const
124 ^
125$$$#
126##
127
128All parameters require names to allow markdown and doxygen documents to refer to
129them. After naming all parameters, check in the include before continuing.
130
131A successful run generates
132#Code
133docs/SkXXX_Reference.bmh
134##
135.
136
137Next, use your favorite editor to fill out
138#Code
139docs/SkXXX_Reference.bmh
140##
141.
142
Cary Clark7cfcbca2018-01-04 16:11:51 -0500143##
144
Ben Wagner29380bd2017-10-09 14:43:00 -0400145#Subtopic Style
146
147Documentation consists of cross references, descriptions, and examples.
148All structs, classes, enums, their members and methods, functions, and so on,
149require descriptions. Most also require examples.
150
151All methods and functions should include examples if practical.
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500152It's difficult to think of a meaningful example for class destructors.
153In cases like these, change the placeholder:
154
155###$
156$Code
157#Example
158$$
159
160to:
161
162$Code
163#NoExample
164$$
165$$$#
Ben Wagner29380bd2017-10-09 14:43:00 -0400166
167Descriptions start with an active verb. Descriptions are complete, punctuated
168sentences unless they describe parameters or return values. Parameters and
169returned values are described by phrases that start lower case and do not
170include trailing punctuation.
171
172Descriptions are not self-referential; they do not include the thing they
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500173describe. Descriptions may contain upper case or camel case references to
174definitions but otherwise should be free of jargon.
Ben Wagner29380bd2017-10-09 14:43:00 -0400175
176Descriptions may contain code and formulas, each bracketed by markup.
177
178Similar items may be grouped into topics. Topics may include subtopics.
179
180Each document begins with one or more indices that include the contents of
Cary Clark7cfcbca2018-01-04 16:11:51 -0500181that file. A class reference includes an index listing contained topics,
Ben Wagner29380bd2017-10-09 14:43:00 -0400182a separate listing for constructors, one for methods, and so on.
183
184Class methods contain a description, any parameters, any return value,
185an example, and any cross references.
186
187Each method must contain either one or more examples or markup indicating
188that there is no example.
189
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500190After editing is complete, searching for "incomplete" should fail,
191assuming "incomplete" is not the perfect word to use in a description or
192example!
193
Cary Clark7cfcbca2018-01-04 16:11:51 -0500194#Subtopic Style ##
195
196#Subtopic Adding_Documentation
Ben Wagner29380bd2017-10-09 14:43:00 -0400197
198Generate fiddle.json from all examples, including the ones you just wrote.
199Error checking is syntatic: starting keywords are closed, keywords have the
200correct parents.
201If you run Bookmaker inside Visual_Studio, you can click on errors and it
202will take you to the source line in question.
203
204#Code
205$ ./out/dir/bookmaker -e fiddle.json -b docs
206##
207
208Once complete, run fiddlecli to generate the example hashes.
209Errors are contained by the output but aren't reported yet.
210
211#Code
212$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json
213##
214
Cary Clark7cfcbca2018-01-04 16:11:51 -0500215Generate SkXXX.md from SkXXX.bmh and fiddleout.json.
Ben Wagner29380bd2017-10-09 14:43:00 -0400216Error checking includes: undefined references, fiddle compiler errors,
217missing or mismatched printf output.
218Again, you can click on any errors inside Visual_Studio.
219
220#Code
221$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json
222##
223
224The original include may have changed since you started creating the markdown.
225Check to see if it is up to date.
226This reports if a method no longer exists or its parameters have changed.
227
228#Code
229$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h
230##
231
232Generate an updated include header. Run:
233
234#Code
235$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
236##
237
238to write the updated SkXXX.h to the current directory.
239
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500240Once adding the file is complete, add the file to status.json in the
241Completed section. You may add it to the InProgress section during
242development, or leave status.json unchanged.
243
244If the new file has been added to status.json, you can run
245any of the above commands with -a docs/status.json in place of
246-b docs or -i includes.
247
Cary Clark7cfcbca2018-01-04 16:11:51 -0500248#Subtopic Adding_Documentation ##
Cary Clarkca3ebcd2017-12-12 11:22:38 -0500249
Ben Wagner29380bd2017-10-09 14:43:00 -0400250#Subtopic Bugs
251
252Bookmaker bugs are tracked
253#A here # bug.skia.org/6898 ##
254.
255
256##
257
258#Topic Bookmaker ##