Skip to content

Commit

Permalink
add gradle invocation instructions (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewparmet authored Jul 11, 2021
1 parent cca2b8c commit 6d6e84b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,33 @@ But the net effect is that ts-proto can provide SQL-/ORM-style N+1 prevention fo
protoc --plugin=node_modules/ts-proto/protoc-gen-ts_proto ./batching.proto -I.
```

`ts-proto` can also be invoked with [Gradle](https://gradle.org) using the [protobuf-gradle-plugin](https://github.com/google/protobuf-gradle-plugin):

``` groovy
protobuf {
plugins {
// `ts` can be replaced by any unused plugin name, e.g. `tsproto`
ts {
path = 'path/to/plugin'
}
}
// This section only needed if you provide plugin options
generateProtoTasks {
all().each { task ->
task.plugins {
// Must match plugin ID declared above
ts {
option 'foo=bar'
}
}
}
}
}
```

Generated code will be placed in the Gradle build directory.

### Supported options

- With `--ts_proto_opt=context=true`, the services will have a Go-style `ctx` parameter, which is useful for tracing/logging/etc. if you're not using node's `async_hooks` api due to performance reasons.
Expand Down

0 comments on commit 6d6e84b

Please sign in to comment.