Skip to content

Commit 95fec2f

Browse files
authored
Revert "Explain how to use "pub run protoc_plugin" (#316)" (flutter#344)
This reverts commit 999d459. The updated explanation did not work as I thought.
1 parent 29b8a3c commit 95fec2f

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

protoc_plugin/README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,32 @@ includes generated files should add "protobuf" to its pubspec.yaml file.
2222
How to build and use
2323
--------------------
2424

25-
Add `protoc_plugin: any` to your dependencies (this way the pub version
26-
resolution will match up with your version of `protobuf`).
25+
*Note:* currently the workflow is POSIX-oriented.
2726

28-
Run `pub get`.
27+
To build standalone `protoc` plugin:
28+
- run `pub install` to install all dependencies
29+
- Now you can use the plugin either by adding the `bin` directory to your `PATH`,
30+
or passing it directly with `protoc`'s `--plugin` option.
2931

30-
Now you can compile your proto files like this:
32+
Please, remember that the plugin is pure Dart script and requires the presence
33+
of `dart` executable in your `PATH`.
34+
35+
When both the `dart` executable and `bin/protoc-gen-dart` are in the
36+
`PATH` the protocol buffer compiler can be invoked to generate like this:
37+
38+
$ protoc --dart_out=. test.proto
39+
40+
### Optionally using `pub global`
41+
42+
$ pub global activate protoc_plugin
43+
44+
And then add `.pub-cache/bin` in your home dir to your `PATH` if you haven't already.
45+
46+
This will activate the latest published version of the plugin. If you wish to use a
47+
local working copy, use
48+
49+
$ pub global activate -s path <path/to/your/dart-protoc-plugin>
3150

32-
$ protoc --dart_out=lib/ protos/test.proto --plugin "pub run protoc_plugin"
3351

3452
### Options to control the generated Dart code
3553

0 commit comments

Comments
 (0)