/
SBTPlugin.html
270 lines (246 loc) · 9.97 KB
/
SBTPlugin.html
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SBT Plugin — Scrooge 3.18.1 documentation</title>
<link rel="stylesheet" href="_static/scrooge.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.18.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Scrooge 3.18.1 documentation" href="index.html" />
<link rel="next" title="Maven Plugin" href="MVNPlugin.html" />
<link rel="prev" title="Namespaces" href="Namespaces.html" />
<link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="MVNPlugin.html" title="Maven Plugin"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="Namespaces.html" title="Namespaces"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Scrooge</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="sbt-plugin">
<h1>SBT Plugin<a class="headerlink" href="#sbt-plugin" title="Permalink to this headline">¶</a></h1>
<p>Add a line like this to your <cite>project/plugins.sbt</cite> file:</p>
<div class="highlight-text"><div class="highlight"><pre>addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "3.18.1")
</pre></div>
</div>
<p>In your <cite>build.sbt</cite> file:</p>
<div class="highlight-text"><div class="highlight"><pre>libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.8.0",
"com.twitter" %% "scrooge-core" % "3.18.1",
"com.twitter" %% "finagle-thrift" % "6.24.0"
)
</pre></div>
</div>
<p>or, in your <cite>project/Build.scala</cite> file:</p>
<div class="highlight-text"><div class="highlight"><pre>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"
)
)
</pre></div>
</div>
<p><strong>Configuration Options</strong></p>
<p>A full list of settings is in the (only) source file. Here are the ones you’re
most likely to want to edit:</p>
<ul>
<li><p class="first"><strong>scroogeBuildOptions: Seq[String]</strong></p>
<p>list of command-line arguments to pass to scrooge
(default: <cite>Seq(“–finagle”, “–verbose”)</cite>)</p>
</li>
<li><p class="first"><strong>scroogeThriftDependencies: Seq[String]</strong></p>
<p>artifacts to extract and compile thrift files from</p>
</li>
<li><p class="first"><strong>scroogeThriftIncludeFolders: Seq[File]</strong></p>
<p>list of folders to search when processing “include” directives
(default: none)</p>
</li>
<li><p class="first"><strong>scroogeThriftSourceFolder: File</strong></p>
<p>where to find thrift files to compile
(default: <cite>src/main/thrift/</cite>)</p>
</li>
<li><p class="first"><strong>scroogeThriftOutputFolder: File</strong></p>
<p>where to put the generated scala files
(default: <cite>target/<scala-ver>/src_managed</cite>)</p>
</li>
</ul>
<div class="section" id="migrating-from-3-x-x-to-3-18-0">
<h2>Migrating from 3.x.x to 3.18.0<a class="headerlink" href="#migrating-from-3-x-x-to-3-18-0" title="Permalink to this headline">¶</a></h2>
<div class="section" id="sbt-0-13-5-and-above">
<h3>SBT 0.13.5 and above<a class="headerlink" href="#sbt-0-13-5-and-above" title="Permalink to this headline">¶</a></h3>
<p>The Scrooge SBT plugin now uses SBT’s <a class="reference external" href="http://www.scala-sbt.org/0.13/docs/Plugins.html">auto plugin system</a>, which is only available
for SBT 0.13.5 and later.</p>
</div>
<div class="section" id="projects-using-build-sbt">
<h3>Projects using <cite>build.sbt</cite><a class="headerlink" href="#projects-using-build-sbt" title="Permalink to this headline">¶</a></h3>
<p>For 3.17.0 and earlier releases of the plugin, it was necessary to add the
settings to your build configuration explicitly:</p>
<div class="highlight-text"><div class="highlight"><pre>import com.twitter.scrooge.ScroogeSBT
lazy val app = project.in(file("app"))
.settings(ScroogeSBT.newSettings: _*)
.settings(
// more settings here
)
</pre></div>
</div>
<p>This is no longer necessary, so the build above should look like this:</p>
<div class="highlight-text"><div class="highlight"><pre>lazy val app = project.in(file("app"))
.settings(
// more settings here
)
</pre></div>
</div>
<p>The default settings are included automatically, by virtue of the auto plugin
mechanism.</p>
<p>The plugin’s setting and task keys are also now brought into scope
automatically, so the following:</p>
<div class="highlight-text"><div class="highlight"><pre>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"
}
)
</pre></div>
</div>
<p>becomes simply:</p>
<div class="highlight-text"><div class="highlight"><pre>lazy val app = project.in(file("app"))
.settings(
scroogeThriftSourceFolder in Compile <<= baseDirectory {
base => base / "src/main/resources"
}
)
</pre></div>
</div>
</div>
<div class="section" id="using-build-scala">
<h3>Using <cite>Build.scala</cite><a class="headerlink" href="#using-build-scala" title="Permalink to this headline">¶</a></h3>
<p>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
<cite>autoImport</cite>. So this:</p>
<div class="highlight-text"><div class="highlight"><pre>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"
}
)
}
</pre></div>
</div>
<p>becomes:</p>
<div class="highlight-text"><div class="highlight"><pre>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"
}
)
}
</pre></div>
</div>
<p>That is to say: adjust the imports, and drop the settings injection.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/scrooge.png" alt="Logo"/>
</a></p><a href="index.html"><h3>Scrooge</h3></a>
<p>
Scrooge is a general purpose thrift parser/generator
</p>
<h3>Useful Links</h3>
<ul>
<li><a href="http://github.com/twitter/scrooge">Scrooge @ GitHub</a></li>
<li><a href="http://github.com/twitter/scrooge/issues">Issue Tracker</a></li>
</ul>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">SBT Plugin</a><ul>
<li><a class="reference internal" href="#migrating-from-3-x-x-to-3-18-0">Migrating from 3.x.x to 3.18.0</a><ul>
<li><a class="reference internal" href="#sbt-0-13-5-and-above">SBT 0.13.5 and above</a></li>
<li><a class="reference internal" href="#projects-using-build-sbt">Projects using <cite>build.sbt</cite></a></li>
<li><a class="reference internal" href="#using-build-scala">Using <cite>Build.scala</cite></a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="Namespaces.html" title="previous chapter">Namespaces</a></li>
<li>Next: <a href="MVNPlugin.html" title="next chapter">Maven Plugin</a></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Search the contents of this site.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright 2013 Twitter, Inc.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
</html>