| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 1 | #External | 
|  | 2 | SkXXX | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 3 | SkIRect_Reference | 
|  | 4 | SkSurface_Reference | 
|  | 5 | SkSurface.h | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 6 | CL | 
|  | 7 | Go | 
|  | 8 | Visual_Studio | 
| Cary Clark | c7924c9 | 2017-12-14 08:28:46 -0500 | [diff] [blame] | 9 | Completed InProgress | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 10 | ## | 
|  | 11 |  | 
|  | 12 | #Topic Bookmaker | 
|  | 13 |  | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 14 | Bookmaker generates markdown files to view documentation on skia.org, and generates includes for use in C++. | 
|  | 15 | Bookmaker reads canonical documentation from files suffixed with bmh in the docs directory. These bmh | 
|  | 16 | files describe how public interfaces work, and generate Skia fiddle examples to illustrate them. | 
|  | 17 |  | 
|  | 18 | The docs files must be manually edited to stay current with Skia as it evolves. | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 19 |  | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 20 | #Subtopic Broken_Build | 
|  | 21 |  | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 22 | The bots | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 23 | #A Housekeeper-PerCommit-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-PerCommit-Bookmaker ## | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 24 | and | 
|  | 25 | #A Housekeeper-Nightly-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-Nightly-Bookmaker ## | 
|  | 26 | verify that Bookmaker data in docs builds without error and is consistent with include files it documents. | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 27 |  | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 28 | Possible failures include: | 
|  | 29 | #List | 
|  | 30 | # Public interface in include directory does not match documented interface in docs directory. ## | 
|  | 31 | # Example in bookmaker bmh file does not compile, or does not produce expected output. ## | 
|  | 32 | # Undocumented but referenced interface is missing from undocumented bookmaker file in docs directory. ## | 
|  | 33 | ## | 
|  | 34 |  | 
|  | 35 | Editing comments in includes or editing private interfaces will not break the bots. | 
|  | 36 | Bookmaker detects that comments edited in includes do not match comments in docs; it will generate an updated include in the | 
|  | 37 | directory where it is run. | 
|  | 38 |  | 
|  | 39 | If | 
|  | 40 | #A Housekeeper-PerCommit-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-PerCommit-Bookmaker ## | 
|  | 41 | bot is red, the error is usually related to an edit to an include which has not been reflected in docs. | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 42 |  | 
|  | 43 | To fix this, edit the docs file corresponding to the changed include file. | 
|  | 44 |  | 
|  | 45 | For instance, if the change was made to SkIRect, edit docs/SkIRect_Reference.bmh. | 
|  | 46 | Checking in the edited docs/SkIRect_Reference.bmh will fix the bot. | 
|  | 47 |  | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 48 | If the interface is deprecated, but still present in the interface, mark-up the | 
|  | 49 | documentation to be deprecated as well. | 
|  | 50 |  | 
|  | 51 | #Code | 
|  | 52 | ###$ | 
|  | 53 | #Method void someMethodThatIsNowDeprecated() | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 54 | #Deprecated | 
|  | 55 | ## | 
| Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 56 | $$ | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 57 |  | 
| Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 58 | Use | 
|  | 59 |  | 
|  | 60 | $Code | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 61 | #Deprecated soon | 
| Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 62 | $$ | 
|  | 63 |  | 
|  | 64 | if the change is soon to be deprecated. | 
|  | 65 |  | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 66 | $$$# | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 67 |  | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 68 | If | 
| Cary Clark | f5404bb | 2018-01-05 12:10:09 -0500 | [diff] [blame] | 69 | #A Housekeeper-Nightly-Bookmaker # https://status.skia.org/repo/skia?filter=search&search_value=Housekeeper-Nightly-Bookmaker ## | 
|  | 70 | bot is red, one of several things may have gone wrong: | 
|  | 71 |  | 
|  | 72 | #List | 
|  | 73 | # A change to include broke documentation examples. ## | 
|  | 74 | # Something changed the examples that output text. ## | 
|  | 75 | # Some interface was added, deleted, edited. ## | 
|  | 76 | # Documentation is malformed. ## | 
|  | 77 | ## | 
|  | 78 |  | 
|  | 79 | The bot output describes what changed, and includes the file and line | 
|  | 80 | where the error occurred. | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 81 |  | 
|  | 82 | To regenerate the documentation, follow the Installing and Regenerate steps below. | 
|  | 83 |  | 
|  | 84 | #Subtopic Broken_Build ## | 
|  | 85 |  | 
|  | 86 | #Subtopic Editing_Comments | 
|  | 87 |  | 
|  | 88 | Edit docs instead of include/core files to update comments if possible. | 
|  | 89 |  | 
|  | 90 | The Bookmaker bots do not complain if the docs file does not match the | 
|  | 91 | corresponding include comments. Running Bookmaker include generation will | 
|  | 92 | report when docs and includes comments do not match. | 
|  | 93 |  | 
|  | 94 | For instance, if include/core/SkSurface.h comments do not match | 
|  | 95 | docs/SkSurface_Reference.bmh, running: | 
|  | 96 |  | 
|  | 97 | #Code | 
|  | 98 | $ ./out/dir/bookmaker -b docs -i include/core/SkSurface.h -p | 
|  | 99 | ## | 
|  | 100 |  | 
|  | 101 | generates | 
|  | 102 |  | 
|  | 103 | #Code | 
|  | 104 | wrote updated SkSurface.h | 
|  | 105 | ## | 
|  | 106 |  | 
|  | 107 | The updated SkSurface.h is written to the root to avoid subsequent runs of | 
|  | 108 | Bookmaker from recompiling. if SkSurface.h was not changed, it is not written, | 
|  | 109 | and Bookmaker will not generate any output. | 
|  | 110 |  | 
|  | 111 | #Subtopic Editing_Comments ## | 
|  | 112 |  | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 113 | #Subtopic Broken_Example | 
|  | 114 |  | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 115 | An example may cause Bookmaker or a bot running Bookmaker to fail if it fails to compile. | 
|  | 116 |  | 
|  | 117 | Fix the example by pasting it into #A Skia Fiddle # https://fiddle.skia.org ## | 
|  | 118 | and editing it until it runs successfully. | 
|  | 119 |  | 
|  | 120 | If the example cannot be fixed, it can be commented out by changing | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 121 | ###$ | 
|  | 122 | $Code | 
|  | 123 | $Literal | 
|  | 124 | #Example | 
|  | 125 | $Code $$ | 
|  | 126 | to | 
|  | 127 | $Code | 
|  | 128 | #NoExample | 
|  | 129 | $Code $$ | 
|  | 130 | $$$# | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 131 | . The disabled example can contain additional markup, which will be ignored. | 
| Cary Clark | ac47b88 | 2018-01-11 10:35:44 -0500 | [diff] [blame] | 132 |  | 
|  | 133 | #Subtopic Broken_Example ## | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 134 |  | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 135 | #Subtopic Installing | 
|  | 136 |  | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 137 | Install | 
|  | 138 | #A Go # https://golang.org/doc/install ## | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 139 | if needed. | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 140 | Check the version. The results should be 1.10 or greater. | 
| Cary Clark | 80247e5 | 2018-07-11 16:18:41 -0400 | [diff] [blame] | 141 |  | 
|  | 142 | #Code | 
|  | 143 | $ go version | 
|  | 144 | ## | 
|  | 145 |  | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 146 | Get the fiddle command line interface tool. | 
|  | 147 | By default this will appear in your home directory. | 
|  | 148 |  | 
|  | 149 | #Code | 
| Ruiqi Mao | 94d57c4 | 2018-07-02 15:20:10 -0400 | [diff] [blame] | 150 | $ go get go.skia.org/infra/fiddlek/go/fiddlecli | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 151 | ## | 
|  | 152 |  | 
|  | 153 | Build Bookmaker. | 
|  | 154 |  | 
|  | 155 | #Code | 
|  | 156 | $ ninja -C out/dir bookmaker | 
|  | 157 | ## | 
|  | 158 |  | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 159 | #Subtopic Installing ## | 
|  | 160 |  | 
|  | 161 | #Subtopic Regenerate | 
|  | 162 |  | 
|  | 163 | Complete rebuilding of all bookmaker output looks like: | 
|  | 164 |  | 
|  | 165 | #Code | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 166 | $ ./out/dir/bookmaker -a docs/status.json -e fiddle.json | 
| Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 167 | $ ~/go/bin/fiddlecli --input fiddle.json --output fiddleout.json | 
| Cary Clark | e8161dd | 2018-09-06 12:47:04 -0400 | [diff] [blame] | 168 | $ ./out/dir/bookmaker -a docs/status.json -f fiddleout.json -r site/user/api -c | 
|  | 169 | $ ./out/dir/bookmaker -a docs/status.json -f fiddleout.json -r site/user/api | 
|  | 170 | $ ./out/dir/bookmaker -a docs/status.json -x | 
|  | 171 | $ ./out/dir/bookmaker -a docs/status.json -p | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 172 | ## | 
|  | 173 |  | 
|  | 174 | #Subtopic Regenerate ## | 
|  | 175 |  | 
|  | 176 | #Subtopic New_Documentation | 
|  | 177 |  | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 178 | Generate an starter Bookmaker file from an existing include. | 
|  | 179 |  | 
|  | 180 | #Code | 
|  | 181 | $ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs | 
|  | 182 | ## | 
|  | 183 |  | 
|  | 184 | If a method or function has an unnamed parameter, bookmaker generates an error: | 
|  | 185 |  | 
|  | 186 | #Code | 
|  | 187 | ###$ | 
|  | 188 | C:/puregit/include/core/SkPixmap.h(208): error: #Method missing param name | 
|  | 189 | bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const | 
|  | 190 | ^ | 
|  | 191 | $$$# | 
|  | 192 | ## | 
|  | 193 |  | 
|  | 194 | All parameters require names to allow markdown and doxygen documents to refer to | 
|  | 195 | them. After naming all parameters, check in the include before continuing. | 
|  | 196 |  | 
|  | 197 | A successful run generates | 
|  | 198 | #Code | 
|  | 199 | docs/SkXXX_Reference.bmh | 
|  | 200 | ## | 
|  | 201 | . | 
|  | 202 |  | 
|  | 203 | Next, use your favorite editor to fill out | 
|  | 204 | #Code | 
|  | 205 | docs/SkXXX_Reference.bmh | 
|  | 206 | ## | 
|  | 207 | . | 
|  | 208 |  | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 209 | ## | 
|  | 210 |  | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 211 | #Subtopic Style | 
|  | 212 |  | 
|  | 213 | Documentation consists of cross references, descriptions, and examples. | 
|  | 214 | All structs, classes, enums, their members and methods, functions, and so on, | 
|  | 215 | require descriptions. Most also require examples. | 
|  | 216 |  | 
|  | 217 | All methods and functions should include examples if practical. | 
| Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame] | 218 | It's difficult to think of a meaningful example for class destructors. | 
|  | 219 | In cases like these, change the placeholder: | 
|  | 220 |  | 
|  | 221 | ###$ | 
|  | 222 | $Code | 
|  | 223 | #Example | 
|  | 224 | $$ | 
|  | 225 |  | 
|  | 226 | to: | 
|  | 227 |  | 
|  | 228 | $Code | 
|  | 229 | #NoExample | 
|  | 230 | $$ | 
|  | 231 | $$$# | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 232 |  | 
|  | 233 | Descriptions start with an active verb. Descriptions are complete, punctuated | 
|  | 234 | sentences unless they describe parameters or return values. Parameters and | 
|  | 235 | returned values are described by phrases that start lower case and do not | 
|  | 236 | include trailing punctuation. | 
|  | 237 |  | 
|  | 238 | Descriptions are not self-referential; they do not include the thing they | 
| Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame] | 239 | describe. Descriptions may contain upper case or camel case references to | 
|  | 240 | definitions but otherwise should be free of jargon. | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 241 |  | 
|  | 242 | Descriptions may contain code and formulas, each bracketed by markup. | 
|  | 243 |  | 
|  | 244 | Similar items may be grouped into topics. Topics may include subtopics. | 
|  | 245 |  | 
|  | 246 | Each document begins with one or more indices that include the contents of | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 247 | that file. A class reference includes an index listing contained topics, | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 248 | a separate listing for constructors, one for methods, and so on. | 
|  | 249 |  | 
|  | 250 | Class methods contain a description, any parameters, any return value, | 
|  | 251 | an example, and any cross references. | 
|  | 252 |  | 
|  | 253 | Each method must contain either one or more examples or markup indicating | 
|  | 254 | that there is no example. | 
|  | 255 |  | 
| Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame] | 256 | After editing is complete, searching for "incomplete" should fail, | 
|  | 257 | assuming "incomplete" is not the perfect word to use in a description or | 
|  | 258 | example! | 
|  | 259 |  | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 260 | #Subtopic Style ## | 
|  | 261 |  | 
|  | 262 | #Subtopic Adding_Documentation | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 263 |  | 
|  | 264 | Generate fiddle.json from all examples, including the ones you just wrote. | 
|  | 265 | Error checking is syntatic: starting keywords are closed, keywords have the | 
|  | 266 | correct parents. | 
|  | 267 | If you run Bookmaker inside Visual_Studio, you can click on errors and it | 
|  | 268 | will take you to the source line in question. | 
|  | 269 |  | 
|  | 270 | #Code | 
|  | 271 | $ ./out/dir/bookmaker -e fiddle.json -b docs | 
|  | 272 | ## | 
|  | 273 |  | 
|  | 274 | Once complete, run fiddlecli to generate the example hashes. | 
|  | 275 | Errors are contained by the output but aren't reported yet. | 
|  | 276 |  | 
|  | 277 | #Code | 
|  | 278 | $ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json | 
|  | 279 | ## | 
|  | 280 |  | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 281 | Generate SkXXX.md from SkXXX.bmh and fiddleout.json. | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 282 | Error checking includes: undefined references, fiddle compiler errors, | 
|  | 283 | missing or mismatched printf output. | 
|  | 284 | Again, you can click on any errors inside Visual_Studio. | 
|  | 285 |  | 
|  | 286 | #Code | 
|  | 287 | $ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json | 
|  | 288 | ## | 
|  | 289 |  | 
|  | 290 | The original include may have changed since you started creating the markdown. | 
|  | 291 | Check to see if it is up to date. | 
|  | 292 | This reports if a method no longer exists or its parameters have changed. | 
|  | 293 |  | 
|  | 294 | #Code | 
|  | 295 | $ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h | 
|  | 296 | ## | 
|  | 297 |  | 
|  | 298 | Generate an updated include header. Run: | 
|  | 299 |  | 
|  | 300 | #Code | 
|  | 301 | $ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h | 
|  | 302 | ## | 
|  | 303 |  | 
|  | 304 | to write the updated SkXXX.h to the current directory. | 
|  | 305 |  | 
| Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame] | 306 | Once adding the file is complete, add the file to status.json in the | 
|  | 307 | Completed section. You may add it to the InProgress section during | 
|  | 308 | development, or leave status.json unchanged. | 
|  | 309 |  | 
|  | 310 | If the new file has been added to status.json, you can run | 
|  | 311 | any of the above commands with -a docs/status.json in place of | 
|  | 312 | -b docs or -i includes. | 
|  | 313 |  | 
| Cary Clark | 7cfcbca | 2018-01-04 16:11:51 -0500 | [diff] [blame] | 314 | #Subtopic Adding_Documentation ## | 
| Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame] | 315 |  | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 316 | #Subtopic Bugs | 
|  | 317 |  | 
|  | 318 | Bookmaker bugs are tracked | 
| Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 319 | #A here # https://bug.skia.org/6898 ## | 
| Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 320 | . | 
|  | 321 |  | 
|  | 322 | ## | 
|  | 323 |  | 
|  | 324 | #Topic Bookmaker ## |