Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/etorreborre/protobuf-sbt
A Protocol Buffers plugin for simple-build-tool
https://github.com/etorreborre/protobuf-sbt
Last synced: 7 days ago
JSON representation
A Protocol Buffers plugin for simple-build-tool
- Host: GitHub
- URL: https://github.com/etorreborre/protobuf-sbt
- Owner: etorreborre
- License: mit
- Created: 2011-08-04T02:05:41.000Z (over 13 years ago)
- Default Branch: development
- Last Pushed: 2011-02-25T23:33:58.000Z (over 13 years ago)
- Last Synced: 2024-05-01T22:38:50.080Z (7 months ago)
- Language: Scala
- Homepage:
- Size: 352 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
protobuf-sbt
============*Gonna generate me some Java. Then I'm gonna ignore it.*
protobuf-sbt is a
[simple-build-tool](http://code.google.com/p/simple-build-tool/) plugin for
generating [Protocol Buffers](http://code.google.com/apis/protocolbuffers/)
classes from schema and protocol definitions.Requirements
------------* Simple Build Tool
* Protocol Buffers installed, with `protoc` available on the shell path.
* A `.proto` or two.How To Use
----------**First**, specify protobuf-sbt as a dependency in
`project/plugins/Plugins.scala`:class Plugins(info: sbt.ProjectInfo) extends sbt.PluginDefinition(info) {
val codaRepo = "Coda Hale's Repository" at "http://repo.codahale.com/"
val protobufSBT = "com.codahale" % "protobuf-sbt" % "0.1.2"
}and add Protocol Buffers itself as a dependency:
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.3.0" withSources()
and update your project class to include this trait:
class MyProject(info: ProjectInfo) extends DefaultProject(info)
with protobuf.ProtobufCompiler**Second**, put your Protocol Buffer schemas (`*.proto`) into
`src/main/protobuf`. If you want to put them somewhere else, be sure to let
protobuf-sbt know:
override def protobufSchemas = "src" / "main" / "my-special-pb" ** "*.botoprufs"
**Third**, and only if you're feeling picky, let it know where you want your
new classes put:
override def protobufOutputPath = "src" / "main" / "generated"(It defaults to `src/main/java`, which will probably work just fine for you.)
**Finally**, compile your project. protobuf-sbt will generate fresh source files
for your schemas before it compiles things. It should *just work*.Oh, and if you want protobuf-sbt to clean the generated Java sources when it
cleans your compiled `.class` files, do this:
override def cleanAction = super.cleanAction dependsOn(cleanProtobuf)But please only do this if `protobufOutputPath` doesn't have anything you would
miss. Because `clean-protobuf` will nuke it.License
-------Copyright (c) 2010-2011 Coda Hale
Published under The MIT License, see LICENSE