This repository has been archived by the owner on Jun 19, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
64 lines (50 loc) · 1.69 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import ReleaseTransformations._
sbtPlugin := true
scalaVersion := "2.10.4"
organization := "com.trueaccord.scalapb"
name := "sbt-scalapb"
addSbtPlugin("com.github.gseitz" % "sbt-protobuf" % "0.5.3")
releasePublishArtifactsAction := PgpKeys.publishSigned.value
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
ReleaseStep(action = Command.process("publishSigned", _), enableCrossBuild = true),
setNextVersion,
commitNextVersion,
ReleaseStep(action = Command.process("sonatypeReleaseAll", _), enableCrossBuild = true),
pushChanges
)
// This is the version of the scalaPb compiler and runtime going to be used.
// The version for the *plugin* is in version.sbt.
val scalaPbVersion = "0.5.43"
libraryDependencies ++= Seq(
"com.trueaccord.scalapb" %% "compilerplugin" % scalaPbVersion
)
def genVersionFile(out: File, pluginVersion: String): Seq[File] = {
out.mkdirs()
val f = out / "Version.scala"
val w = new java.io.FileOutputStream(f)
w.write(s"""|// Generated by ScalaPB's build.sbt.
|
|package com.trueaccord.scalapb.plugin
|
|object Version {
| val pluginVersion = "$pluginVersion"
| val scalaPbVersion = "$scalaPbVersion"
|}
|""".stripMargin.getBytes("UTF-8"))
w.close()
Seq(f)
}
sourceGenerators in Compile <+= (sourceManaged in Compile, version in Compile) map {
(sourceManaged, version) =>
genVersionFile(sourceManaged, version)
}
ScriptedPlugin.scriptedSettings
scriptedBufferLog := false
scriptedLaunchOpts += s"-Dplugin.version=${version.value}"