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