Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Working on pub | |
|
Bob Nystrom
2013/11/15 00:14:03
"Contributing to pub"? "Working" sounds like... wo
nweiz
2013/11/15 01:30:44
Done.
| |
| 2 | |
| 3 We love contributions to pub from outside the core team, but the codebase is | |
| 4 large and can be hard to understand. This document is intended to get | |
|
Bob Nystrom
2013/11/15 00:14:03
The "but" is a bit negative here. How about:
Than
nweiz
2013/11/15 01:30:44
Done.
| |
| 5 contributors up and running as quickly as possible. If you're looking for | |
| 6 documentation on using pub, try [pub.dartlang.org](http://pub.dartlang.org/doc). | |
| 7 | |
| 8 ## Organization | |
| 9 | |
| 10 Pub isn't a package, but it's organized like one. It has four top-level | |
| 11 directories: | |
| 12 | |
| 13 * `lib/` contains the implementation of pub. Currently, it's all in `lib/src/`, | |
| 14 since there are no libraries intended for public consumption. | |
| 15 | |
| 16 * `test/` contains the tests for pub. | |
| 17 | |
| 18 * `bin/` contains `pub.dart`, the entrypoint script that's run whenever a user | |
| 19 types "pub" on the command line or runs it in the Dart editor. | |
|
Bob Nystrom
2013/11/15 00:14:03
May also want to mention the actual shell scripts
nweiz
2013/11/15 01:30:44
Done.
| |
| 20 | |
| 21 * `resource/` contains static resource files that pub uses. They're | |
| 22 automatically distributed in the Dart SDK. | |
| 23 | |
| 24 It's probably easiest to start diving into the codebase by looking at a | |
| 25 particular pub command. All the commands are encapsulated in files in | |
|
Bob Nystrom
2013/11/15 00:14:03
I think this reads better singular: "Each command
nweiz
2013/11/15 01:30:44
Done.
| |
| 26 `lib/src/command/`. | |
| 27 | |
| 28 ## Running pub | |
| 29 | |
| 30 To run pub from the Dart repository, first build Dart. From the root of the | |
|
Bob Nystrom
2013/11/15 00:14:03
Link to the page for building the SDK for more det
nweiz
2013/11/15 01:30:44
Done.
| |
| 31 repo: | |
| 32 | |
| 33 ./tools/build.py -m release | |
| 34 | |
| 35 You'll need to re-build whenever you sync the repository, but not when you | |
| 36 modify pub or any packages it depends on. To run pub, just run `sdk/bin/pub` (or | |
| 37 `sdk/bin/pub.bat` on Windows). | |
| 38 | |
| 39 ## Testing pub | |
| 40 | |
| 41 Before any change is made to pub, all tests should pass. To run all the pub | |
| 42 tests, run this from the root of the Dart repository: | |
| 43 | |
| 44 ./tools/test.py -m release pub | |
| 45 | |
| 46 Most changes to pub should be accompanied by one or more tests that exercises | |
|
Bob Nystrom
2013/11/15 00:14:03
"Most changes" -> "Changes". Exceptions are rare.
nweiz
2013/11/15 01:30:44
Done.
| |
| 47 the new functionality. When adding a test, the best strategy is to find a | |
| 48 similar test in `test/` and follow the same patterns. Note that pub makes wide | |
| 49 use of the [scheduled_test] package in its tests, so it's usually important to b e | |
|
Bob Nystrom
2013/11/15 00:14:03
Long line.
nweiz
2013/11/15 01:30:44
Done.
| |
| 50 familiar with that when adding tests. | |
| 51 | |
| 52 [scheduled_test]: http://pub.dartlang.org/packages/scheduled_test | |
| 53 | |
| 54 Pub tests come in two basic forms. The first, which is usually used to unit test | |
| 55 classes and libraries internal to pub, has many tests in a single file. This is | |
| 56 used when each test will take a short time to run. | |
|
Bob Nystrom
2013/11/15 00:14:03
Give an example here like version_test.
nweiz
2013/11/15 01:30:44
Done.
| |
| 57 | |
| 58 The other form is usually used for integration tests of user-visible pub | |
| 59 commands. Each test has a file to itself, which is named after the test | |
|
Bob Nystrom
2013/11/15 00:14:03
Mention most tests are of this form.
nweiz
2013/11/15 01:30:44
Done.
| |
| 60 description. This is used when tests can take a long time to run to avoid having | |
| 61 the tests time out when running on the build bots. | |
|
Bob Nystrom
2013/11/15 00:14:03
Give an example.
nweiz
2013/11/15 01:30:44
Done.
| |
| 62 | |
| 63 When testing new functionality, it's often useful to run a single test rather | |
| 64 than the entire test suite. You can do this by appending the path to the test | |
| 65 file to the test command. For example, to run `get/relative_symlink_test.dart`: | |
| 66 | |
| 67 ./tools/test.py -m release pub/get/relative_symlink_test | |
|
Bob Nystrom
2013/11/15 00:14:03
How about a short section at the end for getting y
nweiz
2013/11/15 01:30:44
Done.
| |
| OLD | NEW |