Skip to content
This repository has been archived by the owner. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0ffa4f9

Browse files
committedJul 14, 2017
Builder pattern for CompileOptions
1 parent fe0e036 commit 0ffa4f9

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed
 

‎src/main/contraband-java/xsbti/compile/CompileOptions.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ public final class CompileOptions implements java.io.Serializable {
2626
private xsbti.F1<xsbti.Position, xsbti.Position> sourcePositionMapper;
2727
/** Controls the order in which Java and Scala sources are compiled. */
2828
private xsbti.compile.CompileOrder order;
29+
public CompileOptions() {
30+
super();
31+
classpath = new java.io.File[0];
32+
sources = new java.io.File[0];
33+
classesDirectory = new java.io.File("classes");
34+
scalacOptions = new String[0];
35+
javacOptions = new String[0];
36+
maxErrors = 100;
37+
sourcePositionMapper = new xsbti.F1<xsbti.Position, xsbti.Position>() { public xsbti.Position apply(xsbti.Position a) { return a; } };
38+
order = xsbti.compile.CompileOrder.Mixed;
39+
}
2940
public CompileOptions(java.io.File[] _classpath, java.io.File[] _sources, java.io.File _classesDirectory, String[] _scalacOptions, String[] _javacOptions, int _maxErrors, xsbti.F1<xsbti.Position, xsbti.Position> _sourcePositionMapper, xsbti.compile.CompileOrder _order) {
3041
super();
3142
classpath = _classpath;

‎src/main/contraband/incremental.json

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,39 +256,61 @@
256256
{
257257
"name": "classpath",
258258
"type": "java.io.File*",
259+
"default": "new java.io.File[0]",
259260
"doc": [
260261
"The classpath to use for compilation.",
261262
"This will be modified according to the ClasspathOptions used to configure the ScalaCompiler."
262-
]
263+
],
264+
"since": "0.1.0"
263265
},
264266
{
265267
"name": "sources",
266268
"type": "java.io.File*",
269+
"default": "new java.io.File[0]",
267270
"doc": [
268271
"All sources that should be recompiled.",
269272
"This should include Scala and Java sources, which are identified by their extension."
270-
]
273+
],
274+
"since": "0.1.0"
275+
},
276+
{
277+
"name": "classesDirectory",
278+
"type": "java.io.File",
279+
"default": "new java.io.File(\"classes\")",
280+
"since": "0.1.0"
271281
},
272-
{ "name": "classesDirectory", "type": "java.io.File" },
273282
{
274283
"name": "scalacOptions",
275284
"type": "String*",
276-
"doc": "The options to pass to the Scala compiler other than the sources and classpath to use."
285+
"default": "new String[0]",
286+
"doc": "The options to pass to the Scala compiler other than the sources and classpath to use.",
287+
"since": "0.1.0"
277288
},
278289
{
279290
"name": "javacOptions",
280291
"type": "String*",
281-
"doc": "The options to pass to the Java compiler other than the sources and classpath to use."
292+
"default": "new String[0]",
293+
"doc": "The options to pass to the Java compiler other than the sources and classpath to use.",
294+
"since": "0.1.0"
295+
},
296+
{
297+
"name": "maxErrors",
298+
"type": "int",
299+
"default": "100",
300+
"since": "0.1.0"
282301
},
283-
{ "name": "maxErrors", "type": "int" },
284302
{
285303
"name": "sourcePositionMapper",
286-
"type": "xsbti.F1<xsbti.Position, xsbti.Position>"
304+
"type": "xsbti.F1<xsbti.Position, xsbti.Position>",
305+
"default": "new xsbti.F1<xsbti.Position, xsbti.Position>() { public xsbti.Position apply(xsbti.Position a) { return a; } }",
306+
"since": "0.1.0"
287307
},
288308
{
289309
"name": "order",
290310
"type": "xsbti.compile.CompileOrder",
291-
"doc": "Controls the order in which Java and Scala sources are compiled."
311+
"default": "xsbti.compile.CompileOrder.Mixed",
312+
"doc": "Controls the order in which Java and Scala sources are compiled.",
313+
"since": "0.1.0"
292314
}
293315
]
294316
},

0 commit comments

Comments
 (0)
This repository has been archived.