/
SBTPlugin.txt
179 lines (123 loc) · 4.02 KB
/
SBTPlugin.txt
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
SBT Plugin
==========
Add a line like this to your `project/plugins.sbt` file:
::
addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "3.18.1")
In your `build.sbt` file:
::
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.8.0",
"com.twitter" %% "scrooge-core" % "3.18.1",
"com.twitter" %% "finagle-thrift" % "6.24.0"
)
or, in your `project/Build.scala` file:
::
lazy val myProject = Project(
id = "my-project",
base = file("my-project"),
settings = Project.defaultSettings
).settings(
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.8.0",
"com.twitter" %% "scrooge-core" % "3.18.1",
"com.twitter" %% "finagle-thrift" % "6.24.0"
)
)
**Configuration Options**
A full list of settings is in the (only) source file. Here are the ones you're
most likely to want to edit:
- **scroogeBuildOptions: Seq[String]**
list of command-line arguments to pass to scrooge
(default: `Seq("--finagle", "--verbose")`)
- **scroogeThriftDependencies: Seq[String]**
artifacts to extract and compile thrift files from
- **scroogeThriftIncludeFolders: Seq[File]**
list of folders to search when processing "include" directives
(default: none)
- **scroogeThriftSourceFolder: File**
where to find thrift files to compile
(default: `src/main/thrift/`)
- **scroogeThriftOutputFolder: File**
where to put the generated scala files
(default: `target/<scala-ver>/src_managed`)
Migrating from 3.x.x to 3.18.0
------------------------------
SBT 0.13.5 and above
~~~~~~~~~~~~~~~~~~~~
The Scrooge SBT plugin now uses SBT's `auto plugin system
<http://www.scala-sbt.org/0.13/docs/Plugins.html>`_, which is only available
for SBT 0.13.5 and later.
Projects using `build.sbt`
~~~~~~~~~~~~~~~~~~~~~~~~~~~
For 3.17.0 and earlier releases of the plugin, it was necessary to add the
settings to your build configuration explicitly:
::
import com.twitter.scrooge.ScroogeSBT
lazy val app = project.in(file("app"))
.settings(ScroogeSBT.newSettings: _*)
.settings(
// more settings here
)
This is no longer necessary, so the build above should look like this:
::
lazy val app = project.in(file("app"))
.settings(
// more settings here
)
The default settings are included automatically, by virtue of the auto plugin
mechanism.
The plugin's setting and task keys are also now brought into scope
automatically, so the following:
::
import com.twitter.scrooge.ScroogeSBT
lazy val app = project.in(file("app"))
.settings(ScroogeSBT.newSettings: _*)
.settings(
ScroogeSBT.scroogeThriftSourceFolder in Compile <<= baseDirectory {
base => base / "src/main/resources"
}
)
becomes simply:
::
lazy val app = project.in(file("app"))
.settings(
scroogeThriftSourceFolder in Compile <<= baseDirectory {
base => base / "src/main/resources"
}
)
Using `Build.scala`
~~~~~~~~~~~~~~~~~~~
The big change here, in addition to the automatically injected settings, is
that the location of the keys has changed. They are now under an object called
`autoImport`. So this:
::
import sbt._
import Keys._
import com.twitter.scrooge.ScroogeSBT._
object build extends Build {
lazy val app = Project(
id = "app",
settings = Project.defaultSettings ++ newSettings
).settings(
scroogeThriftSourceFolder in Compile <<= baseDirectory {
base => base / "src/main/resources"
}
)
}
becomes:
::
import sbt._
import Keys._
import com.twitter.scrooge.ScroogeSBT.autoImport._
object build extends Build {
lazy val app = Project(
id = "app",
base = file("app"),
settings = Project.defaultSettings
).settings(
scroogeThriftSourceFolder in Compile <<= baseDirectory {
base => base / "src/main/resources"
}
)
}
That is to say: adjust the imports, and drop the settings injection.