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